tests: TAP support: Emit a 'description' for all test points

This commit is contained in:
Daniel Shahaf 2016-05-05 18:40:13 +00:00
parent f83bca0847
commit 6aa57d60aa

View File

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