git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 1/1] t3420: remove progress lines before comparing output

From
PGPhillip Wood via GitGitGadget <gitgitgadget@gmail.com>
Date
Jul 4, 2019, 09:47 UTC
Message-ID
<e1b4023bc0e606079547f7a7562a283009e69530.1562233620.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.276.v2.git.gitgitgadget@gmail.com>
From: Phillip Wood <phillip.wood@dunelm.org.uk>

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>
---
 t/t3420-rebase-autostash.sh | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index 9186e90127..b8f4d03467 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -30,7 +30,8 @@ test_expect_success setup '
 	echo conflicting-change >file2 &&
 	git add . &&
 	test_tick &&
-	git commit -m "related commit"
+	git commit -m "related commit" &&
+	remove_progress_re="$(printf "s/.*\\r//")"
 '
 
 create_expected_success_am () {
@@ -48,8 +49,8 @@ create_expected_success_interactive () {
 	q_to_cr >expected <<-EOF
 	$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
 	HEAD is now at $(git rev-parse --short feature-branch) third commit
-	Rebasing (1/2)QRebasing (2/2)QApplied autostash.
-	Q                                                                                QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
+	Applied autostash.
+	Successfully rebased and updated refs/heads/rebased-feature-branch.
 	EOF
 }
 
@@ -67,13 +68,13 @@ create_expected_failure_am () {
 }
 
 create_expected_failure_interactive () {
-	q_to_cr >expected <<-EOF
+	cat >expected <<-EOF
 	$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
 	HEAD is now at $(git rev-parse --short feature-branch) third commit
-	Rebasing (1/2)QRebasing (2/2)QApplying autostash resulted in conflicts.
+	Applying autostash resulted in conflicts.
 	Your changes are safe in the stash.
 	You can run "git stash pop" or "git stash drop" at any time.
-	Q                                                                                QSuccessfully rebased and updated refs/heads/rebased-feature-branch.
+	Successfully rebased and updated refs/heads/rebased-feature-branch.
 	EOF
 }
 
@@ -109,7 +110,8 @@ testrebase () {
 			suffix=interactive
 		fi &&
 		create_expected_success_$suffix &&
-		test_i18ncmp expected actual
+		sed "$remove_progress_re" <actual >actual2 &&
+		test_i18ncmp expected actual2
 	'
 
 	test_expect_success "rebase$type: dirty index, non-conflicting rebase" '
@@ -209,7 +211,8 @@ testrebase () {
 			suffix=interactive
 		fi &&
 		create_expected_failure_$suffix &&
-		test_i18ncmp expected actual
+		sed "$remove_progress_re" <actual >actual2 &&
+		test_i18ncmp expected actual2
 	'
 }
 
-- 
gitgitgadget
Previous: Phillip Wood via GitGitGadget
Message 8 of 8 in “t3420 remove progress from output”
  1. 0/1 t3420 remove progress from outputPhillip Wood via GitGitGadget, Jul 1, 2019
  2. 1/1 t3420: remove progress lines before comparing outputPhillip Wood via GitGitGadget, Jul 1, 2019
  3. Junio C HamanoJul 1, 2019
  4. Phillip WoodJul 2, 2019
  5. Junio C HamanoJul 2, 2019
  6. Phillip WoodJul 4, 2019
  7. 0/1 t3420 remove progress from outputPhillip Wood via GitGitGadget, Jul 4, 2019
  8. 1/1 t3420: remove progress lines before comparing outputPhillip Wood via GitGitGadget, Jul 4, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.