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
|
cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct CleanupFile(&'static str);
|
||||||
|
|
||||||
|
impl Drop for CleanupFile {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
let _ = fs::remove_file(self.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn cwd_is_writable() {
|
fn cwd_is_writable() {
|
||||||
|
let _cleanup = CleanupFile("./sandbox_canary");
|
||||||
|
|
||||||
let output = sandbox(&[])
|
let output = sandbox(&[])
|
||||||
.args(["--", "bash", "-c", "touch ./sandbox_canary && echo ok"])
|
.args(["--", "bash", "-c", "touch ./sandbox_canary && echo ok"])
|
||||||
.output()
|
.output()
|
||||||
|
|||||||
Reference in New Issue
Block a user