diff options
Diffstat (limited to 'src/pkg/archive/zip/reader_test.go')
-rw-r--r-- | src/pkg/archive/zip/reader_test.go | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/pkg/archive/zip/reader_test.go b/src/pkg/archive/zip/reader_test.go index 78875ecbf..5652f3a50 100644 --- a/src/pkg/archive/zip/reader_test.go +++ b/src/pkg/archive/zip/reader_test.go @@ -235,6 +235,18 @@ var tests = []ZipTest{ }, }, }, + // Another zip64 file with different Extras fields. (golang.org/issue/7069) + { + Name: "zip64-2.zip", + File: []ZipTestFile{ + { + Name: "README", + Content: []byte("This small file is in ZIP64 format.\n"), + Mtime: "08-10-12 14:33:32", + Mode: 0644, + }, + }, + }, } var crossPlatform = []ZipTestFile{ @@ -343,19 +355,13 @@ func readTestFile(t *testing.T, zt ZipTest, ft ZipTestFile, f *File) { testFileMode(t, zt.Name, f, ft.Mode) - size0 := f.UncompressedSize - var b bytes.Buffer r, err := f.Open() if err != nil { - t.Error(err) + t.Errorf("%s: %v", zt.Name, err) return } - if size1 := f.UncompressedSize; size0 != size1 { - t.Errorf("file %q changed f.UncompressedSize from %d to %d", f.Name, size0, size1) - } - _, err = io.Copy(&b, r) if err != ft.ContentErr { t.Errorf("%s: copying contents: %v (want %v)", zt.Name, err, ft.ContentErr) @@ -365,6 +371,14 @@ func readTestFile(t *testing.T, zt ZipTest, ft ZipTestFile, f *File) { } r.Close() + size := uint64(f.UncompressedSize) + if size == uint32max { + size = f.UncompressedSize64 + } + if g := uint64(b.Len()); g != size { + t.Errorf("%v: read %v bytes but f.UncompressedSize == %v", f.Name, g, size) + } + var c []byte if ft.Content != nil { c = ft.Content |