dotfiles/.zsh/zsh-fzf-tab/test/runtests.zsh

28 lines
726 B
Bash
Raw Normal View History

2024-09-22 19:14:22 +03:00
#!/bin/zsh -f
emulate zsh
# Run all specified tests, keeping count of which succeeded.
# The reason for this extra layer above the test script is to
# protect from catastrophic failure of an individual test.
# We could probably do that with subshells instead.
integer success failure skipped retval
for file in ${@:1}; do
zsh +Z -f ./ztst.zsh $file
retval=$?
if (( $retval == 2 )); then
(( skipped++ ))
elif (( $retval )); then
(( failure++ ))
else
(( success++ ))
fi
done
print "**************************************
$success successful test script${${success:#1}:+s}, \
$failure failure${${failure:#1}:+s}, \
$skipped skipped
**************************************"
return $(( failure ? 1 : 0 ))