blob: 058d1c3f4211771afd25b66a2d6b3a36bc125e03 [file] [log] [blame]
# generated from the original tests.
# Henceforth it may be nicer to group tests into separate files.
-- in.cue --
import "regexp"
t1: regexp.Find(#"f\w\w"#, "afoot")
t2: regexp.Find(#"f\w\w"#, "bar")
t3: regexp.FindAll(#"f\w\w"#, "afoot afloat from", 2)
t4: regexp.FindAll(#"f\w\w"#, "afoot afloat from", 2)
t5: regexp.FindAll(#"f\w\w"#, "bla bla", -1)
t6: regexp.FindSubmatch(#"f(\w)(\w)"#, "afloat afoot from")
t7: regexp.FindAllSubmatch(#"f(\w)(\w)"#, "afloat afoot from", -1)
t8: regexp.FindAllSubmatch(#"f(\w)(\w)"#, "aglom", -1)
t9: regexp.FindNamedSubmatch(#"f(?P<A>\w)(?P<B>\w)"#, "afloat afoot from")
t10: regexp.FindAllNamedSubmatch(#"f(?P<A>\w)(?P<B>\w)"#, "afloat afoot from", -1)
t11: regexp.FindAllNamedSubmatch(#"f(?P<A>optional)?"#, "fbla", -1)
t12: regexp.FindAllNamedSubmatch(#"f(?P<A>\w)(?P<B>\w)"#, "aglom", -1)
t13: regexp.Valid & "valid"
t14: regexp.Valid & "invalid)"
-- out/regexp --
Errors:
error in call to regexp.Find: no match
error in call to regexp.FindAll: no match
error in call to regexp.FindAllNamedSubmatch: no match
error in call to regexp.FindAllSubmatch: no match
t14: invalid value "invalid)" (does not satisfy regexp.Valid): error in call to regexp.Valid: error parsing regexp: unexpected ): `invalid)`:
./in.cue:16:21
Result:
t1: "foo"
t2: _|_ // error in call to regexp.Find: no match (and 1 more errors)
t3: ["foo", "flo"]
t4: ["foo", "flo"]
t5: _|_ // error in call to regexp.FindAll: no match (and 1 more errors)
t6: ["flo", "l", "o"]
t7: [["flo", "l", "o"], ["foo", "o", "o"], ["fro", "r", "o"]]
t8: _|_ // error in call to regexp.FindAllSubmatch: no match (and 1 more errors)
t9: {
A: "l"
B: "o"
}
t10: [{
A: "l"
B: "o"
}, {
A: "o"
B: "o"
}, {
A: "r"
B: "o"
}]
t11: [{
A: ""
}]
t12: _|_ // error in call to regexp.FindAllNamedSubmatch: no match (and 1 more errors)
t13: "valid"
t14: _|_ // t14: invalid value "invalid)" (does not satisfy regexp.Valid): error in call to regexp.Valid: error parsing regexp: unexpected ): `invalid)`