diff --git a/examples/skip_test b/examples/skip_test new file mode 100644 index 00000000..36d58470 --- /dev/null +++ b/examples/skip_test @@ -0,0 +1 @@ +import_user_defined \ No newline at end of file diff --git a/src/compiler/manager.rs b/src/compiler/manager.rs index a3c7b66f..3ba141bc 100644 --- a/src/compiler/manager.rs +++ b/src/compiler/manager.rs @@ -83,7 +83,7 @@ impl<'a> ModuleManager<'a> { // 开始编译源文件 let mut submodule_option = father.borrow().option.clone(); submodule_option.file_save = ctrc_path; - let compiler = Compiler::new(submodule_option); + let _compiler = Compiler::new(submodule_option); // self.cache.insert(path, module); Ok(()) } diff --git a/tests/test_all_examples.rs b/tests/test_all_examples.rs index 55210a6e..9da8af81 100644 --- a/tests/test_all_examples.rs +++ b/tests/test_all_examples.rs @@ -47,11 +47,38 @@ fn check_examples_eq(expected: &str, actual: &str) -> Result<(), String> { pub fn test_run_examples() { // 遍历整个examples目录 let mut panic_flag = false; + let skip_list: Vec = match read_to_string("examples/skip_test") { + Err(_) => vec![], + Ok(s) => { + let mut ret = vec![]; + for i in s.split("\n") { + ret.push(i.to_owned()); + } + ret + } + }; for entry in std::fs::read_dir("examples").unwrap() { let path = entry.unwrap().path(); - if path.is_file() { + if path.is_file() + && match path.extension() { + Some(ext) => ext == "trc", + None => false, + } + { let mut cmd = Command::cargo_bin("trc").unwrap(); // 获取标准答案 + // 判断skip test + let tmp = path.file_name().unwrap().to_str().unwrap(); + let mut skip_flag = false; + for i in &skip_list { + if tmp.contains(i) { + skip_flag = true; + break; + } + } + if skip_flag { + continue; + } let mut ans_path = path.clone(); ans_path.pop(); ans_path.push("expected_result");