| # 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: |
| t14: invalid value "invalid)" (does not satisfy regexp.Valid): error in call to regexp.Valid: error parsing regexp: unexpected ): `invalid)`: |
| ./in.cue:16:21 |
| error in call to regexp.Find: no match: |
| ./in.cue:4:5 |
| error in call to regexp.FindAll: no match: |
| ./in.cue:7:5 |
| error in call to regexp.FindAllSubmatch: no match: |
| ./in.cue:10:5 |
| error in call to regexp.FindAllNamedSubmatch: no match: |
| ./in.cue:14:6 |
| |
| Result: |
| t1: "foo" |
| t2: _|_ // error in call to regexp.Find: no match |
| t3: ["foo", "flo"] |
| t4: ["foo", "flo"] |
| t5: _|_ // error in call to regexp.FindAll: no match |
| t6: ["flo", "l", "o"] |
| t7: [["flo", "l", "o"], ["foo", "o", "o"], ["fro", "r", "o"]] |
| t8: _|_ // error in call to regexp.FindAllSubmatch: no match |
| 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 |
| t13: "valid" |
| t14: _|_ // t14: invalid value "invalid)" (does not satisfy regexp.Valid): error in call to regexp.Valid: error parsing regexp: unexpected ): `invalid)` |
| |