Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2019-11-26 22:46:07 +0300
committerJunio C Hamano <gitster@pobox.com>2019-11-27 05:32:07 +0300
commit213dabf49dc53ae5808efbdebf0cd2bfc2c1bfa8 (patch)
tree81dc603474b3678c33834754529f1df186b7c89e /t/t1506-rev-parse-diagnosis.sh
parentc93a5aaec859f93ff24277269e2fdef00c9c45e6 (diff)
test: use test_must_be_empty F instead of test -z $(cat F)
Use test_must_be_empty instead of reading the file and comparing its contents to an empty string. That's more efficient, as the function only needs built-in meta-data only check in the usual case, and provides nicer debug output otherwise. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1506-rev-parse-diagnosis.sh')
-rwxr-xr-xt/t1506-rev-parse-diagnosis.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh
index 624d0a588f..6d951ca015 100755
--- a/t/t1506-rev-parse-diagnosis.sh
+++ b/t/t1506-rev-parse-diagnosis.sh
@@ -138,10 +138,10 @@ test_expect_success 'incorrect file in :path and :N:path' '
test_expect_success 'invalid @{n} reference' '
test_must_fail git rev-parse master@{99999} >output 2>error &&
- test -z "$(cat output)" &&
+ test_must_be_empty output &&
grep "fatal: Log for [^ ]* only has [0-9][0-9]* entries." error &&
test_must_fail git rev-parse --verify master@{99999} >output 2>error &&
- test -z "$(cat output)" &&
+ test_must_be_empty output &&
grep "fatal: Log for [^ ]* only has [0-9][0-9]* entries." error
'
@@ -155,13 +155,13 @@ test_expect_success 'relative path not found' '
test_expect_success 'relative path outside worktree' '
test_must_fail git rev-parse HEAD:../file.txt >output 2>error &&
- test -z "$(cat output)" &&
+ test_must_be_empty output &&
test_i18ngrep "outside repository" error
'
test_expect_success 'relative path when cwd is outside worktree' '
test_must_fail git --git-dir=.git --work-tree=subdir rev-parse HEAD:./file.txt >output 2>error &&
- test -z "$(cat output)" &&
+ test_must_be_empty output &&
grep "relative path syntax can.t be used outside working tree." error
'