diff options
Diffstat (limited to 'src/pkg/compress/gzip/gunzip_test.go')
-rw-r--r-- | src/pkg/compress/gzip/gunzip_test.go | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/src/pkg/compress/gzip/gunzip_test.go b/src/pkg/compress/gzip/gunzip_test.go index 8cc7890e4..867f61efa 100644 --- a/src/pkg/compress/gzip/gunzip_test.go +++ b/src/pkg/compress/gzip/gunzip_test.go @@ -12,31 +12,31 @@ import ( ) type gzipTest struct { - name string; - desc string; - raw string; - gzip []byte; - err os.Error; + name string; + desc string; + raw string; + gzip []byte; + err os.Error; } -var gzipTests = []gzipTest { - gzipTest { // has 1 empty fixed-huffman block +var gzipTests = []gzipTest{ + gzipTest{ // has 1 empty fixed-huffman block "empty.txt", "empty.txt", "", - []byte { + []byte{ 0x1f, 0x8b, 0x08, 0x08, 0xf7, 0x5e, 0x14, 0x4a, 0x00, 0x03, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, - nil + nil, }, - gzipTest { // has 1 non-empty fixed huffman block + gzipTest{ // has 1 non-empty fixed huffman block "hello.txt", "hello.txt", "hello world\n", - []byte { + []byte{ 0x1f, 0x8b, 0x08, 0x08, 0xc8, 0x58, 0x13, 0x4a, 0x00, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x74, 0x78, 0x74, 0x00, 0xcb, 0x48, 0xcd, 0xc9, @@ -44,14 +44,14 @@ var gzipTests = []gzipTest { 0x02, 0x00, 0x2d, 0x3b, 0x08, 0xaf, 0x0c, 0x00, 0x00, 0x00, }, - nil + nil, }, - gzipTest { // concatenation + gzipTest{ // concatenation "hello.txt", "hello.txt x2", "hello world\n" "hello world\n", - []byte { + []byte{ 0x1f, 0x8b, 0x08, 0x08, 0xc8, 0x58, 0x13, 0x4a, 0x00, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x74, 0x78, 0x74, 0x00, 0xcb, 0x48, 0xcd, 0xc9, @@ -65,13 +65,13 @@ var gzipTests = []gzipTest { 0x02, 0x00, 0x2d, 0x3b, 0x08, 0xaf, 0x0c, 0x00, 0x00, 0x00, }, - nil + nil, }, - gzipTest { // has a fixed huffman block with some length-distance pairs + gzipTest{ // has a fixed huffman block with some length-distance pairs "shesells.txt", "shesells.txt", "she sells seashells by the seashore\n", - []byte { + []byte{ 0x1f, 0x8b, 0x08, 0x08, 0x72, 0x66, 0x8b, 0x4a, 0x00, 0x03, 0x73, 0x68, 0x65, 0x73, 0x65, 0x6c, 0x6c, 0x73, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x2b, @@ -81,9 +81,9 @@ var gzipTests = []gzipTest { 0x94, 0xca, 0x05, 0x00, 0x76, 0xb0, 0x3b, 0xeb, 0x24, 0x00, 0x00, 0x00, }, - nil + nil, }, - gzipTest { // has dynamic huffman blocks + gzipTest{ // has dynamic huffman blocks "gettysburg", "gettysburg", " Four score and seven years ago our fathers brought forth on\n" @@ -115,7 +115,7 @@ var gzipTests = []gzipTest { "people, for the people, shall not perish from this earth.\n" "\n" "Abraham Lincoln, November 19, 1863, Gettysburg, Pennsylvania\n", - []byte { + []byte{ 0x1f, 0x8b, 0x08, 0x08, 0xd1, 0x12, 0x2b, 0x4a, 0x00, 0x03, 0x67, 0x65, 0x74, 0x74, 0x79, 0x73, 0x62, 0x75, 0x72, 0x67, 0x00, 0x65, 0x54, 0xcd, @@ -219,13 +219,13 @@ var gzipTests = []gzipTest { 0x4a, 0x65, 0x8f, 0x08, 0x42, 0x60, 0xf7, 0x0f, 0xb9, 0x16, 0x0b, 0x0c, 0x1a, 0x06, 0x00, 0x00, }, - nil + nil, }, - gzipTest { // has 1 non-empty fixed huffman block then garbage + gzipTest{ // has 1 non-empty fixed huffman block then garbage "hello.txt", "hello.txt + garbage", "hello world\n", - []byte { + []byte{ 0x1f, 0x8b, 0x08, 0x08, 0xc8, 0x58, 0x13, 0x4a, 0x00, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x74, 0x78, 0x74, 0x00, 0xcb, 0x48, 0xcd, 0xc9, @@ -235,11 +235,11 @@ var gzipTests = []gzipTest { }, HeaderError, }, - gzipTest { // has 1 non-empty fixed huffman block not enough header + gzipTest{ // has 1 non-empty fixed huffman block not enough header "hello.txt", "hello.txt + garbage", "hello world\n", - []byte { + []byte{ 0x1f, 0x8b, 0x08, 0x08, 0xc8, 0x58, 0x13, 0x4a, 0x00, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x74, 0x78, 0x74, 0x00, 0xcb, 0x48, 0xcd, 0xc9, @@ -249,11 +249,11 @@ var gzipTests = []gzipTest { }, io.ErrUnexpectedEOF, }, - gzipTest { // has 1 non-empty fixed huffman block but corrupt checksum + gzipTest{ // has 1 non-empty fixed huffman block but corrupt checksum "hello.txt", "hello.txt + corrupt checksum", "hello world\n", - []byte { + []byte{ 0x1f, 0x8b, 0x08, 0x08, 0xc8, 0x58, 0x13, 0x4a, 0x00, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x74, 0x78, 0x74, 0x00, 0xcb, 0x48, 0xcd, 0xc9, @@ -263,11 +263,11 @@ var gzipTests = []gzipTest { }, ChecksumError, }, - gzipTest { // has 1 non-empty fixed huffman block but corrupt size + gzipTest{ // has 1 non-empty fixed huffman block but corrupt size "hello.txt", "hello.txt + corrupt size", "hello world\n", - []byte { + []byte{ 0x1f, 0x8b, 0x08, 0x08, 0xc8, 0x58, 0x13, 0x4a, 0x00, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x74, 0x78, 0x74, 0x00, 0xcb, 0x48, 0xcd, 0xc9, @@ -303,4 +303,3 @@ func TestInflater(t *testing.T) { } } } - |