]> git.ipfire.org Git - thirdparty/git.git/commit
chainlint.pl: add tests for test body in heredoc
authorJeff King <peff@peff.net>
Wed, 10 Jul 2024 08:39:16 +0000 (04:39 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 10 Jul 2024 17:14:22 +0000 (10:14 -0700)
commit0c7d630220ee4df65db653300d236ac9f65be0b3
tree38778297e8dbf90e081d86c920c48f8b2c2e74ec
parenta4a5f282f58f16a472ec2b08f5dc06ee149a9700
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>
t/chainlint/here-doc-body-indent.expect [new file with mode: 0644]
t/chainlint/here-doc-body-indent.test [new file with mode: 0644]
t/chainlint/here-doc-body-pathological.expect [new file with mode: 0644]
t/chainlint/here-doc-body-pathological.test [new file with mode: 0644]
t/chainlint/here-doc-body.expect [new file with mode: 0644]
t/chainlint/here-doc-body.test [new file with mode: 0644]
t/chainlint/here-doc-double.expect [new file with mode: 0644]
t/chainlint/here-doc-double.test [new file with mode: 0644]