Fixed vim and zsh
This commit is contained in:
54
zsh/modules/zsh-autosuggestions/script/test_runner.zsh
Executable file
54
zsh/modules/zsh-autosuggestions/script/test_runner.zsh
Executable file
@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
DIR="${0:a:h}"
|
||||
ROOT_DIR="$DIR/.."
|
||||
TEST_DIR="$ROOT_DIR/test"
|
||||
|
||||
header() {
|
||||
local message="$1"
|
||||
|
||||
cat <<-EOF
|
||||
|
||||
#====================================================================#
|
||||
# $message
|
||||
#====================================================================#
|
||||
EOF
|
||||
}
|
||||
|
||||
# ZSH binary to use
|
||||
local zsh_bin="zsh"
|
||||
|
||||
while getopts ":z:" opt; do
|
||||
case $opt in
|
||||
z)
|
||||
zsh_bin="$OPTARG"
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND -1))
|
||||
|
||||
# Test suites to run
|
||||
local -a tests
|
||||
if [ $#@ -gt 0 ]; then
|
||||
tests=($@)
|
||||
else
|
||||
tests=($TEST_DIR/**/*_test.zsh)
|
||||
fi
|
||||
|
||||
local -i retval=0
|
||||
|
||||
for suite in $tests; do
|
||||
header "${suite#"$ROOT_DIR/"}"
|
||||
"$zsh_bin" -f "$suite" || retval=$?
|
||||
done
|
||||
|
||||
exit $retval
|
Reference in New Issue
Block a user