diff options
| -rw-r--r-- | src/lib/cli_interactor.rs | 14 | ||||
| -rw-r--r-- | test_utils/src/lib.rs | 2 | ||||
| -rw-r--r-- | tests/ngit_list.rs | 32 |
3 files changed, 28 insertions, 20 deletions
diff --git a/src/lib/cli_interactor.rs b/src/lib/cli_interactor.rs index 2ceb088..50a0f0c 100644 --- a/src/lib/cli_interactor.rs +++ b/src/lib/cli_interactor.rs | |||
| @@ -178,7 +178,6 @@ impl Default for PromptChoiceParms { | |||
| 178 | impl PromptChoiceParms { | 178 | impl PromptChoiceParms { |
| 179 | pub fn with_prompt<S: Into<String>>(mut self, prompt: S) -> Self { | 179 | pub fn with_prompt<S: Into<String>>(mut self, prompt: S) -> Self { |
| 180 | self.prompt = prompt.into(); | 180 | self.prompt = prompt.into(); |
| 181 | self.report = true; | ||
| 182 | self | 181 | self |
| 183 | } | 182 | } |
| 184 | 183 | ||
| @@ -198,7 +197,6 @@ impl PromptChoiceParms { | |||
| 198 | } | 197 | } |
| 199 | } | 198 | } |
| 200 | 199 | ||
| 201 | #[derive(Default)] | ||
| 202 | pub struct PromptMultiChoiceParms { | 200 | pub struct PromptMultiChoiceParms { |
| 203 | pub prompt: String, | 201 | pub prompt: String, |
| 204 | pub choices: Vec<String>, | 202 | pub choices: Vec<String>, |
| @@ -206,10 +204,20 @@ pub struct PromptMultiChoiceParms { | |||
| 206 | pub report: bool, | 204 | pub report: bool, |
| 207 | } | 205 | } |
| 208 | 206 | ||
| 207 | impl Default for PromptMultiChoiceParms { | ||
| 208 | fn default() -> Self { | ||
| 209 | Self { | ||
| 210 | prompt: String::new(), | ||
| 211 | choices: vec![], | ||
| 212 | defaults: None, | ||
| 213 | report: true, | ||
| 214 | } | ||
| 215 | } | ||
| 216 | } | ||
| 217 | |||
| 209 | impl PromptMultiChoiceParms { | 218 | impl PromptMultiChoiceParms { |
| 210 | pub fn with_prompt<S: Into<String>>(mut self, prompt: S) -> Self { | 219 | pub fn with_prompt<S: Into<String>>(mut self, prompt: S) -> Self { |
| 211 | self.prompt = prompt.into(); | 220 | self.prompt = prompt.into(); |
| 212 | self.report = true; | ||
| 213 | self | 221 | self |
| 214 | } | 222 | } |
| 215 | 223 | ||
diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs index cfbc381..ec05cfd 100644 --- a/test_utils/src/lib.rs +++ b/test_utils/src/lib.rs | |||
| @@ -1298,7 +1298,7 @@ pub fn use_ngit_list_to_download_and_checkout_proposal_branch( | |||
| 1298 | format!("back"), | 1298 | format!("back"), |
| 1299 | ], | 1299 | ], |
| 1300 | )?; | 1300 | )?; |
| 1301 | c.succeeds_with(0, false, Some(0))?; | 1301 | c.succeeds_with(0, true, Some(0))?; |
| 1302 | p.expect_end_eventually()?; | 1302 | p.expect_end_eventually()?; |
| 1303 | Ok(()) | 1303 | Ok(()) |
| 1304 | } | 1304 | } |
diff --git a/tests/ngit_list.rs b/tests/ngit_list.rs index 6382451..a6b1374 100644 --- a/tests/ngit_list.rs +++ b/tests/ngit_list.rs | |||
| @@ -195,7 +195,7 @@ mod when_main_branch_is_uptodate { | |||
| 195 | format!("back"), | 195 | format!("back"), |
| 196 | ], | 196 | ], |
| 197 | )?; | 197 | )?; |
| 198 | c.succeeds_with(0, false, None)?; | 198 | c.succeeds_with(0, true, None)?; |
| 199 | p.expect(format!( | 199 | p.expect(format!( |
| 200 | "checked out proposal as 'pr/{}(", | 200 | "checked out proposal as 'pr/{}(", |
| 201 | FEATURE_BRANCH_NAME_1, | 201 | FEATURE_BRANCH_NAME_1, |
| @@ -317,7 +317,7 @@ mod when_main_branch_is_uptodate { | |||
| 317 | format!("back"), | 317 | format!("back"), |
| 318 | ], | 318 | ], |
| 319 | )?; | 319 | )?; |
| 320 | c.succeeds_with(0, false, Some(0))?; | 320 | c.succeeds_with(0, true, Some(0))?; |
| 321 | p.expect(format!( | 321 | p.expect(format!( |
| 322 | "checked out proposal as 'pr/{}(", | 322 | "checked out proposal as 'pr/{}(", |
| 323 | FEATURE_BRANCH_NAME_3, | 323 | FEATURE_BRANCH_NAME_3, |
| @@ -443,7 +443,7 @@ mod when_main_branch_is_uptodate { | |||
| 443 | format!("back"), | 443 | format!("back"), |
| 444 | ], | 444 | ], |
| 445 | )?; | 445 | )?; |
| 446 | c.succeeds_with(0, false, Some(0))?; | 446 | c.succeeds_with(0, true, Some(0))?; |
| 447 | p.expect_end_eventually_and_print()?; | 447 | p.expect_end_eventually_and_print()?; |
| 448 | 448 | ||
| 449 | for p in [51, 52, 53, 55, 56] { | 449 | for p in [51, 52, 53, 55, 56] { |
| @@ -524,7 +524,7 @@ mod when_main_branch_is_uptodate { | |||
| 524 | format!("back"), | 524 | format!("back"), |
| 525 | ], | 525 | ], |
| 526 | )?; | 526 | )?; |
| 527 | c.succeeds_with(0, false, Some(0))?; | 527 | c.succeeds_with(0, true, Some(0))?; |
| 528 | p.expect(format!( | 528 | p.expect(format!( |
| 529 | "checked out proposal as 'pr/{}(", | 529 | "checked out proposal as 'pr/{}(", |
| 530 | FEATURE_BRANCH_NAME_4, | 530 | FEATURE_BRANCH_NAME_4, |
| @@ -647,7 +647,7 @@ mod when_main_branch_is_uptodate { | |||
| 647 | format!("back"), | 647 | format!("back"), |
| 648 | ], | 648 | ], |
| 649 | )?; | 649 | )?; |
| 650 | c.succeeds_with(0, false, Some(0))?; | 650 | c.succeeds_with(0, true, Some(0))?; |
| 651 | p.expect_end_eventually()?; | 651 | p.expect_end_eventually()?; |
| 652 | 652 | ||
| 653 | test_repo.checkout("main")?; | 653 | test_repo.checkout("main")?; |
| @@ -673,7 +673,7 @@ mod when_main_branch_is_uptodate { | |||
| 673 | format!("back"), | 673 | format!("back"), |
| 674 | ], | 674 | ], |
| 675 | )?; | 675 | )?; |
| 676 | c.succeeds_with(0, false, Some(0))?; | 676 | c.succeeds_with(0, true, Some(0))?; |
| 677 | p.expect_end_eventually_and_print()?; | 677 | p.expect_end_eventually_and_print()?; |
| 678 | 678 | ||
| 679 | for p in [51, 52, 53, 55, 56] { | 679 | for p in [51, 52, 53, 55, 56] { |
| @@ -745,7 +745,7 @@ mod when_main_branch_is_uptodate { | |||
| 745 | format!("back"), | 745 | format!("back"), |
| 746 | ], | 746 | ], |
| 747 | )?; | 747 | )?; |
| 748 | c.succeeds_with(0, false, Some(0))?; | 748 | c.succeeds_with(0, true, Some(0))?; |
| 749 | p.expect_end_eventually()?; | 749 | p.expect_end_eventually()?; |
| 750 | 750 | ||
| 751 | test_repo.checkout("main")?; | 751 | test_repo.checkout("main")?; |
| @@ -771,7 +771,7 @@ mod when_main_branch_is_uptodate { | |||
| 771 | format!("back"), | 771 | format!("back"), |
| 772 | ], | 772 | ], |
| 773 | )?; | 773 | )?; |
| 774 | c.succeeds_with(0, false, Some(0))?; | 774 | c.succeeds_with(0, true, Some(0))?; |
| 775 | p.expect(format!( | 775 | p.expect(format!( |
| 776 | "checked out proposal as 'pr/{}(", | 776 | "checked out proposal as 'pr/{}(", |
| 777 | FEATURE_BRANCH_NAME_1, | 777 | FEATURE_BRANCH_NAME_1, |
| @@ -862,7 +862,7 @@ mod when_main_branch_is_uptodate { | |||
| 862 | format!("back"), | 862 | format!("back"), |
| 863 | ], | 863 | ], |
| 864 | )?; | 864 | )?; |
| 865 | c.succeeds_with(0, false, Some(0))?; | 865 | c.succeeds_with(0, true, Some(0))?; |
| 866 | p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?; | 866 | p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?; |
| 867 | p.expect_end()?; | 867 | p.expect_end()?; |
| 868 | 868 | ||
| @@ -938,7 +938,7 @@ mod when_main_branch_is_uptodate { | |||
| 938 | format!("back"), | 938 | format!("back"), |
| 939 | ], | 939 | ], |
| 940 | )?; | 940 | )?; |
| 941 | c.succeeds_with(0, false, Some(0))?; | 941 | c.succeeds_with(0, true, Some(0))?; |
| 942 | p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?; | 942 | p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?; |
| 943 | p.expect_end()?; | 943 | p.expect_end()?; |
| 944 | 944 | ||
| @@ -1056,7 +1056,7 @@ mod when_main_branch_is_uptodate { | |||
| 1056 | "back".to_string(), | 1056 | "back".to_string(), |
| 1057 | ], | 1057 | ], |
| 1058 | )?; | 1058 | )?; |
| 1059 | c.succeeds_with(1, false, Some(0))?; | 1059 | c.succeeds_with(1, true, Some(0))?; |
| 1060 | 1060 | ||
| 1061 | p.expect_end_eventually_and_print()?; | 1061 | p.expect_end_eventually_and_print()?; |
| 1062 | 1062 | ||
| @@ -1140,7 +1140,7 @@ mod when_main_branch_is_uptodate { | |||
| 1140 | "back".to_string(), | 1140 | "back".to_string(), |
| 1141 | ], | 1141 | ], |
| 1142 | )?; | 1142 | )?; |
| 1143 | c.succeeds_with(1, false, Some(1))?; | 1143 | c.succeeds_with(1, true, Some(1))?; |
| 1144 | p.expect_end_with("checked out latest version of proposal (2 ahead 0 behind 'main'), replacing unpublished version (2 ahead 0 behind 'main')\r\n")?; | 1144 | p.expect_end_with("checked out latest version of proposal (2 ahead 0 behind 'main'), replacing unpublished version (2 ahead 0 behind 'main')\r\n")?; |
| 1145 | 1145 | ||
| 1146 | for p in [51, 52, 53, 55, 56] { | 1146 | for p in [51, 52, 53, 55, 56] { |
| @@ -1237,7 +1237,7 @@ mod when_main_branch_is_uptodate { | |||
| 1237 | format!("back"), | 1237 | format!("back"), |
| 1238 | ], | 1238 | ], |
| 1239 | )?; | 1239 | )?; |
| 1240 | c.succeeds_with(0, false, Some(0))?; | 1240 | c.succeeds_with(0, true, Some(0))?; |
| 1241 | p.expect("checked out proposal branch with 1 unpublished commits (3 ahead 0 behind 'main')\r\n")?; | 1241 | p.expect("checked out proposal branch with 1 unpublished commits (3 ahead 0 behind 'main')\r\n")?; |
| 1242 | p.expect_end()?; | 1242 | p.expect_end()?; |
| 1243 | 1243 | ||
| @@ -1319,7 +1319,7 @@ mod when_main_branch_is_uptodate { | |||
| 1319 | format!("back"), | 1319 | format!("back"), |
| 1320 | ], | 1320 | ], |
| 1321 | )?; | 1321 | )?; |
| 1322 | c.succeeds_with(0, false, Some(0))?; | 1322 | c.succeeds_with(0, true, Some(0))?; |
| 1323 | p.expect("checked out proposal branch with 1 unpublished commits (3 ahead 0 behind 'main')\r\n")?; | 1323 | p.expect("checked out proposal branch with 1 unpublished commits (3 ahead 0 behind 'main')\r\n")?; |
| 1324 | p.expect_end()?; | 1324 | p.expect_end()?; |
| 1325 | 1325 | ||
| @@ -1421,7 +1421,7 @@ mod when_main_branch_is_uptodate { | |||
| 1421 | format!("back"), | 1421 | format!("back"), |
| 1422 | ], | 1422 | ], |
| 1423 | )?; | 1423 | )?; |
| 1424 | c.succeeds_with(0, false, Some(0))?; | 1424 | c.succeeds_with(0, true, Some(0))?; |
| 1425 | p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?; | 1425 | p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?; |
| 1426 | p.expect_end()?; | 1426 | p.expect_end()?; |
| 1427 | 1427 | ||
| @@ -1494,7 +1494,7 @@ mod when_main_branch_is_uptodate { | |||
| 1494 | format!("back"), | 1494 | format!("back"), |
| 1495 | ], | 1495 | ], |
| 1496 | )?; | 1496 | )?; |
| 1497 | c.succeeds_with(0, false, Some(0))?; | 1497 | c.succeeds_with(0, true, Some(0))?; |
| 1498 | p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?; | 1498 | p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?; |
| 1499 | p.expect_end()?; | 1499 | p.expect_end()?; |
| 1500 | 1500 | ||