Re: [PATCH 5/8] t9901: fix line-ending dependency on windows
Junio C Hamano <gitster@pobox.com> writes:
Show 37 quoted lines
>Pat Thoyts <patthoyts@users.sourceforge.net> writes:
>
>> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
>> ---
>> t/t9901-git-web--browse.sh | 10 +++++-----
>> 1 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/t/t9901-git-web--browse.sh b/t/t9901-git-web--browse.sh
>> index 7906e5d..1185b42 100755
>> --- a/t/t9901-git-web--browse.sh
>> +++ b/t/t9901-git-web--browse.sh
>> @@ -12,7 +12,7 @@ test_expect_success \
>> echo http://example.com/foo\&bar >expect &&
>> git config browser.custom.cmd echo &&
>> git web--browse --browser=custom \
>> - http://example.com/foo\&bar >actual &&
>> + http://example.com/foo\&bar | tr -d "\r" >actual &&
>> test_cmp expect actual
>> '
>
>This is unnice for two reasons. We have web--browse five times in this
>test script, and you add tr exactly the same way to each and every one of
>them. And you are losing the error condition from each and every one of
>these web--browse invocations.
>
>Having to do the same change to all invocations of the same command
>suggests that perhaps you can and should wrap that pattern into a single
>helper, perhaps like:
>
>test_web_browse () {
> # browser=$1 url=$2
> git web--browse --browser="$1" "$2" >actual &&
> tr -d '\015' <actual >text &&
> test_cmp expect text
>}
>
>or something?OK - The suggested code works fine so I shall re-roll this one shortly.
--
Pat Thoyts http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD