diff options
Diffstat (limited to 't/chainlint')
26 files changed, 87 insertions, 63 deletions
diff --git a/t/chainlint/blank-line-before-esac.expect b/t/chainlint/blank-line-before-esac.expect index 48ed4eb..056e030 100644 --- a/t/chainlint/blank-line-before-esac.expect +++ b/t/chainlint/blank-line-before-esac.expect @@ -1,11 +1,11 @@ -test_done ( ) { +test_done () { case "$test_failure" in - 0 ) + 0) test_at_end_hook_ exit 0 ;; - * ) + *) if test $test_external_has_tap -eq 0 then say_color error "# failed $test_failure among $msg" @@ -14,5 +14,5 @@ test_done ( ) { exit 1 ;; - esac + esac } diff --git a/t/chainlint/blank-line.expect b/t/chainlint/blank-line.expect index f76fde1..b47827d 100644 --- a/t/chainlint/blank-line.expect +++ b/t/chainlint/blank-line.expect @@ -1,4 +1,8 @@ ( + nothing && + something + + ) diff --git a/t/chainlint/block.expect b/t/chainlint/block.expect index a3bcea4..1c87326 100644 --- a/t/chainlint/block.expect +++ b/t/chainlint/block.expect @@ -12,9 +12,9 @@ ) && { - echo a ; ?!AMP?! echo b + echo a; ?!AMP?! echo b } && -{ echo a ; ?!AMP?! echo b ; } && +{ echo a; ?!AMP?! echo b; } && { echo "${var}9" && diff --git a/t/chainlint/chain-break-background.expect b/t/chainlint/chain-break-background.expect index 28f9114..20d0bb5 100644 --- a/t/chainlint/chain-break-background.expect +++ b/t/chainlint/chain-break-background.expect @@ -1,9 +1,9 @@ JGIT_DAEMON_PID= && git init --bare empty.git && -> empty.git/git-daemon-export-ok && +>empty.git/git-daemon-export-ok && mkfifo jgit_daemon_output && { - jgit daemon --port="$JGIT_DAEMON_PORT" . > jgit_daemon_output & + jgit daemon --port="$JGIT_DAEMON_PORT" . >jgit_daemon_output & JGIT_DAEMON_PID=$! } && test_expect_code 2 git ls-remote --exit-code git://localhost:$JGIT_DAEMON_PORT/empty.git diff --git a/t/chainlint/chain-break-return-exit.expect b/t/chainlint/chain-break-return-exit.expect index 1732d22..4cd18e2 100644 --- a/t/chainlint/chain-break-return-exit.expect +++ b/t/chainlint/chain-break-return-exit.expect @@ -1,16 +1,16 @@ case "$(git ls-files)" in -one ) echo pass one ;; -* ) echo bad one ; return 1 ;; +one) echo pass one ;; +*) echo bad one; return 1 ;; esac && ( case "$(git ls-files)" in - two ) echo pass two ;; - * ) echo bad two ; exit 1 ;; -esac + two) echo pass two ;; + *) echo bad two; exit 1 ;; + esac ) && case "$(git ls-files)" in -dir/two"$LF"one ) echo pass both ;; -* ) echo bad ; return 1 ;; +dir/two"$LF"one) echo pass both ;; +*) echo bad; return 1 ;; esac && for i in 1 2 3 4 ; do diff --git a/t/chainlint/chain-break-status.expect b/t/chainlint/chain-break-status.expect index f4bada9..e6b3b21 100644 --- a/t/chainlint/chain-break-status.expect +++ b/t/chainlint/chain-break-status.expect @@ -1,7 +1,7 @@ -OUT=$(( ( large_git ; echo $? 1 >& 3 ) | : ) 3 >& 1) && +OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) && test_match_signal 13 "$OUT" && -{ test-tool sigchain > actual ; ret=$? ; } && +{ test-tool sigchain >actual; ret=$?; } && { test_match_signal 15 "$ret" || test "$ret" = 3 diff --git a/t/chainlint/chained-subshell.expect b/t/chainlint/chained-subshell.expect index af0369d..83810ea 100644 --- a/t/chainlint/chained-subshell.expect +++ b/t/chainlint/chained-subshell.expect @@ -4,7 +4,7 @@ mkdir sub && ( nuff said ) && -cut "-d " -f actual | ( read s1 s2 s3 && +cut "-d " -f actual | (read s1 s2 s3 && test -f $s1 ?!AMP?! test $(cat $s2) = tree2path1 && -test $(cat $s3) = tree3path1 ) +test $(cat $s3) = tree3path1) diff --git a/t/chainlint/command-substitution-subsubshell.expect b/t/chainlint/command-substitution-subsubshell.expect index ab2f79e..ec42f2c 100644 --- a/t/chainlint/command-substitution-subsubshell.expect +++ b/t/chainlint/command-substitution-subsubshell.expect @@ -1,2 +1,2 @@ -OUT=$(( ( large_git 1 >& 3 ) | : ) 3 >& 1) && +OUT=$( ((large_git 1>&3) | :) 3>&1 ) && test_match_signal 13 "$OUT" diff --git a/t/chainlint/dqstring-line-splice.expect b/t/chainlint/dqstring-line-splice.expect index bf9ced6..37eab80 100644 --- a/t/chainlint/dqstring-line-splice.expect +++ b/t/chainlint/dqstring-line-splice.expect @@ -1,3 +1,5 @@ -echo 'fatal: reword option of --fixup is mutually exclusive with' '--patch/--interactive/--all/--include/--only' > expect && -test_must_fail git commit --fixup=reword:HEAD~ $1 2 > actual && + +echo 'fatal: reword option of --fixup is mutually exclusive with' '--patch/--interactive/--all/--include/--only' >expect && +test_must_fail git commit --fixup=reword:HEAD~ $1 2>actual && test_cmp expect actual + diff --git a/t/chainlint/dqstring-no-interpolate.expect b/t/chainlint/dqstring-no-interpolate.expect index 1072498..087eda1 100644 --- a/t/chainlint/dqstring-no-interpolate.expect +++ b/t/chainlint/dqstring-no-interpolate.expect @@ -6,6 +6,7 @@ grep "^\.git$" output.txt && ( cd client$version && GIT_TEST_PROTOCOL_VERSION=$version git fetch-pack --no-progress .. $(cat ../input) -) > output && - cut -d ' ' -f 2 < output | sort > actual && +) >output && + cut -d ' ' -f 2 <output | sort >actual && test_cmp expect actual + diff --git a/t/chainlint/empty-here-doc.expect b/t/chainlint/empty-here-doc.expect index e8733c9..8507721 100644 --- a/t/chainlint/empty-here-doc.expect +++ b/t/chainlint/empty-here-doc.expect @@ -1,4 +1,4 @@ -git ls-tree $tree path > current && -cat > expected <<\EOF && +git ls-tree $tree path >current && +cat >expected <<\EOF && EOF test_output diff --git a/t/chainlint/exclamation.expect b/t/chainlint/exclamation.expect index 2d961a5..765a35b 100644 --- a/t/chainlint/exclamation.expect +++ b/t/chainlint/exclamation.expect @@ -1,4 +1,4 @@ -if ! condition ; then echo nope ; else yep ; fi && +if ! condition; then echo nope; else yep; fi && test_prerequisite !MINGW && mail uucp!address && echo !whatever! diff --git a/t/chainlint/for-loop-abbreviated.expect b/t/chainlint/for-loop-abbreviated.expect index a21007a..02c0d15 100644 --- a/t/chainlint/for-loop-abbreviated.expect +++ b/t/chainlint/for-loop-abbreviated.expect @@ -1,5 +1,5 @@ for it do - path=$(expr "$it" : ( [^:]*) ) && + path=$(expr "$it" : ([^:]*)) && git update-index --add "$path" || exit done diff --git a/t/chainlint/for-loop.expect b/t/chainlint/for-loop.expect index d65c821..d2237f1 100644 --- a/t/chainlint/for-loop.expect +++ b/t/chainlint/for-loop.expect @@ -6,6 +6,7 @@ bar EOF done ?!AMP?! + for i in a b c; do echo $i && cat $i ?!LOOP?! diff --git a/t/chainlint/function.expect b/t/chainlint/function.expect index a14388e..dd7c997 100644 --- a/t/chainlint/function.expect +++ b/t/chainlint/function.expect @@ -1,8 +1,8 @@ -sha1_file ( ) { +sha1_file() { echo "$*" | sed "s#..#.git/objects/&/#" } && -remove_object ( ) { +remove_object() { file=$(sha1_file "$*") && test -e "$file" ?!AMP?! rm -f "$file" diff --git a/t/chainlint/here-doc.expect b/t/chainlint/here-doc.expect index 1df3f78..91b9612 100644 --- a/t/chainlint/here-doc.expect +++ b/t/chainlint/here-doc.expect @@ -1,6 +1,6 @@ boodle wobba \ - gorgo snoot \ - wafta snurb <<EOF && + gorgo snoot \ + wafta snurb <<EOF && quoth the raven, nevermore... EOF diff --git a/t/chainlint/loop-detect-status.expect b/t/chainlint/loop-detect-status.expect index 24da9e8..7ce3a34 100644 --- a/t/chainlint/loop-detect-status.expect +++ b/t/chainlint/loop-detect-status.expect @@ -1,18 +1,18 @@ -( while test $i -le $blobcount -do - printf "Generating blob $i/$blobcount\r" >& 2 && +(while test $i -le $blobcount + do + printf "Generating blob $i/$blobcount\r" >&2 && printf "blob\nmark :$i\ndata $blobsize\n" && #test-tool genrandom $i $blobsize && printf "%-${blobsize}s" $i && echo "M 100644 :$i $i" >> commit && i=$(($i+1)) || echo $? > exit-status -done && -echo "commit refs/heads/main" && -echo "author A U Thor <author@email.com> 123456789 +0000" && -echo "committer C O Mitter <committer@email.com> 123456789 +0000" && -echo "data 5" && -echo ">2gb" && -cat commit ) | + done && + echo "commit refs/heads/main" && + echo "author A U Thor <author@email.com> 123456789 +0000" && + echo "committer C O Mitter <committer@email.com> 123456789 +0000" && + echo "data 5" && + echo ">2gb" && + cat commit) | git fast-import --big-file-threshold=2 && test ! -f exit-status diff --git a/t/chainlint/nested-cuddled-subshell.expect b/t/chainlint/nested-cuddled-subshell.expect index 2a86885..3836049 100644 --- a/t/chainlint/nested-cuddled-subshell.expect +++ b/t/chainlint/nested-cuddled-subshell.expect @@ -2,18 +2,24 @@ (cd foo && bar ) && + (cd foo && bar ) ?!AMP?! + ( cd foo && bar) && + ( cd foo && bar) ?!AMP?! + (cd foo && bar) && + (cd foo && bar) ?!AMP?! + foobar ) diff --git a/t/chainlint/nested-loop-detect-failure.expect b/t/chainlint/nested-loop-detect-failure.expect index 4793a0e..3461df4 100644 --- a/t/chainlint/nested-loop-detect-failure.expect +++ b/t/chainlint/nested-loop-detect-failure.expect @@ -1,31 +1,31 @@ -for i in 0 1 2 3 4 5 6 7 8 9 ; +for i in 0 1 2 3 4 5 6 7 8 9; do - for j in 0 1 2 3 4 5 6 7 8 9 ; + for j in 0 1 2 3 4 5 6 7 8 9; do - echo "$i$j" > "path$i$j" ?!LOOP?! + echo "$i$j" >"path$i$j" ?!LOOP?! done ?!LOOP?! done && -for i in 0 1 2 3 4 5 6 7 8 9 ; +for i in 0 1 2 3 4 5 6 7 8 9; do - for j in 0 1 2 3 4 5 6 7 8 9 ; + for j in 0 1 2 3 4 5 6 7 8 9; do - echo "$i$j" > "path$i$j" || return 1 + echo "$i$j" >"path$i$j" || return 1 done done && -for i in 0 1 2 3 4 5 6 7 8 9 ; +for i in 0 1 2 3 4 5 6 7 8 9; do - for j in 0 1 2 3 4 5 6 7 8 9 ; + for j in 0 1 2 3 4 5 6 7 8 9; do - echo "$i$j" > "path$i$j" ?!LOOP?! + echo "$i$j" >"path$i$j" ?!LOOP?! done || return 1 done && -for i in 0 1 2 3 4 5 6 7 8 9 ; +for i in 0 1 2 3 4 5 6 7 8 9; do - for j in 0 1 2 3 4 5 6 7 8 9 ; + for j in 0 1 2 3 4 5 6 7 8 9; do - echo "$i$j" > "path$i$j" || return 1 + echo "$i$j" >"path$i$j" || return 1 done || return 1 done diff --git a/t/chainlint/nested-subshell.expect b/t/chainlint/nested-subshell.expect index 02e0a9f..73ff285 100644 --- a/t/chainlint/nested-subshell.expect +++ b/t/chainlint/nested-subshell.expect @@ -4,6 +4,7 @@ echo a && echo b ) >file && + cd foo && ( echo a ?!AMP?! diff --git a/t/chainlint/pipe.expect b/t/chainlint/pipe.expect index 2cfc028..811971b 100644 --- a/t/chainlint/pipe.expect +++ b/t/chainlint/pipe.expect @@ -2,7 +2,9 @@ foo | bar | baz && + fish | cow ?!AMP?! + sunder ) diff --git a/t/chainlint/subshell-here-doc.expect b/t/chainlint/subshell-here-doc.expect index 5278927..75d6f60 100644 --- a/t/chainlint/subshell-here-doc.expect +++ b/t/chainlint/subshell-here-doc.expect @@ -1,7 +1,7 @@ ( echo wobba \ - gorgo snoot \ - wafta snurb <<-EOF && + gorgo snoot \ + wafta snurb <<-EOF && quoth the raven, nevermore... EOF diff --git a/t/chainlint/subshell-one-liner.expect b/t/chainlint/subshell-one-liner.expect index b701536..8f69499 100644 --- a/t/chainlint/subshell-one-liner.expect +++ b/t/chainlint/subshell-one-liner.expect @@ -2,13 +2,18 @@ (foo && bar) && (foo && bar) | (foo && bar) >baz && + (foo; ?!AMP?! bar) && (foo; ?!AMP?! bar) | (foo; ?!AMP?! bar) >baz && + (foo || exit 1) && (foo || exit 1) | (foo || exit 1) >baz && + (foo && bar) ?!AMP?! + (foo && bar; ?!AMP?! baz) ?!AMP?! + foobar ) diff --git a/t/chainlint/t7900-subtree.expect b/t/chainlint/t7900-subtree.expect index 71b3b3b..02f3129 100644 --- a/t/chainlint/t7900-subtree.expect +++ b/t/chainlint/t7900-subtree.expect @@ -15,6 +15,7 @@ main-sub4" && $chkms TXT ) && + subfiles=$(git ls-files) && check_equal "$subfiles" "$chkms $chks" diff --git a/t/chainlint/token-pasting.expect b/t/chainlint/token-pasting.expect index 342360b..6a38791 100644 --- a/t/chainlint/token-pasting.expect +++ b/t/chainlint/token-pasting.expect @@ -4,22 +4,22 @@ git config filter.rot13.clean ./rot13.sh && { echo "*.t filter=rot13" ?!AMP?! echo "*.i ident" -} > .gitattributes && +} >.gitattributes && { echo a b c d e f g h i j k l m ?!AMP?! echo n o p q r s t u v w x y z ?!AMP?! echo '$Id$' -} > test && -cat test > test.t && -cat test > test.o && -cat test > test.i && +} >test && +cat test >test.t && +cat test >test.o && +cat test >test.i && git add test test.t test.i && rm -f test test.t test.i && git checkout -- test test.t test.i && -echo "content-test2" > test2.o && -echo "content-test3 - filename with special characters" > "test3 'sq',$x=.o" ?!AMP?! +echo "content-test2" >test2.o && +echo "content-test3 - filename with special characters" >"test3 'sq',$x=.o" ?!AMP?! downstream_url_for_sed=$( printf "%sn" "$downstream_url" | diff --git a/t/chainlint/while-loop.expect b/t/chainlint/while-loop.expect index 1f5eaea..06c1567 100644 --- a/t/chainlint/while-loop.expect +++ b/t/chainlint/while-loop.expect @@ -6,6 +6,7 @@ bar EOF done ?!AMP?! + while true; do echo foo && cat bar ?!LOOP?! |