Fix handling of expected to fail tests

This commit is contained in:
Maxime Coste 2016-04-25 22:17:42 +01:00
parent 8cae7097f4
commit d3bcf8c21e

View File

@ -70,16 +70,7 @@ main() {
failed=yes failed=yes
fi fi
echo echo
diff -u $test/$dir/$expect $expect | while read -r line; do show_diff $test/$dir/$expect $expect
first_character=$(echo "$line" | cut -b 1)
case $first_character in
+) color=green ;;
-) color=red ;;
@) color=magenta ;;
*) color=none ;;
esac
echo "$line" | colorize $color normal
done
fi fi
done done
if [ "$failed" = no ]; then if [ "$failed" = no ]; then
@ -95,20 +86,25 @@ main() {
fi fi
fi fi
else else
color=green failed=no
if [ ! -e stderr ]; then if [ ! -e stderr ]; then
if [ $retval -eq 0 ]; then if [ $retval -eq 0 ]; then
color=red echo "$indent$name" | colorize red normal
number_failures=$(($number_failures + 1)) number_failures=$(($number_failures + 1))
failed=yes
fi fi
else else
sed -i -e 's/^[0-9]*:[0-9]*: //g' stderr sed -i -e 's/^[0-9]*:[0-9]*: //g' stderr
if [ -s error ] && ! cmp -s error stderr; then if [ -s error ] && ! cmp -s error stderr; then
color=yellow echo "$indent$name" | colorize yellow normal
show_diff error stderr
failed=yes
fi fi
fi fi
echo "$indent$name" | colorize $color normal if [ "$failed" = no ]; then
echo "$indent$name" | colorize green normal
fi
fi fi
fi fi
done done
@ -151,5 +147,17 @@ colorize() {
echo "$(get_ansi_code $color_name $style_name)$text$(get_ansi_code none none)" echo "$(get_ansi_code $color_name $style_name)$text$(get_ansi_code none none)"
} }
show_diff() {
diff -u $1 $2 | while read -r line; do
first_character=$(echo "$line" | cut -b 1)
case $first_character in
+) color=green ;;
-) color=red ;;
@) color=magenta ;;
*) color=none ;;
esac
echo "$line" | colorize $color normal
done
}
main $@ main $@