diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2021-12-13 01:30:57 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-13 14:15:29 -0800 |
commit | 34ba05c2966f9e96b74ea984251e3bda802d6a7a (patch) | |
tree | 4c50e731fb7f441242b6d6b5a4f8582889450d6f /t/chainlint | |
parent | chainlint.sed: don't mistake `<< word` in string as here-doc operator (diff) | |
download | tgif-34ba05c2966f9e96b74ea984251e3bda802d6a7a.tar.xz |
chainlint.sed: stop throwing away here-doc tags
The purpose of chainlint is to highlight problems it finds in test code
by inserting annotations at the location of each problem. Arbitrarily
eliding bits of the code it is checking is not helpful, yet this is
exactly what chainlint.sed does by cavalierly and unnecessarily dropping
the here-doc operator and tag; i.e. `cat <<TAG` becomes simply `cat` in
the output. This behavior can make it more difficult for the test writer
to align the annotated output of chainlint.sed with the original test
code. Address this by retaining here-doc tags.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/chainlint')
-rw-r--r-- | t/chainlint/for-loop.expect | 2 | ||||
-rw-r--r-- | t/chainlint/here-doc-close-subshell.expect | 2 | ||||
-rw-r--r-- | t/chainlint/here-doc-multi-line-command-subst.expect | 2 | ||||
-rw-r--r-- | t/chainlint/here-doc-multi-line-string.expect | 2 | ||||
-rw-r--r-- | t/chainlint/here-doc.expect | 8 | ||||
-rw-r--r-- | t/chainlint/if-then-else.expect | 2 | ||||
-rw-r--r-- | t/chainlint/nested-here-doc.expect | 6 | ||||
-rw-r--r-- | t/chainlint/subshell-here-doc.expect | 10 | ||||
-rw-r--r-- | t/chainlint/t7900-subtree.expect | 4 | ||||
-rw-r--r-- | t/chainlint/while-loop.expect | 2 |
10 files changed, 20 insertions, 20 deletions
diff --git a/t/chainlint/for-loop.expect b/t/chainlint/for-loop.expect index b74df064c5..6671b8cd84 100644 --- a/t/chainlint/for-loop.expect +++ b/t/chainlint/for-loop.expect @@ -2,7 +2,7 @@ for i in a b c do echo $i ?!AMP?! - cat + cat <<-EOF done ?!AMP?! for i in a b c; do echo $i && diff --git a/t/chainlint/here-doc-close-subshell.expect b/t/chainlint/here-doc-close-subshell.expect index e748526570..2af9ced71c 100644 --- a/t/chainlint/here-doc-close-subshell.expect +++ b/t/chainlint/here-doc-close-subshell.expect @@ -1,2 +1,2 @@ ( - cat) + cat <<-INPUT) diff --git a/t/chainlint/here-doc-multi-line-command-subst.expect b/t/chainlint/here-doc-multi-line-command-subst.expect index f1248f8ade..f8b3aa73c4 100644 --- a/t/chainlint/here-doc-multi-line-command-subst.expect +++ b/t/chainlint/here-doc-multi-line-command-subst.expect @@ -1,5 +1,5 @@ ( - x=$(bobble && + x=$(bobble <<-END && wiffle) ?!AMP?! echo $x ) diff --git a/t/chainlint/here-doc-multi-line-string.expect b/t/chainlint/here-doc-multi-line-string.expect index 7e883b252e..2578191ca8 100644 --- a/t/chainlint/here-doc-multi-line-string.expect +++ b/t/chainlint/here-doc-multi-line-string.expect @@ -1,4 +1,4 @@ ( - cat && echo "multi-line string" ?!AMP?! + cat <<-TXT && echo "multi-line string" ?!AMP?! bap ) diff --git a/t/chainlint/here-doc.expect b/t/chainlint/here-doc.expect index 8449eb2e02..110059ba58 100644 --- a/t/chainlint/here-doc.expect +++ b/t/chainlint/here-doc.expect @@ -1,7 +1,7 @@ -boodle wobba gorgo snoot wafta snurb && +boodle wobba gorgo snoot wafta snurb <<EOF && -cat >foo && +cat <<-Arbitrary_Tag_42 >foo && -cat >boo && +cat <<zump >boo && -horticulture +horticulture <<EOF diff --git a/t/chainlint/if-then-else.expect b/t/chainlint/if-then-else.expect index debcf7b756..44d86c3597 100644 --- a/t/chainlint/if-then-else.expect +++ b/t/chainlint/if-then-else.expect @@ -8,7 +8,7 @@ echo foo else echo foo && - cat + cat <<-EOF fi ?!AMP?! echo poodle ) && diff --git a/t/chainlint/nested-here-doc.expect b/t/chainlint/nested-here-doc.expect index 2a51205d32..e3bef63f75 100644 --- a/t/chainlint/nested-here-doc.expect +++ b/t/chainlint/nested-here-doc.expect @@ -1,7 +1,7 @@ -cat >foop && +cat <<ARBITRARY >foop && ( - cat && - cat ?!AMP?! + cat <<-INPUT_END && + cat <<-EOT ?!AMP?! foobar ) diff --git a/t/chainlint/subshell-here-doc.expect b/t/chainlint/subshell-here-doc.expect index b7250ca753..029d129299 100644 --- a/t/chainlint/subshell-here-doc.expect +++ b/t/chainlint/subshell-here-doc.expect @@ -1,10 +1,10 @@ ( - echo wobba gorgo snoot wafta snurb && - cat >bip ?!AMP?! - echo >bop + echo wobba gorgo snoot wafta snurb <<-EOF && + cat <<EOF >bip ?!AMP?! + echo <<-EOF >bop ) && ( - cat >bup && - cat >bup3 && + cat <<-ARBITRARY >bup && + cat <<-ARBITRARY3 >bup3 && meep ) diff --git a/t/chainlint/t7900-subtree.expect b/t/chainlint/t7900-subtree.expect index 215aca01c2..1cccc7bf7e 100644 --- a/t/chainlint/t7900-subtree.expect +++ b/t/chainlint/t7900-subtree.expect @@ -1,9 +1,9 @@ ( chks="sub1sub2sub3sub4" && - chks_sub=$(cat | sed "s,^,sub dir/," + chks_sub=$(cat <<TXT | sed "s,^,sub dir/," ) && chkms="main-sub1main-sub2main-sub3main-sub4" && - chkms_sub=$(cat | sed "s,^,sub dir/," + chkms_sub=$(cat <<TXT | sed "s,^,sub dir/," ) && subfiles=$(git ls-files) && check_equal "$subfiles" "$chkms$chks" diff --git a/t/chainlint/while-loop.expect b/t/chainlint/while-loop.expect index e2813b378e..0d3a9b3d12 100644 --- a/t/chainlint/while-loop.expect +++ b/t/chainlint/while-loop.expect @@ -2,7 +2,7 @@ while true do echo foo ?!AMP?! - cat + cat <<-EOF done ?!AMP?! while true; do echo foo && |