diff options
author | Greg Brown <gmb60@cam.ac.uk> | 2021-01-09 14:31:02 +0000 |
---|---|---|
committer | Greg Brown <gmb60@cam.ac.uk> | 2021-01-09 14:31:02 +0000 |
commit | 0d01692c97ea8ca6fc4b229e5b9678cb252bceda (patch) | |
tree | 6c5ed07740b814f50dddbc6afaefc21c11dc3440 /chomp-macro/tests/regex.rs | |
parent | 487ce4fe0fa081f58d790d7d6417bf7d2659197c (diff) |
Introduce chomp as a procedural macro.
Add a bunch of tests.
Fix chomp and chewed so autochomp compiles.
Diffstat (limited to 'chomp-macro/tests/regex.rs')
-rw-r--r-- | chomp-macro/tests/regex.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/chomp-macro/tests/regex.rs b/chomp-macro/tests/regex.rs new file mode 100644 index 0000000..1e831b4 --- /dev/null +++ b/chomp-macro/tests/regex.rs @@ -0,0 +1,27 @@ +chomp_macro::nibble! { + let opt(x) = _ | x; + let plus(x) = [plus](x . opt(plus)); + let star(x) = [star](opt(x . star)); + + match plus("a") . star("b"); +} + +#[test] +fn regex_a() { + Ast::parse_str("a").unwrap(); +} + +#[test] +fn regex_ab() { + Ast::parse_str("ab").unwrap(); +} + +#[test] +fn regex_aa() { + Ast::parse_str("aa").unwrap(); +} + +#[test] +fn regex_aaaabbb() { + Ast::parse_str("aaaabbb").unwrap(); +} |