[v2,01/15] t7408: replace `test_must_fail test_path_is_file`
diff mbox series

Message ID 987fee4652ae1bd8d3eb50ed51f7c9694d567dfc.1571435195.git.liu.denton@gmail.com
State New
Headers show
Series
  • t5520: various test cleanup
Related show

Commit Message

Denton Liu Oct. 18, 2019, 10:04 p.m. UTC
According to t/README, test_must_fail() should only be used to test for
failure in git commands. Replace the only 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.

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

Comments

Johannes Sixt Oct. 19, 2019, 11:58 a.m. UTC | #1
Am 19.10.19 um 00:04 schrieb Denton Liu:
> diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh
> index 34ac28c056..9e62d43cac 100755
> --- a/t/t7408-submodule-reference.sh
> +++ b/t/t7408-submodule-reference.sh
> @@ -123,7 +123,7 @@ test_expect_success 'missing submodule alternate fails clone and submodule updat
>  		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 &&

Here's another incorrect use of test_must_fail (not the only instance in
this file). Looks like we would need a "test_alternate_is_not_used" helper.

> -		test_must_fail test_path_is_file sub/file1
> +		test_path_is_missing sub/file1
>  	)
>  '

I suggest to drop this patch; it doesn't fit the theme of this series,
and if you attempt to do it right, you'll quickly find a deep rabbit hole.

-- Hannes

Patch
diff mbox series

diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh
index 34ac28c056..9e62d43cac 100755
--- a/t/t7408-submodule-reference.sh
+++ b/t/t7408-submodule-reference.sh
@@ -123,7 +123,7 @@  test_expect_success 'missing submodule alternate fails clone and submodule updat
 		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 sub/file1
 	)
 '