diff options
Diffstat (limited to 'tests/cli.rs')
-rw-r--r-- | tests/cli.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/cli.rs b/tests/cli.rs index 34249c2..633c7bd 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -284,6 +284,11 @@ fn can_delete_a_repo() -> Result<()> { verify_repo_exists(&repo_dir); c.p.send_line(&format!("delete \"{repo_path}\""))?; + c.p.exp_string(&format!( + "Are you sure you want to delete \"{repo_path}\"? (yes/no)" + ))?; + + c.p.send_line("yes")?; c.p.exp_string(&format!("Successfully deleted \"{repo_path}\""))?; verify_repo_does_not_exist(&repo_dir); @@ -291,6 +296,28 @@ fn can_delete_a_repo() -> Result<()> { } #[test] +fn repo_is_not_deleted_if_you_say_youre_not_sure() -> Result<()> { + let mut c = TestContext::new_interactive()?; + let repo_path = personal_repo_path(REPO_NAME); + let repo_dir = c.personal_repo_dir(REPO_NAME); + + c.p.send_line(&format!("init {}", REPO_NAME))?; + c.expect_successful_init_message(&repo_path)?; + verify_repo_exists(&repo_dir); + + c.p.send_line(&format!("delete \"{repo_path}\""))?; + c.p.exp_string(&format!( + "Are you sure you want to delete \"{repo_path}\"? (yes/no)" + ))?; + + c.p.send_line("no")?; + c.p.exp_string(&format!("Action cancelled"))?; + verify_repo_exists(&repo_dir); + + Ok(()) +} + +#[test] fn git_housekeeping_repacks_objects() -> Result<()> { let mut c = TestContext::new_interactive()?; let repo_path = personal_repo_path(REPO_NAME); |