| 1 | extern crate peg; |
| 2 | |
| 3 | peg::parser!(grammar test_grammar() for str { |
| 4 | pub rule boundaries() -> String |
| 5 | = n:$("foo") { n.to_string() } |
| 6 | }); |
| 7 | |
| 8 | use self::test_grammar::*; |
| 9 | |
| 10 | // before we were testing string matches using .slice(), which |
| 11 | // threw an ugly panic!() when we compared unequal character |
| 12 | // boundaries.. this popped up while parsing unicode |
| 13 | fn main() { |
| 14 | assert!(boundaries("fââââ").is_err()); |
| 15 | } |