tests: Include the filename in error messages.
The new failure mode is: . Running test main Bail out! On './highlighters/main/test-data/glob.zsh': Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank Bail out! On './highlighters/main/test-data/glob.zsh': output on stderr Running test pattern Fixes #478.
This commit is contained in:
parent
d17417ec1b
commit
c969a1f26a
@ -92,7 +92,7 @@ run_test_internal() {
|
|||||||
|
|
||||||
local tests_tempdir="$1"; shift
|
local tests_tempdir="$1"; shift
|
||||||
local srcdir="$PWD"
|
local srcdir="$PWD"
|
||||||
builtin cd -q -- "$tests_tempdir" || { echo >&2 "Bail out! cd failed: $?"; return 1 }
|
builtin cd -q -- "$tests_tempdir" || { echo >&2 "Bail out! On ${(qq)1}: cd failed: $?"; return 1 }
|
||||||
|
|
||||||
echo "# ${1:t:r}"
|
echo "# ${1:t:r}"
|
||||||
|
|
||||||
@ -104,9 +104,9 @@ run_test_internal() {
|
|||||||
(( $#skip_test )) && { print -r -- "1..0 # SKIP $skip_test"; return; }
|
(( $#skip_test )) && { print -r -- "1..0 # SKIP $skip_test"; return; }
|
||||||
|
|
||||||
# Check the data declares $PREBUFFER or $BUFFER.
|
# 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; }
|
[[ -z $PREBUFFER && -z $BUFFER ]] && { echo >&2 "Bail out! On ${(qq)1}: Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank"; return 1; }
|
||||||
# Check the data declares $expected_region_highlight.
|
# Check the data declares $expected_region_highlight.
|
||||||
(( ${#expected_region_highlight} == 0 )) && { echo >&2 "Bail out! 'expected_region_highlight' is not declared or empty."; return 1; }
|
(( ${#expected_region_highlight} == 0 )) && { echo >&2 "Bail out! On ${(qq)1}: 'expected_region_highlight' is not declared or empty."; return 1; }
|
||||||
|
|
||||||
# Set sane defaults for ZLE variables
|
# Set sane defaults for ZLE variables
|
||||||
: ${CURSOR=$#BUFFER} ${PENDING=0} ${WIDGET=z-sy-h-test-harness-test-widget}
|
: ${CURSOR=$#BUFFER} ${PENDING=0} ${WIDGET=z-sy-h-test-harness-test-widget}
|
||||||
@ -184,7 +184,7 @@ run_test() {
|
|||||||
local ret=$pipestatus[1] stderr=$pipestatus[2]
|
local ret=$pipestatus[1] stderr=$pipestatus[2]
|
||||||
if (( ! stderr )); then
|
if (( ! stderr )); then
|
||||||
# stdout will become stderr
|
# stdout will become stderr
|
||||||
echo "Bail out! output on stderr"; return 1
|
echo "Bail out! On ${(qq)1}: output on stderr"; return 1
|
||||||
else
|
else
|
||||||
return $ret
|
return $ret
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user