зеркало из https://github.com/microsoft/git.git
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: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
d81345ce09
Коммит
e66adcadfe
|
@ -24,16 +24,15 @@ prompt_given ()
|
||||||
}
|
}
|
||||||
|
|
||||||
test_expect_success 'basic usage requires no repo' '
|
test_expect_success 'basic usage requires no repo' '
|
||||||
lines=$(git difftool -h | grep ^usage: | wc -l) &&
|
test_expect_code 129 git difftool -h >output &&
|
||||||
test "$lines" -eq 1 &&
|
grep ^usage: output &&
|
||||||
# create a ceiling directory to prevent Git from finding a repo
|
# create a ceiling directory to prevent Git from finding a repo
|
||||||
mkdir -p not/repo &&
|
mkdir -p not/repo &&
|
||||||
ceiling="$PWD/not" &&
|
test_when_finished rm -r not &&
|
||||||
lines=$(cd not/repo &&
|
test_expect_code 129 \
|
||||||
GIT_CEILING_DIRECTORIES="$ceiling" git difftool -h |
|
env GIT_CEILING_DIRECTORIES="$(pwd)/not" \
|
||||||
grep ^usage: | wc -l) &&
|
git -C not/repo difftool -h >output &&
|
||||||
test "$lines" -eq 1 &&
|
grep ^usage: output
|
||||||
rmdir -p not/repo
|
|
||||||
'
|
'
|
||||||
|
|
||||||
# Create a file on master and change it on branch
|
# Create a file on master and change it on branch
|
||||||
|
|
Загрузка…
Ссылка в новой задаче