Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 1/3] tests: do not negate test_path_exists
Date: Mon, 15 May 2023 19:26:44 -0700	[thread overview]
Message-ID: <20230516022646.648123-2-gitster@pobox.com> (raw)
In-Reply-To: <20230516022646.648123-1-gitster@pobox.com>

As a way to assert the path 'foo' is missing, "! test_path_exists foo" a
poor way to do so, as the helper is designed to complain when 'foo' is
missing, but the intention of the author who used negated form was to
make sure it does not exist.  This does not help debugging the tests.

Use test_path_is_missing instead, which is a more appropriate helper.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t4067-diff-partial-clone.sh | 4 ++--
 t/t4115-apply-symlink.sh      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/t4067-diff-partial-clone.sh b/t/t4067-diff-partial-clone.sh
index f60f5cbd65..7af3a08862 100755
--- a/t/t4067-diff-partial-clone.sh
+++ b/t/t4067-diff-partial-clone.sh
@@ -151,7 +151,7 @@ test_expect_success 'diff does not fetch anything if inexact rename detection is
 
 	# Ensure no fetches.
 	GIT_TRACE_PACKET="$(pwd)/trace" git -C client diff --raw -M HEAD^ HEAD &&
-	! test_path_exists trace
+	test_path_is_missing trace
 '
 
 test_expect_success 'diff --break-rewrites fetches only if necessary, and batches blobs if it does' '
@@ -171,7 +171,7 @@ test_expect_success 'diff --break-rewrites fetches only if necessary, and batche
 
 	# Ensure no fetches.
 	GIT_TRACE_PACKET="$(pwd)/trace" git -C client diff --raw -M HEAD^ HEAD &&
-	! test_path_exists trace &&
+	test_path_is_missing trace &&
 
 	# But with --break-rewrites, ensure that there is exactly 1 negotiation
 	# by checking that there is only 1 "done" line sent. ("done" marks the
diff --git a/t/t4115-apply-symlink.sh b/t/t4115-apply-symlink.sh
index e95e6d4e7d..a22a90d552 100755
--- a/t/t4115-apply-symlink.sh
+++ b/t/t4115-apply-symlink.sh
@@ -74,7 +74,7 @@ test_expect_success SYMLINKS 'symlink escape when creating new files' '
 	error: affected file ${SQ}renamed-symlink/create-me${SQ} is beyond a symbolic link
 	EOF
 	test_cmp expected_stderr stderr &&
-	! test_path_exists .git/create-me
+	test_path_is_missing .git/create-me
 '
 
 test_expect_success SYMLINKS 'symlink escape when modifying file' '
-- 
2.41.0-rc0


  reply	other threads:[~2023-05-16  2:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16  2:26 [PATCH 0/3] fix use of "! test_path_is_foo" in tests Junio C Hamano
2023-05-16  2:26 ` Junio C Hamano [this message]
2023-05-16  2:53   ` [PATCH 1/3] tests: do not negate test_path_exists Eric Sunshine
2023-05-16 16:10     ` Junio C Hamano
2023-05-16  2:26 ` [PATCH 2/3] t2021: do not negate test_path_is_dir Junio C Hamano
2023-05-16  2:26 ` [PATCH 3/3] test: do not negate test_path_is_* to assert absense Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230516022646.648123-2-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).