git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t1400: use test_must_be_empty
@ 2019-11-26 19:41 René Scharfe
  0 siblings, 0 replies; only message in thread
From: René Scharfe @ 2019-11-26 19:41 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Kyle Meyer

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>
---
 t/t1400-update-ref.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 1fbd940408..ae8e2fcf3b 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -378,13 +378,13 @@ test_expect_success 'Query "master@{May 26 2005 23:32:00}" (exactly history star
 	test_when_finished "rm -f o e" &&
 	git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e &&
 	test $C = $(cat o) &&
-	test "" = "$(cat e)"
+	test_must_be_empty e
 '
 test_expect_success 'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' '
 	test_when_finished "rm -f o e" &&
 	git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e &&
 	test $A = $(cat o) &&
-	test "" = "$(cat e)"
+	test_must_be_empty e
 '
 test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' '
 	test_when_finished "rm -f o e" &&
@@ -396,13 +396,13 @@ test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' '
 	test_when_finished "rm -f o e" &&
 	git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e &&
 	test $Z = $(cat o) &&
-	test "" = "$(cat e)"
+	test_must_be_empty e
 '
 test_expect_success 'Query "master@{2005-05-26 23:43:00}" (exact end of history)' '
 	test_when_finished "rm -f o e" &&
 	git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e &&
 	test $E = $(cat o) &&
-	test "" = "$(cat e)"
+	test_must_be_empty e
 '
 test_expect_success 'Query "master@{2005-05-28}" (past end of history)' '
 	test_when_finished "rm -f o e" &&
--
2.24.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-26 19:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-26 19:41 [PATCH] t1400: use test_must_be_empty René Scharfe

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).