tests: Add ability to skip tests

This commit is contained in:
Matthew Martin 2017-11-06 07:08:53 -06:00
parent 4bd30737dc
commit f4d37b74cc
2 changed files with 5 additions and 1 deletions

View file

@ -17,6 +17,8 @@ that is, `$i` and `$j` specify a range, 1-indexed, inclusive of both endpoints.
highlighting should be observed.
If `$todo` exists, the test point is marked as TODO (the failure of that test
point will not fail the test), and `$todo` is used as the explanation.
If a test sets `$skip_test` to a non-empty string, the test will be skipped
with the provided string as the reason.
**Note**: `$region_highlight` uses the same `"$i $j $style"` syntax but
interprets the indexes differently.

View file

@ -97,10 +97,12 @@ run_test_internal() {
echo "# ${1:t:r}"
# Load the data and prepare checking it.
local BUFFER CURSOR MARK PENDING PREBUFFER REGION_ACTIVE WIDGET
local BUFFER CURSOR MARK PENDING PREBUFFER REGION_ACTIVE WIDGET skip_test
local -a expected_region_highlight region_highlight
. "$srcdir"/"$1"
(( $#skip_test )) && { print -r -- "1..0 # SKIP $skip_test"; return; }
# Check the data declares $PREBUFFER or $BUFFER.
[[ -z $PREBUFFER && -z $BUFFER ]] && { echo >&2 "Bail out! Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank"; return 1; }
# Check the data declares $expected_region_highlight.