Re: [PATCH v2 3/9] t3701: use test_write_lines and write_script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 19, 2018 at 6:29 AM, Phillip Wood <phillip.wood@xxxxxxxxxxxx> wrote:
> From: Phillip Wood <phillip.wood@xxxxxxxxxxxxx>
>
> Simplify things slightly by using the above helpers.
>
> Signed-off-by: Phillip Wood <phillip.wood@xxxxxxxxxxxxx>
> ---
> 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)?



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux