@@ -390,7 +390,7 @@ func TestMatches(t *testing.T) {
390
390
assert .Equal (t , err , filepath .ErrBadPattern )
391
391
} else {
392
392
assert .Nil (t , err )
393
- assert .Equal (t , test .match , res .isMatched , desc )
393
+ assert .Equal (t , test .match , res .IsMatched () , desc )
394
394
}
395
395
}
396
396
})
@@ -591,22 +591,24 @@ func TestMatch(t *testing.T) {
591
591
592
592
func TestMatchesAmount (t * testing.T ) {
593
593
testData := []struct {
594
- patterns []string
595
- input string
596
- matches uint
597
- excludes uint
598
- isMatch bool
594
+ patterns []string
595
+ input string
596
+ matches uint
597
+ excludes uint
598
+ isMatch bool
599
+ canSkipDir bool
599
600
}{
600
- {[]string {"1" , "2" , "3" }, "2" , 1 , 0 , true },
601
- {[]string {"2" , "!2" , "!2" }, "2" , 1 , 2 , false },
602
- {[]string {"1" , "2" , "2" }, "2" , 2 , 0 , true },
603
- {[]string {"1" , "2" , "2" , "2" }, "2" , 3 , 0 , true },
604
- {[]string {"/prefix/path" , "/prefix/other" }, "/prefix/path" , 1 , 0 , true },
605
- {[]string {"/prefix*" , "!/prefix/path" }, "/prefix/match" , 1 , 0 , true },
606
- {[]string {"/prefix*" , "!/prefix/path" }, "/prefix/path" , 1 , 0 , true },
607
- {[]string {"/prefix*" , "!/prefix/path" }, "prefix/path" , 0 , 1 , false },
608
- {[]string {"/prefix*" , "!./prefix/path" }, "prefix/path" , 0 , 1 , false },
609
- {[]string {"/prefix*" , "!prefix/path" }, "prefix/path" , 0 , 1 , false },
601
+ {[]string {"1" , "2" , "3" }, "2" , 1 , 0 , true , true },
602
+ {[]string {"!1" , "1" }, "1" , 1 , 1 , true , true },
603
+ {[]string {"2" , "!2" , "!2" }, "2" , 1 , 2 , false , false },
604
+ {[]string {"1" , "2" , "2" }, "2" , 2 , 0 , true , true },
605
+ {[]string {"1" , "2" , "2" , "2" }, "2" , 3 , 0 , true , true },
606
+ {[]string {"/prefix/path" , "/prefix/other" }, "/prefix/path" , 1 , 0 , true , true },
607
+ {[]string {"/prefix*" , "!/prefix/path" }, "/prefix/match" , 1 , 0 , true , false },
608
+ {[]string {"/prefix*" , "!/prefix/path" }, "/prefix/path" , 1 , 0 , true , false },
609
+ {[]string {"/prefix*" , "!/prefix/path" }, "prefix/path" , 0 , 1 , false , false },
610
+ {[]string {"/prefix*" , "!./prefix/path" }, "prefix/path" , 0 , 1 , false , false },
611
+ {[]string {"/prefix*" , "!prefix/path" }, "prefix/path" , 0 , 1 , false , false },
610
612
}
611
613
612
614
for _ , testCase := range testData {
@@ -618,6 +620,7 @@ func TestMatchesAmount(t *testing.T) {
618
620
assert .Equal (t , testCase .excludes , res .Excludes (), desc )
619
621
assert .Equal (t , testCase .matches , res .Matches (), desc )
620
622
assert .Equal (t , testCase .isMatch , res .IsMatched (), desc )
623
+ assert .Equal (t , testCase .canSkipDir , res .CanSkipDir (), desc )
621
624
622
625
isMatch , err := pm .IsMatch (testCase .input )
623
626
require .NoError (t , err )
0 commit comments