|
|
@ -63,7 +63,6 @@ func TestParseFail(t *testing.T) {
|
|
|
|
t.Errorf("Rule %q should have failed", fail)
|
|
|
|
t.Errorf("Rule %q should have failed", fail)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestParseFile(t *testing.T) {
|
|
|
|
func TestParseFile(t *testing.T) {
|
|
|
@ -99,6 +98,7 @@ func TestIgnore(t *testing.T) {
|
|
|
|
{`cargo/*.*`, "cargo/a.txt", true},
|
|
|
|
{`cargo/*.*`, "cargo/a.txt", true},
|
|
|
|
{`cargo/*.txt`, "mast/a.txt", false},
|
|
|
|
{`cargo/*.txt`, "mast/a.txt", false},
|
|
|
|
{`ru[c-e]?er.txt`, "rudder.txt", true},
|
|
|
|
{`ru[c-e]?er.txt`, "rudder.txt", true},
|
|
|
|
|
|
|
|
{`templates/.?*`, "templates/.dotfile", true},
|
|
|
|
|
|
|
|
|
|
|
|
// Directory tests
|
|
|
|
// Directory tests
|
|
|
|
{`cargo/`, "cargo", true},
|
|
|
|
{`cargo/`, "cargo", true},
|
|
|
@ -134,6 +134,15 @@ func TestIgnore(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestAddDefaults(t *testing.T) {
|
|
|
|
|
|
|
|
r := Rules{}
|
|
|
|
|
|
|
|
r.AddDefaults()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(r.patterns) != 1 {
|
|
|
|
|
|
|
|
t.Errorf("Expected 1 default patterns, got %d", len(r.patterns))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func parseString(str string) (*Rules, error) {
|
|
|
|
func parseString(str string) (*Rules, error) {
|
|
|
|
b := bytes.NewBuffer([]byte(str))
|
|
|
|
b := bytes.NewBuffer([]byte(str))
|
|
|
|
return Parse(b)
|
|
|
|
return Parse(b)
|
|
|
|