The eighth batch
[git.git] / t / chainlint / if-then-else.test
blob6582a7f440239b8762c81c9da0c3f3f993c056cf
1 test_expect_success 'if-then-else' '
3 # LINT: "if", "then", "elif", "else", "fi" do not need "&&"
4         if test -n ""
5         then
6 # LINT: missing "&&" on "echo"
7                 echo very
8 # LINT: last statement before "elif" does not need "&&"
9                 echo empty
10         elif test -z ""
11         then
12 # LINT: last statement before "else" does not need "&&"
13                 echo foo
14         else
15                 echo foo &&
16 # LINT: last statement before "fi" does not need "&&"
17                 cat <<-\EOF
18                 bar
19                 EOF
20 # LINT: missing "&&" on "fi"
21         fi
22         echo poodle
23 ) &&
25 # LINT: "then" on same line as "if"
26         if test -n ""; then
27                 echo very &&
28                 echo empty
29         fi