git/t/chainlint/here-doc-double.test
Jeff King 0c7d630220 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>
2024-07-10 10:14:22 -07:00

11 lines
309 B
Plaintext

# 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