diff options
author | bnewbold <bnewbold@robocracy.org> | 2016-12-25 23:54:54 -0800 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2016-12-25 23:54:54 -0800 |
commit | 1e04c8274e473039d2b183c120ab7f3b1b981c3e (patch) | |
tree | e709cc0b99a7de3b0fd6eb71b292e7351286e95c /modelica-parser-lalrpop/tests/examples.rs.WIP | |
parent | 4bdf3106e13576e1b46a1d5e2e841ebc61045ee1 (diff) | |
download | modelthing-1e04c8274e473039d2b183c120ab7f3b1b981c3e.tar.gz modelthing-1e04c8274e473039d2b183c120ab7f3b1b981c3e.zip |
parser: namespacing
Diffstat (limited to 'modelica-parser-lalrpop/tests/examples.rs.WIP')
-rw-r--r-- | modelica-parser-lalrpop/tests/examples.rs.WIP | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/modelica-parser-lalrpop/tests/examples.rs.WIP b/modelica-parser-lalrpop/tests/examples.rs.WIP new file mode 100644 index 0000000..a206ac6 --- /dev/null +++ b/modelica-parser-lalrpop/tests/examples.rs.WIP @@ -0,0 +1,29 @@ + +extern crate modelica_parser; + +use std::io::Read; +use std::fs::{File, read_dir}; +use std::path::Path; +use modelica_parser::parser::parse_model; + +fn do_file(p: &Path) { + let mut s = String::new(); + File::open(p).and_then(|mut f| f.read_to_string(&mut s)).unwrap(); + modelica_parser::parser::parse_model(&s).unwrap(); +} + +#[test] +fn test_example_files() { + + let files: Vec<&Path> = read_dir(Path::new("./examples/modelica_models/")) + .unwrap() + .map(|x| x.unwrap()) + .filter(|x| x.metadata().unwrap().is_file()) + .filter(|x| x.path().suffix().equals(".mo")) + .map(|x| x.path()) + .collect(); + + for p in &files { + do_file(p); + } +} |