Re: [PATCH 1/4] test: modernize style of t4006

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

 



Zbigniew Jędrzejewski-Szmek <zbyszek@xxxxxxxxx> writes:

> Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@xxxxxxxxx>
> ---
>  t/t4006-diff-mode.sh |   32 +++++++++++++++-----------------
>  1 file changed, 15 insertions(+), 17 deletions(-)

Style update is welcome, but shouldn't the assignment to sed_script
be done in the second test if it is the only user?  If you are going to
add more tests at the end, then it should be away from the second test to
make it clear that it is not part of it.

Thanks.

> diff --git a/t/t4006-diff-mode.sh b/t/t4006-diff-mode.sh
> index ff8c2f7..c8f5180 100755
> --- a/t/t4006-diff-mode.sh
> +++ b/t/t4006-diff-mode.sh
> @@ -8,23 +8,21 @@ test_description='Test mode change diffs.
>  '
>  . ./test-lib.sh
>  
> -test_expect_success \
> -    'setup' \
> -    'echo frotz >rezrov &&
> -     git update-index --add rezrov &&
> -     tree=`git write-tree` &&
> -     echo $tree'
> -
> -test_expect_success \
> -    'chmod' \
> -    'test_chmod +x rezrov &&
> -     git diff-index $tree >current'
> -
> -sed -e 's/\(:100644 100755\) \('"$_x40"'\) \2 /\1 X X /' <current >check
> -echo ":100644 100755 X X M	rezrov" >expected
> +test_expect_success 'setup' '
> +	echo frotz >rezrov &&
> +	git update-index --add rezrov &&
> +	tree=`git write-tree` &&
> +	echo $tree
> +'
>  
> -test_expect_success \
> -    'verify' \
> -    'test_cmp expected check'
> +# $_x40 is defined in test-lib.sh
> +sed_script='s/\(:100644 100755\) \('"$_x40"'\) \2 /\1 X X /'
> +test_expect_success 'chmod' '
> +	test_chmod +x rezrov &&
> +	git diff-index $tree >current &&
> +	sed -e "$sed_script" <current >check &&
> +	echo ":100644 100755 X X M	rezrov" >expected &&
> +	test_cmp expected check
> +'
>  
>  test_done
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]