Re: [PATCH 06/19] t6300: make `%(raw:size) --shell` test more robust
- From
Jeff King <peff@peff.net>
- Date
- Dec 10, 2021, 09:14 UTC
- Message-ID
- <YbMaadyT+YmZeGlB@coredump.intra.peff.net>
- In-Reply-To
- <20211209051115.52629-7-sunshine@sunshineco.com>
On Thu, Dec 09, 2021 at 12:11:02AM -0500, Eric Sunshine wrote:
Show 5 quoted lines
> This test populates its `expect` file solely by appending content but > fails to ensure that the file starts out empty. The test succeeds only > because no earlier test populated a file of the exact same name, however > this is an accident waiting to happen. Make the test more robust by > ensuring that it contains exactly the intended content.
Agreed.
> While at it, simplify the implementation via a straightforward `sed` > application and by avoiding dropping out of the single-quote context > within the test body (thus eliminating a hard-to-digest combination of > apostrophes and backslashes).
I find them equally ugly. :) The most confusing thing is that we are not doing any shell quoting at all, just adding single-quote wrappers. But that is OK because %(raw:size) should never need quoting.
Your solution seems fine to me.
-Peff