Re: [PATCH 5/8] t9901: fix line-ending dependency on windows
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:16
Pat Thoyts [off-list ref] writes:
quoted hunk
Signed-off-by: Pat Thoyts <redacted> --- 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?