Henri Chataing | 5a53f3d | 2022-02-08 11:29:28 +0100 | [diff] [blame] | 1 | // Licensed under the Apache License, Version 2.0 |
| 2 | // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT |
| 3 | // license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 4 | // option. All files in the project carrying such notice may not be copied, |
| 5 | // modified, or distributed except according to those terms. |
| 6 | |
| 7 | #[macro_use] |
| 8 | extern crate pest; |
| 9 | #[macro_use] |
| 10 | extern crate pest_derive; |
| 11 | |
| 12 | #[derive(Parser)] |
| 13 | #[grammar_inline = "string = { \"abc\" }"] |
| 14 | struct GrammarParser; |
| 15 | |
| 16 | #[test] |
| 17 | fn inline_string() { |
| 18 | parses_to! { |
| 19 | parser: GrammarParser, |
| 20 | input: "abc", |
| 21 | rule: Rule::string, |
| 22 | tokens: [ |
| 23 | string(0, 3) |
| 24 | ] |
| 25 | }; |
| 26 | } |