summaryrefslogtreecommitdiffstats
path: root/tests/util.rs
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2020-02-15 09:12:21 -0500
committerAndrew Gallant <jamslam@gmail.com>2020-02-17 17:16:28 -0500
commit88f46d12f1f3f7c2eac925ecb0b1c816ffddb943 (patch)
tree75157577eb45480775d7c77d8622c64e20eb7565 /tests/util.rs
parenta18cf6ec39cd1d8fc7b4061858bb9263b6e5e073 (diff)
tests: remove existing test directory
I'm surprised this wasn't caught until now, but if a test directory already exists, then it was reused. This can result in hard to debug problems with tests when, e.g., file names are changed and a recursive search is executed.
Diffstat (limited to 'tests/util.rs')
-rw-r--r--tests/util.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/util.rs b/tests/util.rs
index a0150824..b529ca55 100644
--- a/tests/util.rs
+++ b/tests/util.rs
@@ -76,6 +76,9 @@ impl Dir {
.join(TEST_DIR)
.join(name)
.join(&format!("{}", id));
+ if dir.exists() {
+ nice_err(&dir, fs::remove_dir_all(&dir));
+ }
nice_err(&dir, repeat(|| fs::create_dir_all(&dir)));
Dir {
root: root,