compression_test.go 307 B

123456789101112131415161718192021
  1. package util
  2. import (
  3. "testing"
  4. "golang.org/x/tools/godoc/util"
  5. )
  6. func TestIsGzippable(t *testing.T) {
  7. buf := make([]byte, 1024)
  8. isText := util.IsText(buf)
  9. if isText {
  10. t.Error("buf with zeros are not text")
  11. }
  12. compressed, _ := GzipData(buf)
  13. t.Logf("compressed size %d\n", len(compressed))
  14. }