提交 e66adcad 编写于 作者: D David Aguilar 提交者: Junio C Hamano

t7800: simplify basic usage test

Use "test_line_count" instead of "wc -l", use "git -C" instead of a
subshell, and use test_expect_code when calling difftool.  Ease
debugging by capturing output into temporary files.
Suggested-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: NDavid Aguilar <davvid@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 d81345ce
......@@ -24,16 +24,15 @@ prompt_given ()
}
test_expect_success 'basic usage requires no repo' '
lines=$(git difftool -h | grep ^usage: | wc -l) &&
test "$lines" -eq 1 &&
test_expect_code 129 git difftool -h >output &&
grep ^usage: output &&
# create a ceiling directory to prevent Git from finding a repo
mkdir -p not/repo &&
ceiling="$PWD/not" &&
lines=$(cd not/repo &&
GIT_CEILING_DIRECTORIES="$ceiling" git difftool -h |
grep ^usage: | wc -l) &&
test "$lines" -eq 1 &&
rmdir -p not/repo
test_when_finished rm -r not &&
test_expect_code 129 \
env GIT_CEILING_DIRECTORIES="$(pwd)/not" \
git -C not/repo difftool -h >output &&
grep ^usage: output
'
# Create a file on master and change it on branch
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册