Skip to content

Commit

Permalink
define an API for the parser generator with basic failing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-johnson-4 committed Nov 21, 2023
1 parent 97340c6 commit 8cd98a7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/c_parser_generator.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

use lambda_mountain::parser_generator::compile;

#[test]
fn cfg1() {
let grammar = compile("entry-point := /a/");
assert_eq!(
grammar.run("").to_string(),
"Error in String at line 1 column 1: expected /a/ in rule entry-point"
);
assert_eq!(
grammar.run("a").to_string(),
"Success"
);
assert_eq!(
grammar.run("aa").to_string(),
"Error in String at line 1 column 1: expected EOF in rule entry-point"
);
}

0 comments on commit 8cd98a7

Please sign in to comment.