| # 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 |
| error in call to regexp.Valid: error parsing regexp: unexpected ): `invalid)` |
| |
| Result: |
| (_|_){ |
| // [eval] |
| t1: (string){ "foo" } |
| t2: (_|_){ |
| // [eval] error in call to regexp.Find: no match |
| } |
| t3: (#list){ |
| 0: (string){ "foo" } |
| 1: (string){ "flo" } |
| } |
| t4: (#list){ |
| 0: (string){ "foo" } |
| 1: (string){ "flo" } |
| } |
| t5: (_|_){ |
| // [eval] error in call to regexp.FindAll: no match |
| } |
| t6: (#list){ |
| 0: (string){ "flo" } |
| 1: (string){ "l" } |
| 2: (string){ "o" } |
| } |
| t7: (#list){ |
| 0: (#list){ |
| 0: (string){ "flo" } |
| 1: (string){ "l" } |
| 2: (string){ "o" } |
| } |
| 1: (#list){ |
| 0: (string){ "foo" } |
| 1: (string){ "o" } |
| 2: (string){ "o" } |
| } |
| 2: (#list){ |
| 0: (string){ "fro" } |
| 1: (string){ "r" } |
| 2: (string){ "o" } |
| } |
| } |
| t8: (_|_){ |
| // [eval] error in call to regexp.FindAllSubmatch: no match |
| } |
| t9: (struct){ |
| A: (string){ "l" } |
| B: (string){ "o" } |
| } |
| t10: (#list){ |
| 0: (struct){ |
| A: (string){ "l" } |
| B: (string){ "o" } |
| } |
| 1: (struct){ |
| A: (string){ "o" } |
| B: (string){ "o" } |
| } |
| 2: (struct){ |
| A: (string){ "r" } |
| B: (string){ "o" } |
| } |
| } |
| t11: (#list){ |
| 0: (struct){ |
| A: (string){ "" } |
| } |
| } |
| t12: (_|_){ |
| // [eval] error in call to regexp.FindAllNamedSubmatch: no match |
| } |
| t13: (string){ "valid" } |
| t14: (_|_){ |
| // [eval] error in call to regexp.Valid: error parsing regexp: unexpected ): `invalid)` |
| } |
| } |