Skip to content

Commit 2b3638a

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 3414c7c commit 2b3638a

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
@@ -122,10 +122,6 @@ run_test_internal() {
122122
local expected_mismatch
123123
local -a expected_region_highlight region_highlight
124124

125-
echo "# ${1:t:r}"
126-
[[ -n $PREBUFFER ]] && printf '# %s\n' "$(typeset_p PREBUFFER)"
127-
[[ -n $BUFFER ]] && printf '# %s\n' "$(typeset_p BUFFER)"
128-
129125
. "$srcdir"/"$1"
130126

131127
(( $#skip_test )) && { print -r -- "1..0 # SKIP $skip_test"; return; }
@@ -146,7 +142,12 @@ run_test_internal() {
146142
expected_region_highlight=("${(@n)expected_region_highlight}")
147143
fi
148144

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

0 commit comments

Comments
 (0)