Thread (47 messages) 47 messages, 4 authors, 2021-12-11

Re: [PATCH 13/19] tests: apply modern idiom for signaling test failure

From: Jeff King <hidden>
Date: 2021-12-10 09:32:10

On Thu, Dec 09, 2021 at 12:11:09AM -0500, Eric Sunshine wrote:
Simplify the way these tests signal failure by employing the modern
idiom of making the `if` or `case` statement resolve to false when an
error is detected.
Yeah, these are pretty non-idiomatic, but...
quoted hunk ↗ jump to hunk
diff --git a/t/t3402-rebase-merge.sh b/t/t3402-rebase-merge.sh
index cfde68f193..7e46f4ca85 100755
--- a/t/t3402-rebase-merge.sh
+++ b/t/t3402-rebase-merge.sh
@@ -68,7 +68,7 @@ test_expect_success 'merge and rebase should match' '
 	if test -s difference
 	then
 		cat difference
-		(exit 1)
+		false
 	else
 		echo happy
 	fi
...I'd have said the idiom here is just:

  git diff-tree -r test-rebase test-merge >difference &&
  test -s difference

The extra "cat" and "happy" are verbose output that we usually skip in
favor of letting "-x" logging do the talking (and leaving the failed
state so you can "cat difference" yourself).

That said, I'm OK with this minimal change in the name of keeping creep
out of the series.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help