Skip to content

Commit fd95523

Browse files
committed
test harness: Tweak quiet-test output
- Print the test name and data after the plan line - Split on the plan line rather than on comments + That makes tap-filter more suitable to filter TAP output generated by other TAP producers. + However, the filtered output deletes the plan line and adds a blank line in its stead. This suits our use-case of interactive test runs.
1 parent de67fd3 commit fd95523

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

tests/tap-filter

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@ use strict;
4141
undef $/; # slurp mode
4242
print for
4343
grep { /^ok.*# TODO/m or /^not ok(?!.*# TODO)/m or /^Bail out!/m }
44-
split /^(?=#)/m,
44+
# Split on plan lines and remove them from the output. (To keep them,
45+
# use the lookahead syntax, «(?=…)», to make the match zero-length.)
46+
split /^\d+\.\.\d+$/m,
4547
<STDIN>;

tests/test-highlighting.zsh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ run_test_internal() {
117117
local srcdir="$PWD"
118118
builtin cd -q -- "$tests_tempdir" || { echo >&2 "Bail out! On ${(qq)1}: cd failed: $?"; return 1 }
119119

120-
echo "# ${1:t:r}"
121-
[[ -n $PREBUFFER ]] && printf '# %s\n' "$(typeset_p PREBUFFER)"
122-
[[ -n $BUFFER ]] && printf '# %s\n' "$(typeset_p BUFFER)"
123-
124120
# Load the data and prepare checking it.
125121
local BUFFER CURSOR MARK PENDING PREBUFFER REGION_ACTIVE WIDGET REPLY skip_test unsorted=0
126122
local expected_mismatch
@@ -145,7 +141,12 @@ run_test_internal() {
145141
expected_region_highlight=("${(@n)expected_region_highlight}")
146142
fi
147143

144+
# Print the plan line, and some comments for human readers
148145
echo "1..$(( $#expected_region_highlight + 1))"
146+
echo "## ${1:t:r}"
147+
[[ -n $PREBUFFER ]] && printf '# %s\n' "$(typeset_p PREBUFFER)"
148+
[[ -n $BUFFER ]] && printf '# %s\n' "$(typeset_p BUFFER)"
149+
149150
local i
150151
for ((i=1; i<=$#expected_region_highlight; i++)); do
151152
local -a expected_highlight_zone; expected_highlight_zone=( ${(z)expected_region_highlight[i]} )

0 commit comments

Comments
 (0)