add more test case

This commit is contained in:
lulongshan
2021-08-11 08:51:07 +08:00
committed by finley
parent 31327434bf
commit c9f33d08c2

View File

@@ -81,6 +81,18 @@ func TestWildCard(t *testing.T) {
t.Error("expect false actually true") t.Error("expect false actually true")
} }
// test [^]
p = CompilePattern("h[^ab]llo")
if p.IsMatch("hallo") {
t.Error("expect false actually true")
}
if p.IsMatch("hbllo") {
t.Error("expect false actually true")
}
if !p.IsMatch("hcllo") {
t.Error("expect true actually false")
}
// test escape // test escape
p = CompilePattern("\\\\") // pattern: \\ p = CompilePattern("\\\\") // pattern: \\
if !p.IsMatch("\\") { if !p.IsMatch("\\") {