From 8b8b19d91f2f945402488c5025c132a93a2a50c8 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 23 Oct 2015 04:48:16 +0000 Subject: [PATCH] test harness: Fix a bug with empty actual or expected results. Fixes zsh-users/zsh-syntax-highlighting#217. --- tests/test-highlighting.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-highlighting.zsh b/tests/test-highlighting.zsh index 4ecee08..dece1d9 100755 --- a/tests/test-highlighting.zsh +++ b/tests/test-highlighting.zsh @@ -75,7 +75,7 @@ run_test() { # Overlapping regions can be declared in region_highlight, so we first build an array of the # observed highlighting. 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]} integer start=$highlight_zone[1] end=$highlight_zone[2] 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. echo "1..${#expected_region_highlight}" - for i in {1..${#expected_region_highlight}}; do + for ((i=1; i<=${#expected_region_highlight}; i++)); do local todo= highlight_zone=${(z)expected_region_highlight[$i]} [[ -n "$highlight_zone[4]" ]] && todo=" # TODO $highlight_zone[4]"