summaryrefslogtreecommitdiff
path: root/.config/shells/zsh/plugins/fzf-tab/test/runtests.zsh
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@simplelittledream.com>2022-07-14 19:09:06 -0400
committerJacob McDonnell <jacob@simplelittledream.com>2022-07-14 19:09:06 -0400
commited4daf7429bf2580118aad87b8f3e2011efed7ec (patch)
tree82f9d8ed68de119e5777f5ecfae9df4a92fe92b3 /.config/shells/zsh/plugins/fzf-tab/test/runtests.zsh
Initial commit
Diffstat (limited to '.config/shells/zsh/plugins/fzf-tab/test/runtests.zsh')
-rw-r--r--.config/shells/zsh/plugins/fzf-tab/test/runtests.zsh27
1 files changed, 27 insertions, 0 deletions
diff --git a/.config/shells/zsh/plugins/fzf-tab/test/runtests.zsh b/.config/shells/zsh/plugins/fzf-tab/test/runtests.zsh
new file mode 100644
index 0000000..18406c0
--- /dev/null
+++ b/.config/shells/zsh/plugins/fzf-tab/test/runtests.zsh
@@ -0,0 +1,27 @@
+#!/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 ))