Re: [PATCH v2 3/9] t3701: use test_write_lines and write_script
From: Eric Sunshine <hidden>
Date: 2018-02-19 18:47:22
On Mon, Feb 19, 2018 at 6:29 AM, Phillip Wood [off-list ref] wrote:
quoted hunk ↗ jump to hunk
From: Phillip Wood <redacted> Simplify things slightly by using the above helpers. Signed-off-by: Phillip Wood <redacted> ---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)?