From: Junio C Hamano Date: Tue, 01 May 2012 18:00:17 GMT Subject: Re: [PATCH 1/4] test: modernize style of t4006 Message-ID: <7vzk9r93ym.fsf@alter.siamese.dyndns.org> In-Reply-To: <1335892215-21331-2-git-send-email-zbyszek@in.waw.pl> Zbigniew Jędrzejewski-Szmek writes: > Signed-off-by: Zbigniew Jędrzejewski-Szmek > --- > 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 /' 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" check && > + echo ":100644 100755 X X M rezrov" >expected && > + test_cmp expected check > +' > > test_done