Ensure test file is cleaned up in cwd_is_writable test case
This commit is contained in:
@@ -9,8 +9,18 @@ fn sandbox(extra_args: &[&str]) -> Command {
|
||||
cmd
|
||||
}
|
||||
|
||||
struct CleanupFile(&'static str);
|
||||
|
||||
impl Drop for CleanupFile {
|
||||
fn drop(&mut self) {
|
||||
let _ = fs::remove_file(self.0);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cwd_is_writable() {
|
||||
let _cleanup = CleanupFile("./sandbox_canary");
|
||||
|
||||
let output = sandbox(&[])
|
||||
.args(["--", "bash", "-c", "touch ./sandbox_canary && echo ok"])
|
||||
.output()
|
||||
|
||||
Reference in New Issue
Block a user