You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This program (attached):
package main
import "regexp"
func main() {
f := func(pattern, s string) {
switch b, err := regexp.Match(pattern, []byte(s)); err {
case nil: { println("Got a match?", b) }
default: { println("FAIL:", err.String()) }
}
}
f("a+b", "a+b")
f("a*b", "a*b")
f("a?b", "a?b")
f("+b", "+b")
f("*b", "*b")
f("?b", "?b")
}
outputs this:
Got a match? false
Got a match? true
Got a match? true
FAIL: closure applies to nothing
FAIL: closure applies to nothing
Got a match? true
but the last case should also trigger an error.
The fix is obvious and trivial. I'll post a CL shortly.
by benlynn:
Attachments:
The text was updated successfully, but these errors were encountered: