t3420: remove progress lines before comparing output

Some of the tests check the output of rebase is what we expect. These were added after a regression that added unwanted stash output when using --autostash. They are useful as they prevent unintended changes to the output of the various rebase commands. However they also include all the progress output which is less useful as it only tests what would be written to a dumb terminal which is not the normal use case. The recent changes to fix clearing the line when printing progress necessarily meant making an ugly change to these tests. Address this my removing the progress output before comparing it to the expected output. We do this by removing everything before the final "\r" on each line as we don't care about the progress indicator, but we do care about what is printed immediately after it. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Phillip Wood committed Jul 4, 2019 at 02:47 UTC bb431c3dadbe0011414f9d7512c5967c86da6197
1 file changed +11 -8
t/t3420-rebase-autostash.sh
+11 -8
@@ -30,7 +30,8 @@ test_expect_success setup '
30 echo conflicting-change >file2 &&
31 git add . &&
32 test_tick &&
33 - git commit -m "related commit"
33 + git commit -m "related commit" &&
34 + remove_progress_re="$(printf "s/.*\\r//")"
35 '
36
37 create_expected_success_am () {
@@ -48,8 +49,8 @@ create_expected_success_interactive () {
49 q_to_cr >expected <<-EOF
50 $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
51 HEAD is now at $(git rev-parse --short feature-branch) third commit
51 - Rebasing (1/2)QRebasing (2/2)QApplied autostash.
52 - Q QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
52 + Applied autostash.
53 + Successfully rebased and updated refs/heads/rebased-feature-branch.
54 EOF
55 }
56
@@ -67,13 +68,13 @@ create_expected_failure_am () {
68 }
69
70 create_expected_failure_interactive () {
70 - q_to_cr >expected <<-EOF
71 + cat >expected <<-EOF
72 $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
73 HEAD is now at $(git rev-parse --short feature-branch) third commit
73 - Rebasing (1/2)QRebasing (2/2)QApplying autostash resulted in conflicts.
74 + Applying autostash resulted in conflicts.
75 Your changes are safe in the stash.
76 You can run "git stash pop" or "git stash drop" at any time.
76 - Q QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
77 + Successfully rebased and updated refs/heads/rebased-feature-branch.
78 EOF
79 }
80
@@ -109,7 +110,8 @@ testrebase () {
110 suffix=interactive
111 fi &&
112 create_expected_success_$suffix &&
112 - test_i18ncmp expected actual
113 + sed "$remove_progress_re" <actual >actual2 &&
114 + test_i18ncmp expected actual2
115 '
116
117 test_expect_success "rebase$type: dirty index, non-conflicting rebase" '
@@ -209,7 +211,8 @@ testrebase () {
211 suffix=interactive
212 fi &&
213 create_expected_failure_$suffix &&
212 - test_i18ncmp expected actual
214 + sed "$remove_progress_re" <actual >actual2 &&
215 + test_i18ncmp expected actual2
216 '
217 }
218