Fix issue with backslashes when using pattern function

This commit is contained in:
TwinProduction
2021-01-04 18:01:39 -05:00
parent f1c0bbe73c
commit c27cb7af08
3 changed files with 45 additions and 11 deletions

View File

@ -0,0 +1,21 @@
package pattern
import "testing"
func BenchmarkMatch(b *testing.B) {
for n := 0; n < b.N; n++ {
if !Match("*ing*", "livingroom") {
b.Error("should've matched")
}
}
b.ReportAllocs()
}
func BenchmarkMatchWithBackslash(b *testing.B) {
for n := 0; n < b.N; n++ {
if !Match("*ing*", "living\\room") {
b.Error("should've matched")
}
}
b.ReportAllocs()
}