test harness: Fix off-by-one discrepancy between observed and expected.

Fixes issue #195.
This commit is contained in:
Daniel Shahaf
2015-09-12 20:29:04 +00:00
parent 6d93ea07fd
commit c46b8d169e
13 changed files with 40 additions and 30 deletions

View File

@@ -84,7 +84,10 @@ for data_file in ${0:h:h}/highlighters/$1/test-data/*; do
observed_result=()
for i in {1..${#region_highlight}}; do
highlight_zone=${(z)region_highlight[$i]}
for j in {$highlight_zone[1]..$highlight_zone[2]}; do
integer start=$highlight_zone[1] end=$highlight_zone[2]
(( --end )) # region_highlight ranges are half-open
(( ++start, ++end )) # region_highlight is 0-indexed; expected_region_highlight is 1-indexed
for j in {$start..$end}; do
observed_result[$j]=$highlight_zone[3]
done
done