dots2/.antidote/tools/run-clitests

34 lines
884 B
Bash
Executable file

#!/usr/bin/env zsh
0=${(%):-%x}
setopt extended_glob
cd ${0:A:h:h}
local o_unit o_rev
zparseopts -D -M -- -unit=o_unit -rev=o_rev || return 1
testfiles=()
if (( $# > 0 )); then
testfiles=($@)
elif (( $#o_unit )); then
testfiles=($PWD/tests/*.md~*test_real*~*foo*)
else
testfiles=($PWD/tests/*.md)
fi
# if tests are run in reverse order, I can catch places where I didn't teardown properly
if (( $#o_rev )); then
testfiles=(${(O)testfiles})
fi
# foo example test command
# env -i PATH=$PATH FPATH=$FPATH \
# zsh -f -- =clitest --list-run --progress dot --prompt '%' --color always $PWD/tests/foo.md
env -i PATH=$PATH FPATH=$FPATH PAGER=cat \
zsh -f -- \
=clitest \
--list-run --progress dot --prompt '%' \
--color always \
--pre-flight 'git --version; print $PWD $VENDOR $OSTYPE =zsh $ZSH_VERSION $ZSH_PATCHLEVEL' \
-- $testfiles