Skip to content

Commit

Permalink
Cleanup after compiler error checks (#764)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfellis committed Jun 11, 2024
1 parent 05687f5 commit 3c769e2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ macro_rules! test_compile_error {
fn $rule() -> Result<(), Box<dyn std::error::Error>> {
let filename = format!("{}.ln", stringify!($rule));
super::write(&filename, $code)?;
match super::compile(filename.to_string()) {
let res = super::compile(filename.to_string());
std::fs::remove_file(&filename)?;
match res {
Ok(_) => Err("Unexpectedly succeeded!".into()),
Err(e) => Ok(assert_eq!(format!("{}", e), $test_val)),
}
Expand All @@ -357,7 +359,9 @@ macro_rules! test_compile_error {
fn $rule() -> Result<(), Box<dyn std::error::Error>> {
let filename = format!("{}.ln", stringify!($rule));
super::write(&filename, $code)?;
match super::compile(filename.to_string()) {
let res = super::compile(filename.to_string());
std::fs::remove_file(&filename)?;
match res {
Ok(_) => Err("Unexpectedly succeeded!".into()),
Err(_) => Ok(()),
}
Expand Down

0 comments on commit 3c769e2

Please sign in to comment.