@@ -194,15 +194,33 @@ func Test_extraFile(t *testing.T) {
194
194
}
195
195
196
196
func TestExtractFiles (t * testing.T ) {
197
- compressor := GetCompressor (".tar.gz" , []string {"bb" , "cc" })
198
- assert .NotNil (t , compressor )
197
+ t .Run ("test .tar.gz" , func (t * testing.T ) {
198
+ compressor := GetCompressor (".tar.gz" , []string {"bb" , "cc" })
199
+ assert .NotNil (t , compressor )
199
200
200
- err := compressor .ExtractFiles ("testdata/simple.tar.gz" , "aa" )
201
- assert .NoError (t , err )
201
+ err := compressor .ExtractFiles ("testdata/simple.tar.gz" , "aa" )
202
+ assert .NoError (t , err )
202
203
203
- assertFileContentEqual (t , "testdata/aa" , "aa\n " )
204
- assertFileContentEqual (t , "testdata/bb" , "bb\n " )
205
- assertFileContentEqual (t , "testdata/cc" , "cc\n " )
204
+ assertFileContentEqual (t , "testdata/aa" , "aa\n " )
205
+ assertFileContentEqual (t , "testdata/bb" , "bb\n " )
206
+ assertFileContentEqual (t , "testdata/cc" , "cc\n " )
207
+ })
208
+
209
+ t .Run ("test .zip" , func (t * testing.T ) {
210
+ compressor := GetCompressor (".zip" , []string {"bb" , "cc" })
211
+ assert .NotNil (t , compressor )
212
+
213
+ err := compressor .ExtractFiles ("testdata/simple.zip" , "aa" )
214
+ assert .NoError (t , err )
215
+
216
+ assertFileContentEqual (t , "testdata/aa" , "aa\n " )
217
+ assertFileContentEqual (t , "testdata/bb" , "bb\n " )
218
+ assertFileContentEqual (t , "testdata/cc" , "cc\n " )
219
+
220
+ // invalid parameters
221
+ err = compressor .ExtractFiles ("" , "" )
222
+ assert .Error (t , err )
223
+ })
206
224
}
207
225
208
226
func assertFileContentEqual (t * testing.T , filePath string , expectedContent string ) {
0 commit comments