diff --git a/compiler/src/test.rs b/compiler/src/test.rs index 5d7d7eb2a6..62c17db6f1 100644 --- a/compiler/src/test.rs +++ b/compiler/src/test.rs @@ -231,7 +231,9 @@ impl Namespace for CompileNamespace { .unwrap_or_else(|_| "Error converting ast to string.".to_string()), ); - std::fs::remove_dir_all(std::path::Path::new("/tmp/output")).expect("Error failed to clean up output dir."); + if std::fs::read_dir("/tmp/output").is_ok() { + std::fs::remove_dir_all(std::path::Path::new("/tmp/output")).expect("Error failed to clean up output dir."); + } let final_output = CompileOutput { circuit: last_circuit.unwrap(), diff --git a/parser/src/test.rs b/parser/src/test.rs index 0b5c9c3060..26d5f9a7d0 100644 --- a/parser/src/test.rs +++ b/parser/src/test.rs @@ -95,11 +95,7 @@ impl Namespace for ParseStatementNamespace { } fn run_test(&self, test: Test) -> Result { - let tokenizer = tokenizer::tokenize("test", test.content.into()).map_err(|x| { - let s = x.to_string(); - println!("s is {}", s); - s - })?; + let tokenizer = tokenizer::tokenize("test", test.content.into()).map_err(|x| x.to_string())?; if tokenizer .iter() .all(|x| matches!(x.token, Token::CommentLine(_) | Token::CommentBlock(_))) @@ -112,11 +108,7 @@ impl Namespace for ParseStatementNamespace { } let mut tokens = ParserContext::new(tokenizer); - let parsed = tokens.parse_statement().map_err(|x| { - let s = x.to_string(); - println!("bruh {}", s); - s - })?; + let parsed = tokens.parse_statement().map_err(|x| x.to_string())?; not_fully_consumed(&mut tokens)?; Ok(serde_yaml::to_value(&parsed).expect("serialization failed")) diff --git a/tests/compiler/function/duplicate_definition_fail.leo b/tests/compiler/function/duplicate_definition_fail.leo index 2909fae2b1..43ec30e787 100644 --- a/tests/compiler/function/duplicate_definition_fail.leo +++ b/tests/compiler/function/duplicate_definition_fail.leo @@ -1,15 +1,14 @@ /* namespace: Compile expectation: Fail -input_file: input/integers.in +input_file: input/dummy.in */ -function main(a: u32) -> u32 { +function main() { console.log("{}", 1u8); - return 10u32; } function main() { - console.log("{}", 2u8); + console.log("{}", 2u8); } diff --git a/tests/expectations/compiler/compiler/function/duplicate_definition_fail.leo.out b/tests/expectations/compiler/compiler/function/duplicate_definition_fail.leo.out index aaffccc60a..f76592d7fd 100644 --- a/tests/expectations/compiler/compiler/function/duplicate_definition_fail.leo.out +++ b/tests/expectations/compiler/compiler/function/duplicate_definition_fail.leo.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "- Circuit has no constraints, use inputs and registers in program to produce them" + - " --> compiler-test:8:1\n |\n 8 | function main() {\n|\n 9 | ...\n|\n 10 | }\n | ^\n |\n = a function named \"main\" already exists in this scope"