summary refs log tree commit diff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-03-30 18:01:11 -0700
committerJunio C Hamano <gitster@pobox.com>2022-03-30 18:01:11 -0700
commit53747016a662af5c04b3ed3beadd21d5dffd8682 (patch)
treeabdb405f4b8007d9de01c8f1717dfc2119209953 /t
parenta5bf611cc4f14f062cd74965deafe617048bff05 (diff)
parentbbfbcd25b39e9020ce98467cfcf60dfce7e9b484 (diff)
Merge branch 'ab/test-tap-fix-for-immediate'
Fix test framework a bit.

* ab/test-tap-fix-for-immediate:
  test-lib: have --immediate emit valid TAP on failure
Diffstat (limited to 't')
-rwxr-xr-xt/t0000-basic.sh13
-rw-r--r--t/test-lib.sh6
2 files changed, 18 insertions, 1 deletions
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 9dcbf518a7..17a268ccd1 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -101,6 +101,19 @@ test_expect_success 'subtest: 2/3 tests passing' '
 	EOF
 '
 
+test_expect_success 'subtest: --immediate' '
+	run_sub_test_lib_test_err partial-pass \
+		--immediate &&
+	check_sub_test_lib_test_err partial-pass \
+		<<-\EOF_OUT 3<<-EOF_ERR
+	> ok 1 - passing test #1
+	> not ok 2 - failing test #2
+	> #	false
+	> 1..2
+	EOF_OUT
+	EOF_ERR
+'
+
 test_expect_success 'subtest: a failing TODO test' '
 	write_and_run_sub_test_lib_test failing-todo <<-\EOF &&
 	test_expect_success "passing test" "true"
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 515b1af7ed..4373f7d70b 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -806,7 +806,11 @@ test_failure_ () {
 	say_color error "not ok $test_count - $1"
 	shift
 	printf '%s\n' "$*" | sed -e 's/^/#	/'
-	test "$immediate" = "" || _error_exit
+	if test -n "$immediate"
+	then
+		say_color error "1..$test_count"
+		_error_exit
+	fi
 }
 
 test_known_broken_ok_ () {