Re: [RFC/PATCH 0/2] here-doc test bodies
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Apr 10, 2021, 01:03 UTC
- Message-ID
- <42b187cb-6417-0353-cf63-c6379be53208@gmail.com>
- In-Reply-To
- <YHDUg6ZR5vu93kGm@coredump.intra.peff.net>
On 4/9/2021 6:26 PM, Jeff King wrote:
Show 9 quoted lines
> I've been wanting to do this for years, but after getting bitten by a > misplaced quote the other day, I finally did. This series allows you to > do: > > test_expect_success <<\EOT > something 'with single quotes' > EOT > > Thoughts?
Odd. I _just_ hit this for the first time today. I didn't know about the $SQ trick, so I just modified my 'sed' call to drop the single quotes from the string I was trying to match [1].
[1] https://lore.kernel.org/git/36aa6837-722c-9ef0-84cc-77e982db9f6e@gmail.com/
I think this is a good pattern for this kind of thing. I imagine that if the test itself needed heredocs, then they would be interpreted correctly when evaluating stdin (as long as a different identifier is used).
I also like the "EOT" pattern as an example.
Thanks, -Stolee