Allow unit tests to test for errors.

This commit is contained in:
Frank LENORMAND 2015-12-12 11:51:48 +03:00
parent 1ed866dbf0
commit d63238ed9d

View File

@ -15,7 +15,11 @@ main() {
test_files=$(ls out selections state 2>/dev/null)
cd $work/$dir;
indent="$(echo "${dir}/" | sed -e 's|[^/]*/\+| |g')"
name=$(basename $PWD)
name=$(echo ${PWD##*/} | sed 's/-fail^//')
should_fail=0
if [ ${PWD##*-} = fail ]; then
should_fail=1
fi
if ! test -e cmd; then
echo "$indent$name"
elif test -x enabled && ! ./enabled; then
@ -46,6 +50,7 @@ main() {
"
${test}/../src/kak out -n -u -e "$kak_commands"
retval=$?
if [ $should_fail = 0 ]; then
if [ $retval -ne 0 ]; then
echo "Kakoune returned error $retval"
fi
@ -72,6 +77,13 @@ main() {
echo
fi
done
else
if [ $retval -eq 0 ]; then
color=red
fi
color=${color:-green}
echo "$indent$name" | colorize $color normal
fi
fi
done
if expr $number_failures > 0; then