mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-15 23:18:48 +00:00
Initial commit
This commit is contained in:
21
tests/ast_printer_test.rs
Normal file
21
tests/ast_printer_test.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use std::path::Path;
|
||||
|
||||
use kecc::*;
|
||||
|
||||
#[test]
|
||||
fn ast_printer_test() {
|
||||
let mut parse = Parse::default();
|
||||
let dir_path = Path::new("examples/");
|
||||
let dir = dir_path.read_dir().expect("read_dir call failed");
|
||||
for entry in dir {
|
||||
let test_file = ok_or!(entry, continue);
|
||||
let test_unit = parse.translate(&test_file.path().as_path()).expect(
|
||||
&format!(
|
||||
"parse failed {:?}",
|
||||
test_file.path().into_os_string().to_str().unwrap()
|
||||
)
|
||||
.to_owned(),
|
||||
);
|
||||
write_c_test(&test_unit);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user