From 864864442ec48746a91283a9154d38ef39198607 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 29 Dec 2018 11:31:18 +0000 Subject: [PATCH] tests: Allow marking the cardinality check as TODO (XFail). Needed for next commit. --- tests/README.md | 5 +++++ tests/test-highlighting.zsh | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/README.md b/tests/README.md index 8487b3c..2d87204 100644 --- a/tests/README.md +++ b/tests/README.md @@ -21,6 +21,11 @@ with the provided string as the reason. If a test sets `unsorted=1` the order of highlights in `$expected_region_highlight` need not match the order in `$region_highlight`. +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. + **Note**: `$region_highlight` uses the same `"$i $j $style"` syntax but interprets the indexes differently. diff --git a/tests/test-highlighting.zsh b/tests/test-highlighting.zsh index 812b1a7..2498dee 100755 --- a/tests/test-highlighting.zsh +++ b/tests/test-highlighting.zsh @@ -98,6 +98,7 @@ run_test_internal() { # Load the data and prepare checking it. local BUFFER CURSOR MARK PENDING PREBUFFER REGION_ACTIVE WIDGET skip_test unsorted=0 + local expected_mismatch local -a expected_region_highlight region_highlight . "$srcdir"/"$1" @@ -154,7 +155,7 @@ run_test_internal() { if (( $#expected_region_highlight == $#region_highlight )); then print -r -- "ok $i - cardinality check" else - print -r -- "not ok $i - have $#expected_region_highlight expectations and $#region_highlight region_highlight entries" + print -r -- "not ok $i - have $#expected_region_highlight expectations and $#region_highlight region_highlight entries: «$(typeset -p expected_region_highlight)» «$(typeset -p region_highlight)»" "${expected_mismatch:+" # TODO : $expected_mismatch"}" fi }