diff options
| author | Mo <76752051+mo8it@users.noreply.github.com> | 2024-08-08 23:48:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-08 23:48:09 +0200 |
| commit | 9f9a754a646f3af686531526168ece9c365286c2 (patch) | |
| tree | 830028984bfb721496e189f9239c883a09b668a1 /tests/integration_tests.rs | |
| parent | f7b0cfe8d145c26449ab7f09743d890bd9e437ea (diff) | |
| parent | 8b43d7925761edcd6ca8bacf382e82a05aa5c0e7 (diff) | |
Merge pull request #2076 from senekor/remo/snryotxotoxv
Improve initialization in workspace
Diffstat (limited to 'tests/integration_tests.rs')
| -rw-r--r-- | tests/integration_tests.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 3ab54f9..d821e20 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -155,28 +155,28 @@ fn hint() { #[test] fn init() { - let _ = fs::remove_dir_all("tests/rustlings"); + let test_dir = tempfile::TempDir::new().unwrap(); + let initialized_dir = test_dir.path().join("rustlings"); + let test_dir = test_dir.path().to_str().unwrap(); - Cmd::default().current_dir("tests").fail(); + Cmd::default().current_dir(test_dir).fail(); Cmd::default() - .current_dir("tests") + .current_dir(test_dir) .args(&["init"]) .success(); // Running `init` after a successful initialization. Cmd::default() - .current_dir("tests") + .current_dir(test_dir) .args(&["init"]) .output(PartialStderr("`cd rustlings`")) .fail(); // Running `init` in the initialized directory. Cmd::default() - .current_dir("tests/rustlings") + .current_dir(initialized_dir.to_str().unwrap()) .args(&["init"]) .output(PartialStderr("already initialized")) .fail(); - - fs::remove_dir_all("tests/rustlings").unwrap(); } |
