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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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...

> 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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux