aboutsummaryrefslogtreecommitdiffstats
path: root/t/chainlint/here-doc-double.test
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2024-07-10 04:39:16 -0400
committerJunio C Hamano <gitster@pobox.com>2024-07-10 10:14:22 -0700
commit0c7d630220ee4df65db653300d236ac9f65be0b3 (patch)
tree38778297e8dbf90e081d86c920c48f8b2c2e74ec /t/chainlint/here-doc-double.test
parenta4a5f282f58f16a472ec2b08f5dc06ee149a9700 (diff)
downloadgit-0c7d630220ee4df65db653300d236ac9f65be0b3.tar.gz
chainlint.pl: add tests for test body in heredoc
The chainlint.pl script recently learned about the upcoming: test_expect_success 'some test' - <<\EOT TEST_BODY EOT syntax, where TEST_BODY should be checked in the usual way. Let's make sure this works by adding a few tests. The "here-doc-body" file tests the basic syntax, including an embedded here-doc which we should still be able to recognize. Likewise the "here-doc-body-indent" checks the same thing, but using the "<<-" operator. We wouldn't expect this to be used normally, but we would not want to accidentally miss a body that uses it. The "pathological" variant checks the opposite: we don't get confused by an indented tag within the here-doc body. The "here-doc-double" tests the handling of two here-doc tags on the same line. This is not something we'd expect anybody to do in practice, but the code was written defensively to handle this, so let's make sure it works. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/chainlint/here-doc-double.test')
-rw-r--r--t/chainlint/here-doc-double.test10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/chainlint/here-doc-double.test b/t/chainlint/here-doc-double.test
new file mode 100644
index 0000000000..777389f0d9
--- /dev/null
+++ b/t/chainlint/here-doc-double.test
@@ -0,0 +1,10 @@
+# This is obviously a ridiculous thing to do, but we should be able
+# to handle two here-docs on the same line, and attribute them
+# correctly.
+test_expect_success "$(cat <<END_OF_PREREQS)" 'here-doc-double' - <<\EOT
+SOME
+PREREQS
+END_OF_PREREQS
+ echo "actual test commands"
+ echo "that should be checked"
+EOT