Skip to content

Commit f4d37b7

Browse files
committed
tests: Add ability to skip tests
1 parent 4bd3073 commit f4d37b7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

tests/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ that is, `$i` and `$j` specify a range, 1-indexed, inclusive of both endpoints.
1717
highlighting should be observed.
1818
If `$todo` exists, the test point is marked as TODO (the failure of that test
1919
point will not fail the test), and `$todo` is used as the explanation.
20+
If a test sets `$skip_test` to a non-empty string, the test will be skipped
21+
with the provided string as the reason.
2022

2123
**Note**: `$region_highlight` uses the same `"$i $j $style"` syntax but
2224
interprets the indexes differently.

tests/test-highlighting.zsh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@ run_test_internal() {
9797
echo "# ${1:t:r}"
9898

9999
# Load the data and prepare checking it.
100-
local BUFFER CURSOR MARK PENDING PREBUFFER REGION_ACTIVE WIDGET
100+
local BUFFER CURSOR MARK PENDING PREBUFFER REGION_ACTIVE WIDGET skip_test
101101
local -a expected_region_highlight region_highlight
102102
. "$srcdir"/"$1"
103103

104+
(( $#skip_test )) && { print -r -- "1..0 # SKIP $skip_test"; return; }
105+
104106
# Check the data declares $PREBUFFER or $BUFFER.
105107
[[ -z $PREBUFFER && -z $BUFFER ]] && { echo >&2 "Bail out! Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank"; return 1; }
106108
# Check the data declares $expected_region_highlight.

0 commit comments

Comments
 (0)