Skip to content

Commit

Permalink
Add test to assess that grammar is working
Browse files Browse the repository at this point in the history
  • Loading branch information
ricglz committed Apr 8, 2022
1 parent 228832a commit c11d330
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/test_parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,20 @@ pub fn parse_file(filename: &str, debug: bool) -> Result<(), Error<Rule>> {
}
parse(&program)
}

#[cfg(test)]
mod tests {
use std::fs::read_dir;

use super::*;

#[test]
fn example_files() {
let paths = read_dir("examples").unwrap();
for path in paths {
let file_path = path.expect("File must exist").path();
let file = file_path.to_str().unwrap();
assert!(parse_file(file, true).is_ok());
}
}
}

0 comments on commit c11d330

Please sign in to comment.