@@ -73,6 +73,21 @@ func TestCopyFolderWithTechnologyFiltering(t *testing.T) {
73
73
assertFileExists (t , fs , filepath .Join (targetDir , "fileB1.txt" ))
74
74
assertFileNotExists (t , fs , filepath .Join (targetDir , "fileC1.txt" ))
75
75
})
76
+ t .Run ("copy with multiple technology filter with whitespace" , func (t * testing.T ) {
77
+ t .Cleanup (func () {
78
+ _ = fs .RemoveAll (targetDir )
79
+ _ = fs .MkdirAll (targetDir , 0755 )
80
+ })
81
+
82
+ technology := "java, python"
83
+ err := CopyByTechnology (testLog , fs , sourceDir , targetDir , technology )
84
+ require .NoError (t , err )
85
+
86
+ assertFileExists (t , fs , filepath .Join (targetDir , "fileA1.txt" ))
87
+ assertFileExists (t , fs , filepath .Join (targetDir , "fileA2.txt" ))
88
+ assertFileExists (t , fs , filepath .Join (targetDir , "fileB1.txt" ))
89
+ assertFileNotExists (t , fs , filepath .Join (targetDir , "fileC1.txt" ))
90
+ })
76
91
t .Run ("copy with invalid technology filter" , func (t * testing.T ) {
77
92
t .Cleanup (func () {
78
93
_ = fs .RemoveAll (targetDir )
@@ -192,6 +207,15 @@ func TestFilterFilesByTechnology(t *testing.T) {
192
207
filepath .Join ("fileB1.txt" ),
193
208
}, paths )
194
209
})
210
+ t .Run ("filter multiple technologies with white spaces" , func (t * testing.T ) {
211
+ paths , err := filterFilesByTechnology (testLog , fs , sourceDir , []string {"java " , " python " })
212
+ require .NoError (t , err )
213
+ assert .ElementsMatch (t , []string {
214
+ filepath .Join ("fileA1.txt" ),
215
+ filepath .Join ("fileA2.txt" ),
216
+ filepath .Join ("fileB1.txt" ),
217
+ }, paths )
218
+ })
195
219
t .Run ("not filter non-existing technology" , func (t * testing.T ) {
196
220
paths , err := filterFilesByTechnology (testLog , fs , sourceDir , []string {"php" })
197
221
require .NoError (t , err )
0 commit comments