@@ -14,6 +14,7 @@ import (
14
14
func TestZipArchiver_Content (t * testing.T ) {
15
15
zipfilepath := "archive-content.zip"
16
16
archiver := NewZipArchiver (zipfilepath )
17
+ defer os .Remove (zipfilepath )
17
18
if err := archiver .ArchiveContent ([]byte ("This is some content" ), "content.txt" ); err != nil {
18
19
t .Fatalf ("unexpected error: %s" , err )
19
20
}
@@ -50,13 +51,16 @@ func TestZipArchiver_FileMode(t *testing.T) {
50
51
51
52
stringArray := [5 ]string {"0444" , "0644" , "0666" , "0744" , "0777" }
52
53
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
+ }()
60
64
}
61
65
}
62
66
0 commit comments