test harness: Fix a bug with empty actual or expected results.
Fixes zsh-users/zsh-syntax-highlighting#217.
This commit is contained in:
parent
a18a7427fd
commit
8b8b19d91f
@ -75,7 +75,7 @@ run_test() {
|
|||||||
# Overlapping regions can be declared in region_highlight, so we first build an array of the
|
# Overlapping regions can be declared in region_highlight, so we first build an array of the
|
||||||
# observed highlighting.
|
# observed highlighting.
|
||||||
local -A observed_result
|
local -A observed_result
|
||||||
for i in {1..${#region_highlight}}; do
|
for ((i=1; i<=${#region_highlight}; i++)); do
|
||||||
highlight_zone=${(z)region_highlight[$i]}
|
highlight_zone=${(z)region_highlight[$i]}
|
||||||
integer start=$highlight_zone[1] end=$highlight_zone[2]
|
integer start=$highlight_zone[1] end=$highlight_zone[2]
|
||||||
if (( start < end )) # region_highlight ranges are half-open
|
if (( start < end )) # region_highlight ranges are half-open
|
||||||
@ -92,7 +92,7 @@ run_test() {
|
|||||||
|
|
||||||
# Then we compare the observed result with the expected one.
|
# Then we compare the observed result with the expected one.
|
||||||
echo "1..${#expected_region_highlight}"
|
echo "1..${#expected_region_highlight}"
|
||||||
for i in {1..${#expected_region_highlight}}; do
|
for ((i=1; i<=${#expected_region_highlight}; i++)); do
|
||||||
local todo=
|
local todo=
|
||||||
highlight_zone=${(z)expected_region_highlight[$i]}
|
highlight_zone=${(z)expected_region_highlight[$i]}
|
||||||
[[ -n "$highlight_zone[4]" ]] && todo=" # TODO $highlight_zone[4]"
|
[[ -n "$highlight_zone[4]" ]] && todo=" # TODO $highlight_zone[4]"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user