status test: add missing && to <<EOF blocks

When a test forgets to include && after each command, it is possible for an early command to succeed but the test to fail, which can hide bugs. Checked using the following patch to the test harness: --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -425,7 +425,17 @@ test_eval_ () { eval </dev/null >&3 2>&4 "$*" } +check_command_chaining_ () { + eval >&3 2>&4 "(exit 189) && $*" + eval_chain_ret=$? + if test "$eval_chain_ret" != 189 + then + error 'bug in test script: missing "&&" in test commands' + fi +} + test_run_ () { + check_command_chaining_ "$1" test_cleanup=: expecting_failure=$2 setup_malloc_check Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

Jonathan Nieder committed Oct 11, 2013 at 10:35 UTC 59c222052801a55bb40a78378ea19c6b7c4ec45d
1 file changed +5 -5
t/t7512-status-help.sh
+5 -5
@@ -669,7 +669,7 @@ EOF
669 test_expect_success 'status showing detached at and from a tag' '
670 test_commit atag tagging &&
671 git checkout atag &&
672 - cat >expected <<\EOF
672 + cat >expected <<\EOF &&
673 HEAD detached at atag
674 nothing to commit (use -u to show untracked files)
675 EOF
@@ -677,7 +677,7 @@ EOF
677 test_i18ncmp expected actual &&
678
679 git reset --hard HEAD^ &&
680 - cat >expected <<\EOF
680 + cat >expected <<\EOF &&
681 HEAD detached from atag
682 nothing to commit (use -u to show untracked files)
683 EOF
@@ -695,7 +695,7 @@ test_expect_success 'status while reverting commit (conflicts)' '
695 test_commit new to-revert.txt &&
696 TO_REVERT=$(git rev-parse --short HEAD^) &&
697 test_must_fail git revert $TO_REVERT &&
698 - cat >expected <<EOF
698 + cat >expected <<EOF &&
699 On branch master
700 You are currently reverting commit $TO_REVERT.
701 (fix conflicts and run "git revert --continue")
@@ -716,7 +716,7 @@ EOF
716 test_expect_success 'status while reverting commit (conflicts resolved)' '
717 echo reverted >to-revert.txt &&
718 git add to-revert.txt &&
719 - cat >expected <<EOF
719 + cat >expected <<EOF &&
720 On branch master
721 You are currently reverting commit $TO_REVERT.
722 (all conflicts fixed: run "git revert --continue")
@@ -735,7 +735,7 @@ EOF
735
736 test_expect_success 'status after reverting commit' '
737 git revert --continue &&
738 - cat >expected <<\EOF
738 + cat >expected <<\EOF &&
739 On branch master
740 nothing to commit (use -u to show untracked files)
741 EOF