Re: [PATCH v4 1/8] t5504: modernize test by moving heredocs into test bodies
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jan 31, 2025, 14:28 UTC
- Message-ID
- <CAPig+cRnm9z06YsCRyTJGqTCF_208BuD+3QoEKqwO7eWTfesAw@mail.gmail.com>
- In-Reply-To
- <20250131-pks-push-atomic-respect-exit-code-v4-1-a8b41f01a676@pks.im>
On Fri, Jan 31, 2025 at 5:53 AM Patrick Steinhardt <ps@pks.im> wrote:
Show 21 quoted lines
> We have several heredocs in t5504 located outside of any particular test > bodies. Move these into the test bodies to match our modern coding > style. > > Signed-off-by: Patrick Steinhardt <ps@pks.im> > --- > diff --git a/t/t5504-fetch-receive-strict.sh b/t/t5504-fetch-receive-strict.sh > @@ -64,12 +64,6 @@ test_expect_success 'fetch with transfer.fsckobjects' ' > -cat >exp <<EOF > -To dst > -! refs/heads/main:refs/heads/test [remote rejected] (missing necessary objects) > -Done > -EOF > - > test_expect_success 'push without strict' ' > @@ -78,6 +72,11 @@ test_expect_success 'push without strict' ' > + cat >exp <<-EOF && > + To dst > + ! refs/heads/main:refs/heads/test [remote rejected] (missing necessary objects) > + Done > + EOF
It's minor, but to make this conform to modern style even more, it would use `\EOF` rather than `EOF`.
(Probably not worth a reroll on its own.)
Show 12 quoted lines
> @@ -94,11 +93,6 @@ test_expect_success 'push with !receive.fsckobjects' ' > -cat >exp <<EOF > -To dst > -! refs/heads/main:refs/heads/test [remote rejected] (unpacker error) > -EOF > - > test_expect_success 'push with receive.fsckobjects' ' > @@ -107,6 +101,10 @@ test_expect_success 'push with receive.fsckobjects' ' > + cat >exp <<-EOF && > + To dst > + ! refs/heads/main:refs/heads/test [remote rejected] (unpacker error) > + EOF
Ditto.
Show 17 quoted lines
> @@ -129,15 +127,14 @@ test_expect_success 'repair the "corrupt or missing" object' ' > -cat >bogus-commit <<EOF > -tree $EMPTY_TREE > -author Bugs Bunny 1234567890 +0000 > -committer Bugs Bunny <bugs@bun.ni> 1234567890 +0000 > - > -This commit object intentionally broken > -EOF > - > test_expect_success 'setup bogus commit' ' > + cat >bogus-commit <<-EOF && > + tree $EMPTY_TREE > + author Bugs Bunny 1234567890 +0000 > + committer Bugs Bunny <bugs@bun.ni> 1234567890 +0000 > + > + This commit object intentionally broken > + EOF
This one is correctly using `EOF` since it's interpolating variables.