minor: tests: Introduce a local variable. No functional change.

This commit is contained in:
Daniel Shahaf 2016-05-05 18:48:59 +00:00
parent 70b5687d66
commit f83bca0847

View file

@ -107,16 +107,18 @@ run_test_internal() {
for ((i=1; i<=${#expected_region_highlight}; i++)); do
local -a highlight_zone; highlight_zone=( ${(z)expected_region_highlight[$i]} )
local todo=
integer start=$highlight_zone[1] end=$highlight_zone[2]
[[ $highlight_zone[3] == NONE ]] && highlight_zone[3]=
[[ -n "$highlight_zone[4]" ]] && todo=" # TODO $highlight_zone[4]"
for j in {$highlight_zone[1]..$highlight_zone[2]}; do
for j in {$start..$end}; do
if [[ "$observed_result[$j]" != "$highlight_zone[3]" ]]; then
# Escape # as ♯ since the former is illegal in the 'description' part of TAP output
echo "not ok $i ${(qqq)BUFFER[$highlight_zone[1],$highlight_zone[2]]//'#'/♯} [$highlight_zone[1],$highlight_zone[2]]: expected ${(qqq)highlight_zone[3]}, observed ${(qqq)observed_result[$j]}.$todo"
echo "not ok $i ${(qqq)BUFFER[$start,$end]//'#'/♯} [$start,$end]: expected ${(qqq)highlight_zone[3]}, observed ${(qqq)observed_result[$j]}.$todo"
continue 2
fi
done
echo "ok $i$todo"
unset start end
unset todo
unset highlight_zone
done