Re: [PATCH v3 14/35] userdiff tests: add alternative hunk header test infrastructure

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

 



Am 24.02.21 um 20:51 schrieb Ævar Arnfjörð Bjarmason:
> diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
> index 8a8a7a99c88..6fd3dce1364 100755
> --- a/t/t4018-diff-funcname.sh
> +++ b/t/t4018-diff-funcname.sh
> @@ -87,7 +87,7 @@ last_diff_context_line () {
>  }
>  
>  # check each individual file
> -for i in $(git -C t4018 ls-files)
> +for i in $(git -C t4018 ls-files -- ':!*.sh')
>  do
>  	test_expect_success "setup hunk header: $i" "
>  		grep -v '^t4018' \"t4018/$i\" >\"t4018/$i.content\" &&
> @@ -106,4 +106,40 @@ do
>  	"
>  done
>  
> +test_diff_funcname () {
> +	desc=$1
> +	cat <&8 >arg.header &&
> +	cat <&9 >arg.test &&
> +	what=$(cat arg.what) &&
> +
> +	test_expect_success "setup: $desc" '
> +		cp arg.test "$what" &&
> +		cp arg.header expected &&
> +		git add "$what" &&
> +		do_change_me "$what"
> +	' &&

I think we should not chain test_expect_success with && because when one
of the tests early in the chain fails, test case numbers are shifted
compared to when all tests succeed. I don't know, though, whether that
is an important thing (or a thing at all).

> +
> +	test_expect_success "$desc" '
> +		git diff -U1 "$what" >diff &&
> +		last_diff_context_line diff >actual &&
> +		test_cmp expected actual
> +	'
> +}
> +
> +for what in $diffpatterns
> +do
> +	test="$TEST_DIRECTORY/t4018/$what.sh"
> +	if ! test -e "$test"
> +	then
> +		continue
> +	fi &&
> +
> +	test_expect_success "setup: hunk header for $what" '
> +		echo "$what diff=$what" >.gitattributes &&
> +		echo "$what" >arg.what
> +	' &&

Same here. And when this is removed, the && just above is not needed
anymore, either.

> +
> +	. "$test"
> +done
> +
>  test_done

-- Hannes



[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