@@ -14,6 +14,7 @@ import (
1414func TestZipArchiver_Content (t * testing.T ) {
1515 zipfilepath := "archive-content.zip"
1616 archiver := NewZipArchiver (zipfilepath )
17+ defer os .Remove (zipfilepath )
1718 if err := archiver .ArchiveContent ([]byte ("This is some content" ), "content.txt" ); err != nil {
1819 t .Fatalf ("unexpected error: %s" , err )
1920 }
@@ -50,13 +51,16 @@ func TestZipArchiver_FileMode(t *testing.T) {
5051
5152 stringArray := [5 ]string {"0444" , "0644" , "0666" , "0744" , "0777" }
5253 for _ , element := range stringArray {
53- archiver := NewZipArchiver (zipFilePath )
54- archiver .SetOutputFileMode (element )
55- if err := archiver .ArchiveFile (toZipPath ); err != nil {
56- t .Fatalf ("unexpected error: %s" , err )
57- }
58-
59- ensureFileMode (t , zipFilePath , element )
54+ func () {
55+ archiver := NewZipArchiver (zipFilePath )
56+ defer os .Remove (zipFilePath )
57+ archiver .SetOutputFileMode (element )
58+ if err := archiver .ArchiveFile (toZipPath ); err != nil {
59+ t .Fatalf ("unexpected error: %s" , err )
60+ }
61+
62+ ensureFileMode (t , zipFilePath , element )
63+ }()
6064 }
6165}
6266
0 commit comments