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); } }