@@ -266,3 +266,39 @@ func TestReadDirRecursive(t *testing.T) {
266
266
require .Equal (t , "_testdata/symlinktofolder/subfolder" , list [12 ].String ())
267
267
require .Equal (t , "_testdata/symlinktofolder/subfolder/file4" , list [13 ].String ())
268
268
}
269
+
270
+ func TestFilterDirs (t * testing.T ) {
271
+ testPath := New ("_testdata" )
272
+
273
+ list , err := testPath .ReadDir ()
274
+ require .NoError (t , err )
275
+ require .Len (t , list , 4 )
276
+
277
+ require .Equal (t , "_testdata/anotherFile" , list [0 ].String ())
278
+ require .Equal (t , "_testdata/file" , list [1 ].String ())
279
+ require .Equal (t , "_testdata/folder" , list [2 ].String ())
280
+ require .Equal (t , "_testdata/symlinktofolder" , list [3 ].String ())
281
+
282
+ list .FilterDirs ()
283
+ require .Len (t , list , 2 )
284
+ require .Equal (t , "_testdata/folder" , list [0 ].String ())
285
+ require .Equal (t , "_testdata/symlinktofolder" , list [1 ].String ())
286
+ }
287
+
288
+ func TestFilterOutDirs (t * testing.T ) {
289
+ testPath := New ("_testdata" )
290
+
291
+ list , err := testPath .ReadDir ()
292
+ require .NoError (t , err )
293
+ require .Len (t , list , 4 )
294
+
295
+ require .Equal (t , "_testdata/anotherFile" , list [0 ].String ())
296
+ require .Equal (t , "_testdata/file" , list [1 ].String ())
297
+ require .Equal (t , "_testdata/folder" , list [2 ].String ())
298
+ require .Equal (t , "_testdata/symlinktofolder" , list [3 ].String ())
299
+
300
+ list .FilterOutDirs ()
301
+ require .Len (t , list , 2 )
302
+ require .Equal (t , "_testdata/anotherFile" , list [0 ].String ())
303
+ require .Equal (t , "_testdata/file" , list [1 ].String ())
304
+ }
0 commit comments