Re: [PATCH 1/6] t0080: move expected output to a file
- From
Jeff King <peff@peff.net>
- Date
- Jul 1, 2024, 03:20 UTC
- Message-ID
- <20240701032047.GA610406@coredump.intra.peff.net>
- In-Reply-To
- <c60c78c7-a029-48e8-840a-45dcc785a6e5@web.de>
On Sat, Jun 29, 2024 at 05:35:31PM +0200, René Scharfe wrote:
> Provide the expected output of "test-tool example-tap" verbatim instead > of as a here-doc, to avoid distractions due to quoting, variables > containing quotes and indentation.
I'm not really opposed to this patch, but I wondered...
> test_expect_success 'TAP output from unit tests' ' > - cat >expect <<-EOF && > - ok 1 - passing test > - ok 2 - passing test and assertion return 1
If you could take the test input on stdin, like so:
test_expect_success 'TAP output from unit tests' - <<-\EOT cat >expect <<-\EOF ok 1 - passing test ok 2 - passing test and assertion return 1 [...] # check "'a' == '\n'" failed at t/helper/test-example-tap.c:64 # left: 'a' # right: '\012' [...] EOF EOT
would that be preferable to moving it to its own file? I kind of like keeping everything in the test scripts themselves so related changes can happen side-by-side, though I admit in this case it is intimately tied to the separate test-example-tap.c source anyway.
But I do have such an "EOT" patch which I've been meaning to send out, since it makes many of these quoting annoyances go away (though of course it leaves the indentation).
-Peff