Skip to content

Commit ac05357

Browse files
committed
ensure EOF after reading all files from the archive
1 parent a3f1564 commit ac05357

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/archive/tar/writer_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,9 +1351,6 @@ func TestWriterAddFs(t *testing.T) {
13511351

13521352
for name, file := range fsys {
13531353
hdr, err := tr.Next()
1354-
if err == io.EOF {
1355-
break // End of archive
1356-
}
13571354
if err != nil {
13581355
t.Fatal(err)
13591356
}
@@ -1374,4 +1371,10 @@ func TestWriterAddFs(t *testing.T) {
13741371
data, file.Data)
13751372
}
13761373
}
1374+
1375+
// check for end of archive
1376+
_, err := tr.Next()
1377+
if err != io.EOF {
1378+
t.Fatal("Expected end of archive, got err: ", err)
1379+
}
13771380
}

0 commit comments

Comments
 (0)