Skip to content

Commit 4cf795b

Browse files
Denton-Lgitster
authored andcommitted
t7408: replace incorrect uses of test_must_fail
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 085ba9b commit 4cf795b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

t/t7408-submodule-reference.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ test_expect_success 'missing submodule alternate fails clone and submodule updat
122122
# update of the submodule succeeds
123123
test_must_fail git submodule update --init &&
124124
# and we have no alternates:
125-
test_must_fail test_alternate_is_used .git/modules/sub/objects/info/alternates sub &&
126-
test_must_fail test_path_is_file sub/file1
125+
test_path_is_missing .git/modules/sub/objects/info/alternates &&
126+
test_path_is_missing sub/file1
127127
)
128128
'
129129

@@ -137,7 +137,7 @@ test_expect_success 'ignoring missing submodule alternates passes clone and subm
137137
# update of the submodule succeeds
138138
git submodule update --init &&
139139
# and we have no alternates:
140-
test_must_fail test_alternate_is_used .git/modules/sub/objects/info/alternates sub &&
140+
test_path_is_missing .git/modules/sub/objects/info/alternates &&
141141
test_path_is_file sub/file1
142142
)
143143
'
@@ -182,7 +182,7 @@ check_that_two_of_three_alternates_are_used() {
182182
# immediate submodule has alternate:
183183
test_alternate_is_used .git/modules/subwithsub/objects/info/alternates subwithsub &&
184184
# but nested submodule has no alternate:
185-
test_must_fail test_alternate_is_used .git/modules/subwithsub/modules/sub/objects/info/alternates subwithsub/sub
185+
test_path_is_missing .git/modules/subwithsub/modules/sub/objects/info/alternates
186186
}
187187

188188

0 commit comments

Comments
 (0)