@@ -120,6 +120,7 @@ run_test_internal() {
120120 # Load the data and prepare checking it.
121121 local BUFFER CURSOR MARK PENDING PREBUFFER REGION_ACTIVE WIDGET REPLY skip_test unsorted=0
122122 local expected_mismatch
123+ local skip_mismatch
123124 local -a expected_region_highlight region_highlight
124125
125126 . " $srcdir " /" $1 "
@@ -155,11 +156,11 @@ run_test_internal() {
155156 local todo=
156157 if (( $+ expected_highlight_zone[4 ] )) ; then
157158 todo=" # TODO $expected_highlight_zone [4]"
158- : ${expected_mismatch : =" cardinality check disabled whilst regular test points are expected to fail" }
159+ skip_mismatch =" cardinality check disabled whilst regular test points are expected to fail"
159160 fi
160161 if ! (( $+ region_highlight[i] )) ; then
161162 print -r -- " not ok $i - unmatched expectation ($exp_start $exp_end $expected_highlight_zone [3])" \
162- " ${expected_mismatch : +" # TODO ${(qqq)expected_mismatch } " } "
163+ " ${skip_mismatch : +" # TODO ${(qqq)skip_mismatch } " } "
163164 continue
164165 fi
165166 local -a highlight_zone; highlight_zone=( ${(z)region_highlight[i]} )
@@ -183,18 +184,27 @@ run_test_internal() {
183184 unset desc
184185 done
185186
186- if [[ -n $expected_mismatch ]]; then
187- tap_escape $expected_mismatch ; expected_mismatch=$REPLY
188- print " ok $i - cardinality check" " # SKIP $expected_mismatch "
187+ # If both $skip_mismatch and $expected_mismatch are set, that means the test
188+ # has some XFail test points, _and_ explicitly sets $expected_mismatch as
189+ # well. Explicit settings should have priority, so we ignore $skip_mismatch
190+ # if $expected_mismatch is set.
191+ if [[ -n $skip_mismatch && -z $expected_mismatch ]]; then
192+ tap_escape $skip_mismatch ; skip_mismatch=$REPLY
193+ print " ok $i - cardinality check" " # SKIP $skip_mismatch "
189194 else
195+ local todo
196+ if [[ -n $expected_mismatch ]]; then
197+ tap_escape $expected_mismatch ; expected_mismatch=$REPLY
198+ todo=" # TODO $expected_mismatch "
199+ fi
190200 if (( $# expected_region_highlight == $# region_highlight )) ; then
191- print -r -- " ok $i - cardinality check"
201+ print -r -- " ok $i - cardinality check${todo : + - } $todo "
192202 else
193203 local details
194204 details+=" have $# expected_region_highlight expectations and $# region_highlight region_highlight entries: "
195205 details+=" «$( typeset_p expected_region_highlight) » «$( typeset_p region_highlight) »"
196206 tap_escape $details ; details=$REPLY
197- print -r -- " not ok $i - cardinality check - $details "
207+ print -r -- " not ok $i - cardinality check - $details ${todo : + - } $todo "
198208 fi
199209 fi
200210}
0 commit comments