git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Denton Liu <liu.denton@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH 2/8] t7408: replace incorrect uses of test_must_fail
Date: Mon, 20 Apr 2020 04:54:40 -0400	[thread overview]
Message-ID: <17db727121925cf0774e95a80ea13bbea8264931.1587372771.git.liu.denton@gmail.com> (raw)
In-Reply-To: <cover.1587372771.git.liu.denton@gmail.com>

According to t/README, test_must_fail() should only be used to test for
failure in Git commands.

Replace the invocation of `test_must_fail test_path_is_file` with
`test_path_is_missing` since, in this test case, the path should not
exist at all.

In all the cases where `test_must_fail test_alternate_is_used` appears,
test_alternate_is_used() fails because test_line_count() cannot open the
non-existent $alternates_file. Replace
`test_must_fail test_alternate_is_used` with `test_path_is_missing` to
test for this directly.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
---
 t/t7408-submodule-reference.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh
index 34ac28c056..a3892f494b 100755
--- a/t/t7408-submodule-reference.sh
+++ b/t/t7408-submodule-reference.sh
@@ -122,8 +122,8 @@ test_expect_success 'missing submodule alternate fails clone and submodule updat
 		# update of the submodule succeeds
 		test_must_fail git submodule update --init &&
 		# and we have no alternates:
-		test_must_fail test_alternate_is_used .git/modules/sub/objects/info/alternates sub &&
-		test_must_fail test_path_is_file sub/file1
+		test_path_is_missing .git/modules/sub/objects/info/alternates &&
+		test_path_is_missing sub/file1
 	)
 '
 
@@ -137,7 +137,7 @@ test_expect_success 'ignoring missing submodule alternates passes clone and subm
 		# update of the submodule succeeds
 		git submodule update --init &&
 		# and we have no alternates:
-		test_must_fail test_alternate_is_used .git/modules/sub/objects/info/alternates sub &&
+		test_path_is_missing .git/modules/sub/objects/info/alternates &&
 		test_path_is_file sub/file1
 	)
 '
@@ -182,7 +182,7 @@ check_that_two_of_three_alternates_are_used() {
 	# immediate submodule has alternate:
 	test_alternate_is_used .git/modules/subwithsub/objects/info/alternates subwithsub &&
 	# but nested submodule has no alternate:
-	test_must_fail test_alternate_is_used .git/modules/subwithsub/modules/sub/objects/info/alternates subwithsub/sub
+	test_path_is_missing .git/modules/subwithsub/modules/sub/objects/info/alternates
 }
 
 
-- 
2.26.0.159.g23e2136ad0


  parent reply	other threads:[~2020-04-20  8:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20  8:54 [PATCH 0/8] t: replace incorrect test_must_fail usage (part 4) Denton Liu
2020-04-20  8:54 ` [PATCH 1/8] t6030: use test_path_is_missing() Denton Liu
2020-04-20  8:54 ` Denton Liu [this message]
2020-04-20  8:54 ` [PATCH 3/8] t7508: don't use `test_must_fail test_cmp` Denton Liu
2020-04-21 20:59   ` Johannes Sixt
2020-04-20  8:54 ` [PATCH 4/8] t9141: use test_path_is_missing() Denton Liu
2020-04-20  8:54 ` [PATCH 5/8] t9160: " Denton Liu
2020-04-20  8:54 ` [PATCH 6/8] t9164: don't use `test_must_fail test_cmp` Denton Liu
2020-04-20 16:21   ` Eric Sunshine
2020-04-20 20:09     ` Junio C Hamano
2020-04-20 20:13       ` Eric Sunshine
2020-04-21 20:16       ` Denton Liu
2020-04-21 20:44         ` Junio C Hamano
2020-04-22  8:54           ` Denton Liu
2020-04-22 15:50             ` Junio C Hamano
2020-04-20  8:54 ` [PATCH 7/8] t9819: don't use test_must_fail with p4 Denton Liu
2020-04-20  8:54 ` [PATCH 8/8] t9902: don't use `test_must_fail __git_*` Denton Liu
2020-04-21 21:16   ` Johannes Sixt
2020-04-22  8:35     ` Denton Liu
2020-04-20 11:49 ` [PATCH 0/8] t: replace incorrect test_must_fail usage (part 4) Derrick Stolee

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=17db727121925cf0774e95a80ea13bbea8264931.1587372771.git.liu.denton@gmail.com \
    --to=liu.denton@gmail.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.
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).