upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests/ngit_list.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-12-16 09:00:46 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2024-12-16 09:46:30 +0000
commit4ee83e2fe5335a8afd78439c35f029c4a472e797 (patch)
treebdb111b191e7a68cb74ce29b4bb2757b4b7be91f /tests/ngit_list.rs
parent5fe839e2bf8ceb2931c1984efb2d956980431203 (diff)
chore: bump nix flake rust nightly `fmt` overlay
update the rust nightly `fmt` overlay which needs to be pinned to a specific version (this case by date) update formatting in main files via `cargo fmt`
Diffstat (limited to 'tests/ngit_list.rs')
-rw-r--r--tests/ngit_list.rs488
1 files changed, 197 insertions, 291 deletions
diff --git a/tests/ngit_list.rs b/tests/ngit_list.rs
index 1d297b6..4a3aad5 100644
--- a/tests/ngit_list.rs
+++ b/tests/ngit_list.rs
@@ -49,7 +49,7 @@ async fn prep_proposals_repo_and_repo_with_proposal_pulled_and_checkedout(
49mod cannot_find_repo_event { 49mod cannot_find_repo_event {
50 use super::*; 50 use super::*;
51 mod cli_prompts { 51 mod cli_prompts {
52 use nostr::{nips::nip01::Coordinate, ToBech32}; 52 use nostr::{ToBech32, nips::nip01::Coordinate};
53 use nostr_sdk::RelayUrl; 53 use nostr_sdk::RelayUrl;
54 54
55 use super::*; 55 use super::*;
@@ -196,25 +196,20 @@ mod when_main_branch_is_uptodate {
196 196
197 p.expect("fetching updates...\r\n")?; 197 p.expect("fetching updates...\r\n")?;
198 p.expect_eventually("\r\n")?; // some updates listed here 198 p.expect_eventually("\r\n")?; // some updates listed here
199 let mut c = p.expect_choice( 199 let mut c = p.expect_choice("all proposals", vec![
200 "all proposals", 200 format!("\"{PROPOSAL_TITLE_3}\""),
201 vec![ 201 format!("\"{PROPOSAL_TITLE_2}\""),
202 format!("\"{PROPOSAL_TITLE_3}\""), 202 format!("\"{PROPOSAL_TITLE_1}\""),
203 format!("\"{PROPOSAL_TITLE_2}\""), 203 ])?;
204 format!("\"{PROPOSAL_TITLE_1}\""),
205 ],
206 )?;
207 c.succeeds_with(2, true, None)?; 204 c.succeeds_with(2, true, None)?;
208 let mut c = p.expect_choice( 205 let mut c = p.expect_choice("", vec![
209 "", 206 format!(
210 vec![ 207 "create and checkout proposal branch (2 ahead 0 behind 'main')"
211 format!( 208 ),
212 "create and checkout proposal branch (2 ahead 0 behind 'main')" ), 209 format!("apply to current branch with `git am`"),
213 format!("apply to current branch with `git am`"), 210 format!("download to ./patches"),
214 format!("download to ./patches"), 211 format!("back"),
215 format!("back"), 212 ])?;
216 ],
217 )?;
218 c.succeeds_with(0, true, None)?; 213 c.succeeds_with(0, true, None)?;
219 p.expect(format!( 214 p.expect(format!(
220 "checked out proposal as 'pr/{}(", 215 "checked out proposal as 'pr/{}(",
@@ -318,25 +313,20 @@ mod when_main_branch_is_uptodate {
318 313
319 p.expect("fetching updates...\r\n")?; 314 p.expect("fetching updates...\r\n")?;
320 p.expect_eventually("\r\n")?; // some updates listed here 315 p.expect_eventually("\r\n")?; // some updates listed here
321 let mut c = p.expect_choice( 316 let mut c = p.expect_choice("all proposals", vec![
322 "all proposals", 317 format!("\"{PROPOSAL_TITLE_3}\""),
323 vec![ 318 format!("\"{PROPOSAL_TITLE_2}\""),
324 format!("\"{PROPOSAL_TITLE_3}\""), 319 format!("\"{PROPOSAL_TITLE_1}\""),
325 format!("\"{PROPOSAL_TITLE_2}\""), 320 ])?;
326 format!("\"{PROPOSAL_TITLE_1}\""),
327 ],
328 )?;
329 c.succeeds_with(0, true, None)?; 321 c.succeeds_with(0, true, None)?;
330 let mut c = p.expect_choice( 322 let mut c = p.expect_choice("", vec![
331 "", 323 format!(
332 vec![ 324 "create and checkout proposal branch (2 ahead 0 behind 'main')"
333 format!( 325 ),
334 "create and checkout proposal branch (2 ahead 0 behind 'main')" ), 326 format!("apply to current branch with `git am`"),
335 format!("apply to current branch with `git am`"), 327 format!("download to ./patches"),
336 format!("download to ./patches"), 328 format!("back"),
337 format!("back"), 329 ])?;
338 ],
339 )?;
340 c.succeeds_with(0, true, Some(0))?; 330 c.succeeds_with(0, true, Some(0))?;
341 p.expect(format!( 331 p.expect(format!(
342 "checked out proposal as 'pr/{}(", 332 "checked out proposal as 'pr/{}(",
@@ -427,8 +417,8 @@ mod when_main_branch_is_uptodate {
427 r55.events.push(generate_test_key_1_metadata_event("fred")); 417 r55.events.push(generate_test_key_1_metadata_event("fred"));
428 r55.events.push(generate_test_key_1_relay_list_event()); 418 r55.events.push(generate_test_key_1_relay_list_event());
429 419
430 let cli_tester_handle = std::thread::spawn( 420 let cli_tester_handle =
431 move || -> Result<(GitTestRepo, GitTestRepo)> { 421 std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> {
432 let originating_repo = cli_tester_create_proposals()?; 422 let originating_repo = cli_tester_create_proposals()?;
433 cli_tester_create_proposal( 423 cli_tester_create_proposal(
434 &originating_repo, 424 &originating_repo,
@@ -443,26 +433,21 @@ mod when_main_branch_is_uptodate {
443 433
444 p.expect("fetching updates...\r\n")?; 434 p.expect("fetching updates...\r\n")?;
445 p.expect_eventually("\r\n")?; // some updates listed here 435 p.expect_eventually("\r\n")?; // some updates listed here
446 let mut c = p.expect_choice( 436 let mut c = p.expect_choice("all proposals", vec![
447 "all proposals", 437 format!("add d3.md"), // commit msg title
448 vec![ 438 format!("\"{PROPOSAL_TITLE_3}\""),
449 format!("add d3.md"), // commit msg title 439 format!("\"{PROPOSAL_TITLE_2}\""),
450 format!("\"{PROPOSAL_TITLE_3}\""), 440 format!("\"{PROPOSAL_TITLE_1}\""),
451 format!("\"{PROPOSAL_TITLE_2}\""), 441 ])?;
452 format!("\"{PROPOSAL_TITLE_1}\""),
453 ],
454 )?;
455 c.succeeds_with(0, true, None)?; 442 c.succeeds_with(0, true, None)?;
456 let mut c = p.expect_choice( 443 let mut c = p.expect_choice("", vec![
457 "", 444 format!(
458 vec![ 445 "create and checkout proposal branch (2 ahead 0 behind 'main')"
459 format!( 446 ),
460 "create and checkout proposal branch (2 ahead 0 behind 'main')" ), 447 format!("apply to current branch with `git am`"),
461 format!("apply to current branch with `git am`"), 448 format!("download to ./patches"),
462 format!("download to ./patches"), 449 format!("back"),
463 format!("back"), 450 ])?;
464 ],
465 )?;
466 c.succeeds_with(0, true, Some(0))?; 451 c.succeeds_with(0, true, Some(0))?;
467 p.expect_end_eventually_and_print()?; 452 p.expect_end_eventually_and_print()?;
468 453
@@ -470,8 +455,7 @@ mod when_main_branch_is_uptodate {
470 relay::shutdown_relay(8000 + p)?; 455 relay::shutdown_relay(8000 + p)?;
471 } 456 }
472 Ok((originating_repo, test_repo)) 457 Ok((originating_repo, test_repo))
473 }, 458 });
474 );
475 459
476 // launch relay 460 // launch relay
477 let _ = join!( 461 let _ = join!(
@@ -524,26 +508,21 @@ mod when_main_branch_is_uptodate {
524 508
525 p.expect("fetching updates...\r\n")?; 509 p.expect("fetching updates...\r\n")?;
526 p.expect_eventually("\r\n")?; // some updates listed here 510 p.expect_eventually("\r\n")?; // some updates listed here
527 let mut c = p.expect_choice( 511 let mut c = p.expect_choice("all proposals", vec![
528 "all proposals", 512 format!("add d3.md"), // commit msg title
529 vec![ 513 format!("\"{PROPOSAL_TITLE_3}\""),
530 format!("add d3.md"), // commit msg title 514 format!("\"{PROPOSAL_TITLE_2}\""),
531 format!("\"{PROPOSAL_TITLE_3}\""), 515 format!("\"{PROPOSAL_TITLE_1}\""),
532 format!("\"{PROPOSAL_TITLE_2}\""), 516 ])?;
533 format!("\"{PROPOSAL_TITLE_1}\""),
534 ],
535 )?;
536 c.succeeds_with(0, true, None)?; 517 c.succeeds_with(0, true, None)?;
537 let mut c = p.expect_choice( 518 let mut c = p.expect_choice("", vec![
538 "", 519 format!(
539 vec![ 520 "create and checkout proposal branch (2 ahead 0 behind 'main')"
540 format!( 521 ),
541 "create and checkout proposal branch (2 ahead 0 behind 'main')" ), 522 format!("apply to current branch with `git am`"),
542 format!("apply to current branch with `git am`"), 523 format!("download to ./patches"),
543 format!("download to ./patches"), 524 format!("back"),
544 format!("back"), 525 ])?;
545 ],
546 )?;
547 c.succeeds_with(0, true, Some(0))?; 526 c.succeeds_with(0, true, Some(0))?;
548 p.expect(format!( 527 p.expect(format!(
549 "checked out proposal as 'pr/{}(", 528 "checked out proposal as 'pr/{}(",
@@ -639,8 +618,8 @@ mod when_main_branch_is_uptodate {
639 r55.events.push(generate_test_key_1_metadata_event("fred")); 618 r55.events.push(generate_test_key_1_metadata_event("fred"));
640 r55.events.push(generate_test_key_1_relay_list_event()); 619 r55.events.push(generate_test_key_1_relay_list_event());
641 620
642 let cli_tester_handle = std::thread::spawn( 621 let cli_tester_handle =
643 move || -> Result<(GitTestRepo, GitTestRepo)> { 622 std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> {
644 let originating_repo = cli_tester_create_proposals()?; 623 let originating_repo = cli_tester_create_proposals()?;
645 624
646 let test_repo = GitTestRepo::default(); 625 let test_repo = GitTestRepo::default();
@@ -649,24 +628,20 @@ mod when_main_branch_is_uptodate {
649 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); 628 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]);
650 p.expect("fetching updates...\r\n")?; 629 p.expect("fetching updates...\r\n")?;
651 p.expect_eventually("\r\n")?; // some updates listed here 630 p.expect_eventually("\r\n")?; // some updates listed here
652 let mut c = p.expect_choice( 631 let mut c = p.expect_choice("all proposals", vec![
653 "all proposals", 632 format!("\"{PROPOSAL_TITLE_3}\""),
654 vec![ 633 format!("\"{PROPOSAL_TITLE_2}\""),
655 format!("\"{PROPOSAL_TITLE_3}\""), 634 format!("\"{PROPOSAL_TITLE_1}\""),
656 format!("\"{PROPOSAL_TITLE_2}\""), 635 ])?;
657 format!("\"{PROPOSAL_TITLE_1}\""),
658 ],
659 )?;
660 c.succeeds_with(2, true, None)?; 636 c.succeeds_with(2, true, None)?;
661 let mut c = p.expect_choice( 637 let mut c = p.expect_choice("", vec![
662 "", 638 format!(
663 vec![ 639 "create and checkout proposal branch (2 ahead 0 behind 'main')"
664 format!("create and checkout proposal branch (2 ahead 0 behind 'main')"), 640 ),
665 format!("apply to current branch with `git am`"), 641 format!("apply to current branch with `git am`"),
666 format!("download to ./patches"), 642 format!("download to ./patches"),
667 format!("back"), 643 format!("back"),
668 ], 644 ])?;
669 )?;
670 c.succeeds_with(0, true, Some(0))?; 645 c.succeeds_with(0, true, Some(0))?;
671 p.expect_end_eventually()?; 646 p.expect_end_eventually()?;
672 647
@@ -675,24 +650,18 @@ mod when_main_branch_is_uptodate {
675 p = CliTester::new_from_dir(&test_repo.dir, ["list"]); 650 p = CliTester::new_from_dir(&test_repo.dir, ["list"]);
676 p.expect("fetching updates...\r\n")?; 651 p.expect("fetching updates...\r\n")?;
677 p.expect_eventually("\r\n")?; // some updates listed here 652 p.expect_eventually("\r\n")?; // some updates listed here
678 let mut c = p.expect_choice( 653 let mut c = p.expect_choice("all proposals", vec![
679 "all proposals", 654 format!("\"{PROPOSAL_TITLE_3}\""),
680 vec![ 655 format!("\"{PROPOSAL_TITLE_2}\""),
681 format!("\"{PROPOSAL_TITLE_3}\""), 656 format!("\"{PROPOSAL_TITLE_1}\""),
682 format!("\"{PROPOSAL_TITLE_2}\""), 657 ])?;
683 format!("\"{PROPOSAL_TITLE_1}\""),
684 ],
685 )?;
686 c.succeeds_with(2, true, None)?; 658 c.succeeds_with(2, true, None)?;
687 let mut c = p.expect_choice( 659 let mut c = p.expect_choice("", vec![
688 "", 660 format!("checkout proposal branch (2 ahead 0 behind 'main')"),
689 vec![ 661 format!("apply to current branch with `git am`"),
690 format!("checkout proposal branch (2 ahead 0 behind 'main')"), 662 format!("download to ./patches"),
691 format!("apply to current branch with `git am`"), 663 format!("back"),
692 format!("download to ./patches"), 664 ])?;
693 format!("back"),
694 ],
695 )?;
696 c.succeeds_with(0, true, Some(0))?; 665 c.succeeds_with(0, true, Some(0))?;
697 p.expect_end_eventually_and_print()?; 666 p.expect_end_eventually_and_print()?;
698 667
@@ -700,8 +669,7 @@ mod when_main_branch_is_uptodate {
700 relay::shutdown_relay(8000 + p)?; 669 relay::shutdown_relay(8000 + p)?;
701 } 670 }
702 Ok((originating_repo, test_repo)) 671 Ok((originating_repo, test_repo))
703 }, 672 });
704 );
705 673
706 // launch relay 674 // launch relay
707 let _ = join!( 675 let _ = join!(
@@ -747,24 +715,20 @@ mod when_main_branch_is_uptodate {
747 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); 715 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]);
748 p.expect("fetching updates...\r\n")?; 716 p.expect("fetching updates...\r\n")?;
749 p.expect_eventually("\r\n")?; // some updates listed here 717 p.expect_eventually("\r\n")?; // some updates listed here
750 let mut c = p.expect_choice( 718 let mut c = p.expect_choice("all proposals", vec![
751 "all proposals", 719 format!("\"{PROPOSAL_TITLE_3}\""),
752 vec![ 720 format!("\"{PROPOSAL_TITLE_2}\""),
753 format!("\"{PROPOSAL_TITLE_3}\""), 721 format!("\"{PROPOSAL_TITLE_1}\""),
754 format!("\"{PROPOSAL_TITLE_2}\""), 722 ])?;
755 format!("\"{PROPOSAL_TITLE_1}\""),
756 ],
757 )?;
758 c.succeeds_with(2, true, None)?; 723 c.succeeds_with(2, true, None)?;
759 let mut c = p.expect_choice( 724 let mut c = p.expect_choice("", vec![
760 "", 725 format!(
761 vec![ 726 "create and checkout proposal branch (2 ahead 0 behind 'main')"
762 format!("create and checkout proposal branch (2 ahead 0 behind 'main')"), 727 ),
763 format!("apply to current branch with `git am`"), 728 format!("apply to current branch with `git am`"),
764 format!("download to ./patches"), 729 format!("download to ./patches"),
765 format!("back"), 730 format!("back"),
766 ], 731 ])?;
767 )?;
768 c.succeeds_with(0, true, Some(0))?; 732 c.succeeds_with(0, true, Some(0))?;
769 p.expect_end_eventually()?; 733 p.expect_end_eventually()?;
770 734
@@ -773,24 +737,18 @@ mod when_main_branch_is_uptodate {
773 p = CliTester::new_from_dir(&test_repo.dir, ["list"]); 737 p = CliTester::new_from_dir(&test_repo.dir, ["list"]);
774 p.expect("fetching updates...\r\n")?; 738 p.expect("fetching updates...\r\n")?;
775 p.expect_eventually("\r\n")?; // some updates listed here 739 p.expect_eventually("\r\n")?; // some updates listed here
776 let mut c = p.expect_choice( 740 let mut c = p.expect_choice("all proposals", vec![
777 "all proposals", 741 format!("\"{PROPOSAL_TITLE_3}\""),
778 vec![ 742 format!("\"{PROPOSAL_TITLE_2}\""),
779 format!("\"{PROPOSAL_TITLE_3}\""), 743 format!("\"{PROPOSAL_TITLE_1}\""),
780 format!("\"{PROPOSAL_TITLE_2}\""), 744 ])?;
781 format!("\"{PROPOSAL_TITLE_1}\""),
782 ],
783 )?;
784 c.succeeds_with(2, true, None)?; 745 c.succeeds_with(2, true, None)?;
785 let mut c = p.expect_choice( 746 let mut c = p.expect_choice("", vec![
786 "", 747 format!("checkout proposal branch (2 ahead 0 behind 'main')"),
787 vec![ 748 format!("apply to current branch with `git am`"),
788 format!("checkout proposal branch (2 ahead 0 behind 'main')"), 749 format!("download to ./patches"),
789 format!("apply to current branch with `git am`"), 750 format!("back"),
790 format!("download to ./patches"), 751 ])?;
791 format!("back"),
792 ],
793 )?;
794 c.succeeds_with(0, true, Some(0))?; 752 c.succeeds_with(0, true, Some(0))?;
795 p.expect(format!( 753 p.expect(format!(
796 "checked out proposal as 'pr/{}(", 754 "checked out proposal as 'pr/{}(",
@@ -864,24 +822,18 @@ mod when_main_branch_is_uptodate {
864 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); 822 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]);
865 p.expect("fetching updates...\r\n")?; 823 p.expect("fetching updates...\r\n")?;
866 p.expect_eventually("\r\n")?; // some updates listed here 824 p.expect_eventually("\r\n")?; // some updates listed here
867 let mut c = p.expect_choice( 825 let mut c = p.expect_choice("all proposals", vec![
868 "all proposals", 826 format!("\"{PROPOSAL_TITLE_3}\""),
869 vec![ 827 format!("\"{PROPOSAL_TITLE_2}\""),
870 format!("\"{PROPOSAL_TITLE_3}\""), 828 format!("\"{PROPOSAL_TITLE_1}\""),
871 format!("\"{PROPOSAL_TITLE_2}\""), 829 ])?;
872 format!("\"{PROPOSAL_TITLE_1}\""),
873 ],
874 )?;
875 c.succeeds_with(2, true, None)?; 830 c.succeeds_with(2, true, None)?;
876 let mut c = p.expect_choice( 831 let mut c = p.expect_choice("", vec![
877 "", 832 format!("checkout proposal branch and apply 1 appendments"),
878 vec![ 833 format!("apply to current branch with `git am`"),
879 format!("checkout proposal branch and apply 1 appendments"), 834 format!("download to ./patches"),
880 format!("apply to current branch with `git am`"), 835 format!("back"),
881 format!("download to ./patches"), 836 ])?;
882 format!("back"),
883 ],
884 )?;
885 c.succeeds_with(0, true, Some(0))?; 837 c.succeeds_with(0, true, Some(0))?;
886 p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?; 838 p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?;
887 p.expect_end()?; 839 p.expect_end()?;
@@ -940,24 +892,18 @@ mod when_main_branch_is_uptodate {
940 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); 892 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]);
941 p.expect("fetching updates...\r\n")?; 893 p.expect("fetching updates...\r\n")?;
942 p.expect_eventually("\r\n")?; // some updates listed here 894 p.expect_eventually("\r\n")?; // some updates listed here
943 let mut c = p.expect_choice( 895 let mut c = p.expect_choice("all proposals", vec![
944 "all proposals", 896 format!("\"{PROPOSAL_TITLE_3}\""),
945 vec![ 897 format!("\"{PROPOSAL_TITLE_2}\""),
946 format!("\"{PROPOSAL_TITLE_3}\""), 898 format!("\"{PROPOSAL_TITLE_1}\""),
947 format!("\"{PROPOSAL_TITLE_2}\""), 899 ])?;
948 format!("\"{PROPOSAL_TITLE_1}\""),
949 ],
950 )?;
951 c.succeeds_with(2, true, None)?; 900 c.succeeds_with(2, true, None)?;
952 let mut c = p.expect_choice( 901 let mut c = p.expect_choice("", vec![
953 "", 902 format!("checkout proposal branch and apply 1 appendments"),
954 vec![ 903 format!("apply to current branch with `git am`"),
955 format!("checkout proposal branch and apply 1 appendments"), 904 format!("download to ./patches"),
956 format!("apply to current branch with `git am`"), 905 format!("back"),
957 format!("download to ./patches"), 906 ])?;
958 format!("back"),
959 ],
960 )?;
961 c.succeeds_with(0, true, Some(0))?; 907 c.succeeds_with(0, true, Some(0))?;
962 p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?; 908 p.expect("checked out proposal branch and applied 1 appendments (2 ahead 0 behind 'main')\r\n")?;
963 p.expect_end()?; 909 p.expect_end()?;
@@ -1053,29 +999,21 @@ mod when_main_branch_is_uptodate {
1053 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); 999 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]);
1054 p.expect("fetching updates...\r\n")?; 1000 p.expect("fetching updates...\r\n")?;
1055 p.expect_eventually("\r\n")?; // some updates listed here 1001 p.expect_eventually("\r\n")?; // some updates listed here
1056 let mut c = p.expect_choice( 1002 let mut c = p.expect_choice("all proposals", vec![
1057 "all proposals", 1003 format!("\"{PROPOSAL_TITLE_3}\""),
1058 vec![ 1004 format!("\"{PROPOSAL_TITLE_2}\""),
1059 format!("\"{PROPOSAL_TITLE_3}\""), 1005 format!("\"{PROPOSAL_TITLE_1}\""),
1060 format!("\"{PROPOSAL_TITLE_2}\""), 1006 ])?;
1061 format!("\"{PROPOSAL_TITLE_1}\""),
1062 ],
1063 )?;
1064 c.succeeds_with(2, true, None)?; 1007 c.succeeds_with(2, true, None)?;
1065 p.expect_eventually("--force`\r\n")?; 1008 p.expect_eventually("--force`\r\n")?;
1066 1009
1067 let mut c = p.expect_choice( 1010 let mut c = p.expect_choice("", vec![
1068 "", 1011 format!("checkout local branch with unpublished changes"),
1069 vec![ 1012 format!("discard unpublished changes and checkout new revision"),
1070 format!("checkout local branch with unpublished changes"), 1013 format!("apply to current branch with `git am`"),
1071 format!( 1014 format!("download to ./patches"),
1072 "discard unpublished changes and checkout new revision" 1015 "back".to_string(),
1073 ), 1016 ])?;
1074 format!("apply to current branch with `git am`"),
1075 format!("download to ./patches"),
1076 "back".to_string(),
1077 ],
1078 )?;
1079 c.succeeds_with(1, true, Some(0))?; 1017 c.succeeds_with(1, true, Some(0))?;
1080 1018
1081 p.expect_end_eventually_and_print()?; 1019 p.expect_end_eventually_and_print()?;
@@ -1132,14 +1070,11 @@ mod when_main_branch_is_uptodate {
1132 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); 1070 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]);
1133 p.expect("fetching updates...\r\n")?; 1071 p.expect("fetching updates...\r\n")?;
1134 p.expect_eventually("\r\n")?; // some updates listed here 1072 p.expect_eventually("\r\n")?; // some updates listed here
1135 let mut c = p.expect_choice( 1073 let mut c = p.expect_choice("all proposals", vec![
1136 "all proposals", 1074 format!("\"{PROPOSAL_TITLE_3}\""),
1137 vec![ 1075 format!("\"{PROPOSAL_TITLE_2}\""),
1138 format!("\"{PROPOSAL_TITLE_3}\""), 1076 format!("\"{PROPOSAL_TITLE_1}\""),
1139 format!("\"{PROPOSAL_TITLE_2}\""), 1077 ])?;
1140 format!("\"{PROPOSAL_TITLE_1}\""),
1141 ],
1142 )?;
1143 c.succeeds_with(2, true, None)?; 1078 c.succeeds_with(2, true, None)?;
1144 p.expect("you have an amended/rebase version the proposal that is unpublished\r\n")?; 1079 p.expect("you have an amended/rebase version the proposal that is unpublished\r\n")?;
1145 p.expect("you have previously applied the latest version of the proposal (2 ahead 0 behind 'main') but your local proposal branch has amended or rebased it (2 ahead 0 behind 'main')\r\n")?; 1080 p.expect("you have previously applied the latest version of the proposal (2 ahead 0 behind 'main') but your local proposal branch has amended or rebased it (2 ahead 0 behind 'main')\r\n")?;
@@ -1148,18 +1083,13 @@ mod when_main_branch_is_uptodate {
1148 p.expect(" 2) run `ngit list` and checkout the latest published version of this proposal\r\n")?; 1083 p.expect(" 2) run `ngit list` and checkout the latest published version of this proposal\r\n")?;
1149 p.expect("if you are confident in your changes consider running `ngit push --force`\r\n")?; 1084 p.expect("if you are confident in your changes consider running `ngit push --force`\r\n")?;
1150 1085
1151 let mut c = p.expect_choice( 1086 let mut c = p.expect_choice("", vec![
1152 "", 1087 format!("checkout local branch with unpublished changes"),
1153 vec![ 1088 format!("discard unpublished changes and checkout new revision"),
1154 format!("checkout local branch with unpublished changes"), 1089 format!("apply to current branch with `git am`"),
1155 format!( 1090 format!("download to ./patches"),
1156 "discard unpublished changes and checkout new revision" 1091 "back".to_string(),
1157 ), 1092 ])?;
1158 format!("apply to current branch with `git am`"),
1159 format!("download to ./patches"),
1160 "back".to_string(),
1161 ],
1162 )?;
1163 c.succeeds_with(1, true, Some(1))?; 1093 c.succeeds_with(1, true, Some(1))?;
1164 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")?; 1094 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")?;
1165 1095
@@ -1237,26 +1167,20 @@ mod when_main_branch_is_uptodate {
1237 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); 1167 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]);
1238 p.expect("fetching updates...\r\n")?; 1168 p.expect("fetching updates...\r\n")?;
1239 p.expect_eventually("\r\n")?; // some updates listed here 1169 p.expect_eventually("\r\n")?; // some updates listed here
1240 let mut c = p.expect_choice( 1170 let mut c = p.expect_choice("all proposals", vec![
1241 "all proposals", 1171 format!("\"{PROPOSAL_TITLE_3}\""),
1242 vec![ 1172 format!("\"{PROPOSAL_TITLE_2}\""),
1243 format!("\"{PROPOSAL_TITLE_3}\""), 1173 format!("\"{PROPOSAL_TITLE_1}\""),
1244 format!("\"{PROPOSAL_TITLE_2}\""), 1174 ])?;
1245 format!("\"{PROPOSAL_TITLE_1}\""),
1246 ],
1247 )?;
1248 c.succeeds_with(2, true, None)?; 1175 c.succeeds_with(2, true, None)?;
1249 p.expect( 1176 p.expect(
1250 "local proposal branch exists with 1 unpublished commits on top of the most up-to-date version of the proposal (3 ahead 0 behind 'main')\r\n", 1177 "local proposal branch exists with 1 unpublished commits on top of the most up-to-date version of the proposal (3 ahead 0 behind 'main')\r\n",
1251 )?; 1178 )?;
1252 1179
1253 let mut c = p.expect_choice( 1180 let mut c = p.expect_choice("", vec![
1254 "", 1181 format!("checkout proposal branch with 1 unpublished commits"),
1255 vec![ 1182 format!("back"),
1256 format!("checkout proposal branch with 1 unpublished commits"), 1183 ])?;
1257 format!("back"),
1258 ],
1259 )?;
1260 c.succeeds_with(0, true, Some(0))?; 1184 c.succeeds_with(0, true, Some(0))?;
1261 p.expect("checked out proposal branch with 1 unpublished commits (3 ahead 0 behind 'main')\r\n")?; 1185 p.expect("checked out proposal branch with 1 unpublished commits (3 ahead 0 behind 'main')\r\n")?;
1262 p.expect_end()?; 1186 p.expect_end()?;
@@ -1319,26 +1243,20 @@ mod when_main_branch_is_uptodate {
1319 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); 1243 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]);
1320 p.expect("fetching updates...\r\n")?; 1244 p.expect("fetching updates...\r\n")?;
1321 p.expect_eventually("\r\n")?; // some updates listed here 1245 p.expect_eventually("\r\n")?; // some updates listed here
1322 let mut c = p.expect_choice( 1246 let mut c = p.expect_choice("all proposals", vec![
1323 "all proposals", 1247 format!("\"{PROPOSAL_TITLE_3}\""),
1324 vec![ 1248 format!("\"{PROPOSAL_TITLE_2}\""),
1325 format!("\"{PROPOSAL_TITLE_3}\""), 1249 format!("\"{PROPOSAL_TITLE_1}\""),
1326 format!("\"{PROPOSAL_TITLE_2}\""), 1250 ])?;
1327 format!("\"{PROPOSAL_TITLE_1}\""),
1328 ],
1329 )?;
1330 c.succeeds_with(2, true, None)?; 1251 c.succeeds_with(2, true, None)?;
1331 p.expect( 1252 p.expect(
1332 "local proposal branch exists with 1 unpublished commits on top of the most up-to-date version of the proposal (3 ahead 0 behind 'main')\r\n", 1253 "local proposal branch exists with 1 unpublished commits on top of the most up-to-date version of the proposal (3 ahead 0 behind 'main')\r\n",
1333 )?; 1254 )?;
1334 1255
1335 let mut c = p.expect_choice( 1256 let mut c = p.expect_choice("", vec![
1336 "", 1257 format!("checkout proposal branch with 1 unpublished commits"),
1337 vec![ 1258 format!("back"),
1338 format!("checkout proposal branch with 1 unpublished commits"), 1259 ])?;
1339 format!("back"),
1340 ],
1341 )?;
1342 c.succeeds_with(0, true, Some(0))?; 1260 c.succeeds_with(0, true, Some(0))?;
1343 p.expect("checked out proposal branch with 1 unpublished commits (3 ahead 0 behind 'main')\r\n")?; 1261 p.expect("checked out proposal branch with 1 unpublished commits (3 ahead 0 behind 'main')\r\n")?;
1344 p.expect_end()?; 1262 p.expect_end()?;
@@ -1421,26 +1339,20 @@ mod when_main_branch_is_uptodate {
1421 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); 1339 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]);
1422 p.expect("fetching updates...\r\n")?; 1340 p.expect("fetching updates...\r\n")?;
1423 p.expect_eventually("\r\n")?; // some updates listed here 1341 p.expect_eventually("\r\n")?; // some updates listed here
1424 let mut c = p.expect_choice( 1342 let mut c = p.expect_choice("all proposals", vec![
1425 "all proposals", 1343 format!("\"{PROPOSAL_TITLE_3}\""),
1426 vec![ 1344 format!("\"{PROPOSAL_TITLE_2}\""),
1427 format!("\"{PROPOSAL_TITLE_3}\""), 1345 format!("\"{PROPOSAL_TITLE_1}\""),
1428 format!("\"{PROPOSAL_TITLE_2}\""), 1346 ])?;
1429 format!("\"{PROPOSAL_TITLE_1}\""),
1430 ],
1431 )?;
1432 c.succeeds_with(2, true, None)?; 1347 c.succeeds_with(2, true, None)?;
1433 p.expect("updated proposal available (2 ahead 0 behind 'main'). existing version is 2 ahead 1 behind 'main'\r\n")?; 1348 p.expect("updated proposal available (2 ahead 0 behind 'main'). existing version is 2 ahead 1 behind 'main'\r\n")?;
1434 let mut c = p.expect_choice( 1349 let mut c = p.expect_choice("", vec![
1435 "", 1350 format!("checkout and overwrite existing proposal branch"),
1436 vec![ 1351 format!("checkout existing outdated proposal branch"),
1437 format!("checkout and overwrite existing proposal branch"), 1352 format!("apply to current branch with `git am`"),
1438 format!("checkout existing outdated proposal branch"), 1353 format!("download to ./patches"),
1439 format!("apply to current branch with `git am`"), 1354 format!("back"),
1440 format!("download to ./patches"), 1355 ])?;
1441 format!("back"),
1442 ],
1443 )?;
1444 c.succeeds_with(0, true, Some(0))?; 1356 c.succeeds_with(0, true, Some(0))?;
1445 p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?; 1357 p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?;
1446 p.expect_end()?; 1358 p.expect_end()?;
@@ -1494,26 +1406,20 @@ mod when_main_branch_is_uptodate {
1494 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); 1406 let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]);
1495 p.expect("fetching updates...\r\n")?; 1407 p.expect("fetching updates...\r\n")?;
1496 p.expect_eventually("\r\n")?; // some updates listed here 1408 p.expect_eventually("\r\n")?; // some updates listed here
1497 let mut c = p.expect_choice( 1409 let mut c = p.expect_choice("all proposals", vec![
1498 "all proposals", 1410 format!("\"{PROPOSAL_TITLE_3}\""),
1499 vec![ 1411 format!("\"{PROPOSAL_TITLE_2}\""),
1500 format!("\"{PROPOSAL_TITLE_3}\""), 1412 format!("\"{PROPOSAL_TITLE_1}\""),
1501 format!("\"{PROPOSAL_TITLE_2}\""), 1413 ])?;
1502 format!("\"{PROPOSAL_TITLE_1}\""),
1503 ],
1504 )?;
1505 c.succeeds_with(2, true, None)?; 1414 c.succeeds_with(2, true, None)?;
1506 p.expect("updated proposal available (2 ahead 0 behind 'main'). existing version is 2 ahead 1 behind 'main'\r\n")?; 1415 p.expect("updated proposal available (2 ahead 0 behind 'main'). existing version is 2 ahead 1 behind 'main'\r\n")?;
1507 let mut c = p.expect_choice( 1416 let mut c = p.expect_choice("", vec![
1508 "", 1417 format!("checkout and overwrite existing proposal branch"),
1509 vec![ 1418 format!("checkout existing outdated proposal branch"),
1510 format!("checkout and overwrite existing proposal branch"), 1419 format!("apply to current branch with `git am`"),
1511 format!("checkout existing outdated proposal branch"), 1420 format!("download to ./patches"),
1512 format!("apply to current branch with `git am`"), 1421 format!("back"),
1513 format!("download to ./patches"), 1422 ])?;
1514 format!("back"),
1515 ],
1516 )?;
1517 c.succeeds_with(0, true, Some(0))?; 1423 c.succeeds_with(0, true, Some(0))?;
1518 p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?; 1424 p.expect("checked out new version of proposal (2 ahead 0 behind 'main'), replacing old version (2 ahead 1 behind 'main')\r\n")?;
1519 p.expect_end()?; 1425 p.expect_end()?;