|
@@ -531,3 +531,28 @@ func TestWindowsPatterns(t *testing.T) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+func TestAutomaticCaseInsensitivity(t *testing.T) {
|
|
|
|
|
+ // We should do case insensitive matching by default on some platforms.
|
|
|
|
|
+ if runtime.GOOS != "windows" && runtime.GOOS != "darwin" {
|
|
|
|
|
+ t.Skip("Windows/Mac specific test")
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ stignore := `
|
|
|
|
|
+ A/B
|
|
|
|
|
+ c/d
|
|
|
|
|
+ `
|
|
|
|
|
+ pats := New(true)
|
|
|
|
|
+ err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ t.Fatal(err)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ tests := []string{`a/B`, `C/d`}
|
|
|
|
|
+ for _, pat := range tests {
|
|
|
|
|
+ if !pats.Match(pat) {
|
|
|
|
|
+ t.Errorf("Should match %s", pat)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|