Merge remote-tracking branch 'danielsh/tests-skip-cardinality-v1'
* danielsh/tests-skip-cardinality-v1: tests: Minor documentation readability tweak Add a test for issue #641.5, using the infrastructure added in the previous commits. tests: Skip cardinality tests whenever any test point is expected to fail. tests: Make $expected_mismatch skip the cardinality check, rather than consider it an expected failure. tests: Include the name of the 'cardinality check' test point in the output
This commit is contained in:
@@ -31,8 +31,8 @@ need not match the order in `$region_highlight`.
|
||||
4.
|
||||
Normally, tests fail if `$expected_region_highlight` and `$region_highlight`
|
||||
have different numbers of elements. Tests may set `$expected_mismatch` to an
|
||||
explanation string (like `$todo`) to avoid this and mark the cardinality check
|
||||
as todo.
|
||||
explanation string (like `$todo`) to avoid this and skip the cardinality check.
|
||||
`$expected_mismatch` is set implicitly if the `$todo` component is present.
|
||||
|
||||
**Note**: `$region_highlight` uses the same `"$i $j $style"` syntax but
|
||||
interprets the indexes differently.
|
||||
|
||||
@@ -153,7 +153,10 @@ run_test_internal() {
|
||||
local -a expected_highlight_zone; expected_highlight_zone=( ${(z)expected_region_highlight[i]} )
|
||||
integer exp_start=$expected_highlight_zone[1] exp_end=$expected_highlight_zone[2]
|
||||
local todo=
|
||||
(( $+expected_highlight_zone[4] )) && todo="# TODO $expected_highlight_zone[4]"
|
||||
if (( $+expected_highlight_zone[4] )); then
|
||||
todo="# TODO $expected_highlight_zone[4]"
|
||||
: ${expected_mismatch:="cardinality check disabled whilst regular test points are expected to fail"}
|
||||
fi
|
||||
if ! (( $+region_highlight[i] )); then
|
||||
print -r -- "not ok $i - unmatched expectation ($exp_start $exp_end $expected_highlight_zone[3])" \
|
||||
"${expected_mismatch:+"# TODO ${(qqq)expected_mismatch}"}"
|
||||
@@ -180,14 +183,17 @@ run_test_internal() {
|
||||
unset desc
|
||||
done
|
||||
|
||||
if (( $#expected_region_highlight == $#region_highlight )); then
|
||||
print -r -- "ok $i - cardinality check" "${expected_mismatch:+"# TODO ${(qqq)expected_mismatch}"}"
|
||||
if [[ -n $expected_mismatch ]]; then
|
||||
tap_escape $expected_mismatch; expected_mismatch=$REPLY
|
||||
print "ok $i - cardinality check" "# SKIP $expected_mismatch"
|
||||
elif (( $#expected_region_highlight == $#region_highlight )); then
|
||||
print -r -- "ok $i - cardinality check"
|
||||
else
|
||||
local details
|
||||
details+="have $#expected_region_highlight expectations and $#region_highlight region_highlight entries: "
|
||||
details+="«$(typeset_p expected_region_highlight)» «$(typeset_p region_highlight)»"
|
||||
tap_escape $details; details=$REPLY
|
||||
print -r -- "not ok $i - $details" "${expected_mismatch:+"# TODO ${(qqq)expected_mismatch}"}"
|
||||
print -r -- "not ok $i - cardinality check - $details"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user