diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
commit | 519725bb3c075ee2462c929f5997cb068e18466a (patch) | |
tree | 5b162e8488ad147a645048c073577821b4a2bee9 /src/pkg/archive/tar/writer_test.go | |
parent | 842623c5dd2819d980ca9c58048d6bc6ed82475f (diff) | |
download | golang-upstream-weekly/2012.03.22.tar.gz |
Imported Upstream version 2012.03.22upstream-weekly/2012.03.22
Diffstat (limited to 'src/pkg/archive/tar/writer_test.go')
-rw-r--r-- | src/pkg/archive/tar/writer_test.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pkg/archive/tar/writer_test.go b/src/pkg/archive/tar/writer_test.go index 0b413722d..a214e57b9 100644 --- a/src/pkg/archive/tar/writer_test.go +++ b/src/pkg/archive/tar/writer_test.go @@ -9,6 +9,7 @@ import ( "fmt" "io" "io/ioutil" + "strings" "testing" "testing/iotest" "time" @@ -95,7 +96,8 @@ var writerTests = []*writerTest{ Uname: "dsymonds", Gname: "eng", }, - // no contents + // fake contents + contents: strings.Repeat("\x00", 4<<10), }, }, }, @@ -150,7 +152,9 @@ testLoop: buf := new(bytes.Buffer) tw := NewWriter(iotest.TruncateWriter(buf, 4<<10)) // only catch the first 4 KB + big := false for j, entry := range test.entries { + big = big || entry.header.Size > 1<<10 if err := tw.WriteHeader(entry.header); err != nil { t.Errorf("test %d, entry %d: Failed writing header: %v", i, j, err) continue testLoop @@ -160,7 +164,8 @@ testLoop: continue testLoop } } - if err := tw.Close(); err != nil { + // Only interested in Close failures for the small tests. + if err := tw.Close(); err != nil && !big { t.Errorf("test %d: Failed closing archive: %v", i, err) continue testLoop } |