Skip to content

Commit

Permalink
harden test
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Nov 28, 2024
1 parent 19bf77f commit c424c9c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions crates/tests/bindgen/tests/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,22 @@ fn subset_namespace() {
#[test]
#[should_panic(expected = "failed to create directory")]
fn failed_to_create_directory() {
bindgen(&format!(
"--out {}\\invalid\\out.txt --in default --filter POINT",
env!("windir")
));
let test_path = format!(
"{}\\failed_to_create_directory",
env!("CARGO_TARGET_TMPDIR")
);

std::fs::write(&test_path, "test").unwrap();
let test_path = format!("{}\\out.txt", test_path);

bindgen(&format!("--out {test_path} --in default --filter POINT",));
}

#[test]
#[should_panic(expected = "failed to write file")]
fn failed_to_write_file() {
bindgen(&format!(
"--out {}\\out.txt --in default --filter POINT",
env!("windir")
));
let test_path = format!("{}\\failed_to_write_file", env!("CARGO_TARGET_TMPDIR"));
std::fs::create_dir_all(&test_path).unwrap();

bindgen(&format!("--out {test_path} --in default --filter POINT",));
}

0 comments on commit c424c9c

Please sign in to comment.