diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-11-26 07:48:30 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-11-26 12:26:47 +0000 |
| commit | a0593e3aa9b19b9ca3c3881cbe0d9d207fe46d2c (patch) | |
| tree | 3482e7c558eff09cc91604ad6ddcd02cf2c94699 /tests | |
| parent | 1332c625b75fce616e06b415c99a068bc45c8210 (diff) | |
refactor: err msgs 'cannot' > 'failed to'
in nearly all cases 'cannot' was used when an action was tried and
failed. 'failed to' is strictly better because:
* just because the action didn't work that time doesnt mean it
cannot work
* it is better at drawing the users attention to a problem
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/git_remote_nostr/main.rs | 2 | ||||
| -rw-r--r-- | tests/ngit_init.rs | 2 | ||||
| -rw-r--r-- | tests/ngit_login.rs | 8 | ||||
| -rw-r--r-- | tests/ngit_pull.rs | 4 | ||||
| -rw-r--r-- | tests/ngit_push.rs | 2 |
5 files changed, 10 insertions, 8 deletions
diff --git a/tests/git_remote_nostr/main.rs b/tests/git_remote_nostr/main.rs index f749c7f..84e66bd 100644 --- a/tests/git_remote_nostr/main.rs +++ b/tests/git_remote_nostr/main.rs | |||
| @@ -43,7 +43,7 @@ fn set_git_nostr_login_config(test_repo: &GitTestRepo) -> Result<()> { | |||
| 43 | let mut config = test_repo | 43 | let mut config = test_repo |
| 44 | .git_repo | 44 | .git_repo |
| 45 | .config() | 45 | .config() |
| 46 | .context("cannot open git config")?; | 46 | .context("failed to open git config")?; |
| 47 | config.set_str("nostr.nsec", TEST_KEY_2_NSEC)?; | 47 | config.set_str("nostr.nsec", TEST_KEY_2_NSEC)?; |
| 48 | config.set_str("nostr.npub", TEST_KEY_2_NPUB)?; | 48 | config.set_str("nostr.npub", TEST_KEY_2_NPUB)?; |
| 49 | config.set_str("user.name", "test name")?; | 49 | config.set_str("user.name", "test name")?; |
diff --git a/tests/ngit_init.rs b/tests/ngit_init.rs index 1183b3c..4302524 100644 --- a/tests/ngit_init.rs +++ b/tests/ngit_init.rs | |||
| @@ -309,7 +309,7 @@ mod when_repo_not_previously_claimed { | |||
| 309 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 309 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 310 | let yaml_path = git_repo.dir.join("maintainers.yaml"); | 310 | let yaml_path = git_repo.dir.join("maintainers.yaml"); |
| 311 | let mut file = std::fs::File::create(&yaml_path) | 311 | let mut file = std::fs::File::create(&yaml_path) |
| 312 | .expect("cannot create maintainers.yaml file"); | 312 | .expect("failed to create maintainers.yaml file"); |
| 313 | write!( | 313 | write!( |
| 314 | file, | 314 | file, |
| 315 | "\ | 315 | "\ |
diff --git a/tests/ngit_login.rs b/tests/ngit_login.rs index c928cc4..4cfe4e6 100644 --- a/tests/ngit_login.rs +++ b/tests/ngit_login.rs | |||
| @@ -128,7 +128,7 @@ mod with_relays { | |||
| 128 | 128 | ||
| 129 | p.expect("searching for profile...\r\n")?; | 129 | p.expect("searching for profile...\r\n")?; |
| 130 | 130 | ||
| 131 | p.expect("cannot extract account name from account metadata...\r\n")?; | 131 | p.expect("failed to extract account name from account metadata...\r\n")?; |
| 132 | 132 | ||
| 133 | p.expect_end_with( | 133 | p.expect_end_with( |
| 134 | format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str(), | 134 | format!("logged in as {}\r\n", TEST_KEY_1_NPUB).as_str(), |
| @@ -618,7 +618,7 @@ mod with_relays { | |||
| 618 | 618 | ||
| 619 | p.expect("searching for profile...\r\n")?; | 619 | p.expect("searching for profile...\r\n")?; |
| 620 | 620 | ||
| 621 | p.expect("cannot find profile...\r\n")?; | 621 | p.expect("failed to find profile...\r\n")?; |
| 622 | 622 | ||
| 623 | p.expect_end_with(format!("logged in as {TEST_KEY_1_NPUB}\r\n").as_str())?; | 623 | p.expect_end_with(format!("logged in as {TEST_KEY_1_NPUB}\r\n").as_str())?; |
| 624 | for p in [51, 52] { | 624 | for p in [51, 52] { |
| @@ -682,7 +682,7 @@ mod with_relays { | |||
| 682 | 682 | ||
| 683 | p.expect("searching for profile...\r\n")?; | 683 | p.expect("searching for profile...\r\n")?; |
| 684 | 684 | ||
| 685 | p.expect("cannot find your relay list. consider using another nostr client to create one to enhance your nostr experience.\r\n")?; | 685 | p.expect("failed to find your relay list. consider using another nostr client to create one to enhance your nostr experience.\r\n")?; |
| 686 | 686 | ||
| 687 | p.expect_end_with("logged in as fred\r\n")?; | 687 | p.expect_end_with("logged in as fred\r\n")?; |
| 688 | for p in [51, 52] { | 688 | for p in [51, 52] { |
| @@ -932,7 +932,7 @@ mod with_offline_flag { | |||
| 932 | p.expect_input(EXPECTED_NSEC_PROMPT)? | 932 | p.expect_input(EXPECTED_NSEC_PROMPT)? |
| 933 | // this behaviour is intentional. rejecting the response with dialoguer | 933 | // this behaviour is intentional. rejecting the response with dialoguer |
| 934 | // hides the original input from the user so they | 934 | // hides the original input from the user so they |
| 935 | // cannot see the mistake they made. | 935 | // failed to see the mistake they made. |
| 936 | .succeeds_with(TEST_INVALID_NSEC)?; | 936 | .succeeds_with(TEST_INVALID_NSEC)?; |
| 937 | 937 | ||
| 938 | p.expect_input(invalid_nsec_response)? | 938 | p.expect_input(invalid_nsec_response)? |
diff --git a/tests/ngit_pull.rs b/tests/ngit_pull.rs index 6637859..2fb9229 100644 --- a/tests/ngit_pull.rs +++ b/tests/ngit_pull.rs | |||
| @@ -96,7 +96,9 @@ mod when_branch_doesnt_exist { | |||
| 96 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["pull"]); | 96 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["pull"]); |
| 97 | p.expect("fetching updates...\r\n")?; | 97 | p.expect("fetching updates...\r\n")?; |
| 98 | p.expect_eventually("\r\n")?; // some updates listed here | 98 | p.expect_eventually("\r\n")?; // some updates listed here |
| 99 | p.expect("Error: cannot find proposal that matches the current branch name\r\n")?; | 99 | p.expect( |
| 100 | "Error: failed to find proposal that matches the current branch name\r\n", | ||
| 101 | )?; | ||
| 100 | 102 | ||
| 101 | p.expect_end()?; | 103 | p.expect_end()?; |
| 102 | 104 | ||
diff --git a/tests/ngit_push.rs b/tests/ngit_push.rs index f37e027..d4b3894 100644 --- a/tests/ngit_push.rs +++ b/tests/ngit_push.rs | |||
| @@ -58,7 +58,7 @@ mod when_proposal_isnt_associated_with_branch_name { | |||
| 58 | p.expect("fetching updates...\r\n")?; | 58 | p.expect("fetching updates...\r\n")?; |
| 59 | p.expect_eventually("\r\n")?; // some updates listed here | 59 | p.expect_eventually("\r\n")?; // some updates listed here |
| 60 | p.expect_end_with( | 60 | p.expect_end_with( |
| 61 | "Error: cannot find proposal that matches the current branch name\r\n", | 61 | "Error: failed to find proposal that matches the current branch name\r\n", |
| 62 | )?; | 62 | )?; |
| 63 | for p in [51, 52, 53, 55, 56] { | 63 | for p in [51, 52, 53, 55, 56] { |
| 64 | relay::shutdown_relay(8000 + p)?; | 64 | relay::shutdown_relay(8000 + p)?; |