@@ -25,6 +25,8 @@ func TestZipArchiver_Content(t *testing.T) {
25
25
26
26
func TestZipArchiver_File (t * testing.T ) {
27
27
zipfilepath := "archive-file.zip"
28
+ defer os .Remove (zipfilepath )
29
+
28
30
archiver := NewZipArchiver (zipfilepath )
29
31
if err := archiver .ArchiveFile ("./test-fixtures/test-file.txt" ); err != nil {
30
32
t .Fatalf ("unexpected error: %s" , err )
@@ -60,7 +62,7 @@ func TestZipArchiver_FileMode(t *testing.T) {
60
62
61
63
func TestZipArchiver_FileModified (t * testing.T ) {
62
64
var (
63
- zipFilePath = filepath .FromSlash ("archive-file.zip" )
65
+ zipFilePath = filepath .FromSlash ("archive-file-modified .zip" )
64
66
toZipPath = filepath .FromSlash ("./test-fixtures/test-file.txt" )
65
67
)
66
68
@@ -72,6 +74,7 @@ func TestZipArchiver_FileModified(t *testing.T) {
72
74
}
73
75
74
76
zip ()
77
+ defer os .Remove (zipFilePath )
75
78
76
79
expectedContents , err := os .ReadFile (zipFilePath )
77
80
if err != nil {
@@ -98,6 +101,8 @@ func TestZipArchiver_FileModified(t *testing.T) {
98
101
99
102
func TestZipArchiver_Dir (t * testing.T ) {
100
103
zipfilepath := "archive-dir.zip"
104
+ defer os .Remove (zipfilepath )
105
+
101
106
archiver := NewZipArchiver (zipfilepath )
102
107
if err := archiver .ArchiveDir ("./test-fixtures/test-dir" , []string {"" }); err != nil {
103
108
t .Fatalf ("unexpected error: %s" , err )
@@ -111,7 +116,9 @@ func TestZipArchiver_Dir(t *testing.T) {
111
116
}
112
117
113
118
func TestZipArchiver_Dir_Exclude (t * testing.T ) {
114
- zipfilepath := "archive-dir.zip"
119
+ zipfilepath := "archive-dir-exclude.zip"
120
+ defer os .Remove (zipfilepath )
121
+
115
122
archiver := NewZipArchiver (zipfilepath )
116
123
if err := archiver .ArchiveDir ("./test-fixtures/test-dir" , []string {"file2.txt" }); err != nil {
117
124
t .Fatalf ("unexpected error: %s" , err )
@@ -124,7 +131,9 @@ func TestZipArchiver_Dir_Exclude(t *testing.T) {
124
131
}
125
132
126
133
func TestZipArchiver_Dir_Exclude_With_Directory (t * testing.T ) {
127
- zipfilepath := "archive-dir.zip"
134
+ zipfilepath := "archive-dir-exclude-dir.zip"
135
+ defer os .Remove (zipfilepath )
136
+
128
137
archiver := NewZipArchiver (zipfilepath )
129
138
if err := archiver .ArchiveDir ("./test-fixtures/" , []string {"test-dir" , "test-dir2/file2.txt" }); err != nil {
130
139
t .Fatalf ("unexpected error: %s" , err )
@@ -139,6 +148,8 @@ func TestZipArchiver_Dir_Exclude_With_Directory(t *testing.T) {
139
148
140
149
func TestZipArchiver_Multiple (t * testing.T ) {
141
150
zipfilepath := "archive-content.zip"
151
+ defer os .Remove (zipfilepath )
152
+
142
153
content := map [string ][]byte {
143
154
"file1.txt" : []byte ("This is file 1" ),
144
155
"file2.txt" : []byte ("This is file 2" ),
0 commit comments