[PATCH 7/7] sparse tests: convert a TODO test to use "test_expect_todo"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Change a test that used "test_expect_success" before 49fdd51a235 (add:
skip tracked paths outside sparse-checkout cone, 2021-09-24) to use
"test_expect_todo" instead.

Now we'll test for the exact current behavior, while documenting what
behavior we'd like to get instead.

This test is a good example of the sort of cases where we benefit most
from "test_expect_todo". In 49fdd51a235 the only change here (aside
from the "NEEDSWORK" comment) was changing "test_expect_success" to
"test_expect_failure".

We thus lost test coverage, and would not have noticed if we failed in
some unexpected place in this rather large test (it's 30 lines of
setup before getting to the "NEEDSWORK" comment). Now we can get the
test coverage back, while documenting what is and isn't desired
behavior.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 t/t1091-sparse-checkout-builtin.sh | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh
index 9a900310186..23973bc186b 100755
--- a/t/t1091-sparse-checkout-builtin.sh
+++ b/t/t1091-sparse-checkout-builtin.sh
@@ -467,7 +467,7 @@ test_expect_success 'sparse-checkout (init|set|disable) warns with unmerged stat
 	git -C unmerged sparse-checkout disable
 '
 
-test_expect_failure 'sparse-checkout reapply' '
+test_expect_todo 'sparse-checkout reapply' '
 	git clone repo tweak &&
 
 	echo dirty >tweak/deep/deeper2/a &&
@@ -501,11 +501,18 @@ test_expect_failure 'sparse-checkout reapply' '
 
 	# NEEDSWORK: We are asking to update a file outside of the
 	# sparse-checkout cone, but this is no longer allowed.
-	git -C tweak add folder1/a &&
+	test_todo test_expect_code \
+		--want 0 \
+		--expect 1 \
+		-- \
+		git -C tweak add folder1/a &&
 	git -C tweak sparse-checkout reapply 2>err &&
-	test_must_be_empty err &&
-	test_path_is_missing tweak/deep/deeper2/a &&
-	test_path_is_missing tweak/folder1/a &&
+	test_todo \
+		--want test_must_be_empty \
+		--expect "grep warning:.*paths.*unmerged" \
+		-- err &&
+	todo_test_path is_file is_missing tweak/deep/deeper2/a &&
+	todo_test_path is_missing is_file tweak/folder1/a &&
 
 	git -C tweak sparse-checkout disable
 '
-- 
2.35.1.1436.g756b814e59f




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux