Skip to content

Commit f6471db

Browse files
committed
tests: Fix a wrong value of $PREBUFFER in a test, and add checks to prevent this from recurring.
Discussed: #706 (comment)
1 parent f6f7a91 commit f6471db

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

highlighters/main/test-data/path_prefix3.zsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# Assumes that '/bin/sh' exists and '/bin/s' does not exist.
3131
# Related to path_prefix.zsh
3232

33-
PREBUFFER='ls \'
33+
PREBUFFER=$'ls \\\n'
3434
BUFFER='/bin/s'
3535

3636
expected_region_highlight=(

tests/test-highlighting.zsh

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ run_test_internal() {
145145

146146
# Check the data declares $PREBUFFER or $BUFFER.
147147
[[ -z $PREBUFFER && -z $BUFFER ]] && { echo >&2 "Bail out! On ${(qq)ARG}: Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank"; return ${RETURN:=1}; }
148+
[[ $PREBUFFER == (''|*$'\n') ]] || { echo >&2 "Bail out! On ${(qq)ARG}: PREBUFFER=${(qqqq)PREBUFFER} doesn't end with a newline"; return ${RETURN:=1}; }
148149

149150
# Set sane defaults for ZLE variables
150151
: ${CURSOR=$#BUFFER} ${PENDING=0} ${WIDGET=z-sy-h-test-harness-test-widget}

0 commit comments

Comments
 (0)