Re: [PATCH v2 3/9] t3701: use test_write_lines and write_script
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Feb 19, 2018, 18:47 UTC
- Message-ID
- <CAPig+cRWCd6pYxc8NrOM_ntodgkwwfMpD_tWQXYXOukVWgQfCw@mail.gmail.com>
- In-Reply-To
- <20180219112910.24471-4-phillip.wood@talktalk.net>
On Mon, Feb 19, 2018 at 6:29 AM, Phillip Wood <phillip.wood@talktalk.net> wrote:
Show 21 quoted lines
> From: Phillip Wood <phillip.wood@dunelm.org.uk> > > Simplify things slightly by using the above helpers. > > Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> > --- > diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh > @@ -87,13 +87,8 @@ test_expect_success 'setup expected' ' > @@ -110,13 +105,12 @@ test_expect_success 'setup patch' ' > test_expect_success 'setup fake editor' ' > - echo "#!$SHELL_PATH" >fake_editor.sh && > - cat >>fake_editor.sh <<-\EOF && > + FAKE_EDITOR="$(pwd)/fake-editor.sh" && > + write_script "$FAKE_EDITOR" <<-\EOF && > mv -f "$1" oldpatch && > mv -f patch "$1" > EOF > - chmod a+x fake_editor.sh && > - test_set_editor "$(pwd)/fake_editor.sh" > + test_set_editor "$FAKE_EDITOR" > '
The very first thing that test_set_editor() does is set FAKE_EDITOR to the value of $1, so it is confusing to see it getting setting it here first; the reader has to spend extra brain cycles wondering if something non-obvious is going on that requires this manual assignment. Perhaps drop the assignment altogether and just write literal "fake_editor.sh" in the couple places it's needed (as was done in the original code)?