Skip to content

Commit

Permalink
newtype improved
Browse files Browse the repository at this point in the history
  • Loading branch information
limuy2022 committed May 26, 2024
1 parent dd839cd commit 5154fc0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/skip_test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import_user_defined
2 changes: 1 addition & 1 deletion src/compiler/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand Down
29 changes: 28 additions & 1 deletion tests/test_all_examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> = 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");
Expand Down

0 comments on commit 5154fc0

Please sign in to comment.