diff options
| author | Junio C Hamano <gitster@pobox.com> | 2018-08-02 15:30:46 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-08-02 15:30:46 -0700 |
| commit | cfec6133cfcd97a23ca29c7d0ad8d2961796dd52 (patch) | |
| tree | 7bdee58508f7e17c33add21d8f436687206d7446 /t/chainlint/exit-loop.test | |
| parent | Merge branch 'jt/tags-to-promised-blobs-fix' (diff) | |
| parent | t/chainlint.sed: drop extra spaces from regex character class (diff) | |
| download | git-cfec6133cfcd97a23ca29c7d0ad8d2961796dd52.tar.gz git-cfec6133cfcd97a23ca29c7d0ad8d2961796dd52.zip | |
Merge branch 'es/chain-lint-in-subshell'
Look for broken "&&" chains that are hidden in subshell, many of
which have been found and corrected.
* es/chain-lint-in-subshell:
t/chainlint.sed: drop extra spaces from regex character class
t/chainlint: add chainlint "specialized" test cases
t/chainlint: add chainlint "complex" test cases
t/chainlint: add chainlint "cuddled" test cases
t/chainlint: add chainlint "loop" and "conditional" test cases
t/chainlint: add chainlint "nested subshell" test cases
t/chainlint: add chainlint "one-liner" test cases
t/chainlint: add chainlint "whitespace" test cases
t/chainlint: add chainlint "basic" test cases
t/Makefile: add machinery to check correctness of chainlint.sed
t/test-lib: teach --chain-lint to detect broken &&-chains in subshells
Diffstat (limited to 't/chainlint/exit-loop.test')
| -rw-r--r-- | t/chainlint/exit-loop.test | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/t/chainlint/exit-loop.test b/t/chainlint/exit-loop.test new file mode 100644 index 0000000000..2f038207e1 --- /dev/null +++ b/t/chainlint/exit-loop.test @@ -0,0 +1,27 @@ +( + for i in a b c + do +# LINT: "|| exit {n}" valid for-loop escape in subshell; no "&&" needed + foo || exit 1 + bar && + baz + done +) && +( + while true + do +# LINT: "|| exit {n}" valid while-loop escape in subshell; no "&&" needed + foo || exit 1 + bar && + baz + done +) && +( + i=0 && + while test $i -lt 10 + do +# LINT: "|| exit" (sans exit code) valid escape in subshell; no "&&" needed + echo $i || exit + i=$(($i + 1)) + done +) |
