Skip to content

Commit

Permalink
Reverse tests to find teardown issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmc3 committed Oct 27, 2023
1 parent bbc28cb commit 41c8efc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/functions/t_setup
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function t_setup {

# our mock plugins use this
typeset -ga plugins=()
typeset -ga libs=()

# setup antidote
zstyle ':antidote:tests' set-warn-options 'on'
Expand Down
1 change: 1 addition & 0 deletions tests/functions/t_teardown
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function t_teardown {

# remove vars
[[ -v plugins ]] && unset plugins
[[ -v libs ]] && unset libs

# remove tempdir
[[ -d "$T_TEMPDIR" ]] && rm -rf -- "$T_TEMPDIR"
Expand Down
9 changes: 7 additions & 2 deletions tools/run-clitests
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ setopt extended_glob

cd ${0:A:h:h}

local o_unit
zparseopts -D -M -- -unit=o_unit || return 1
local o_unit o_rev
zparseopts -D -M -- -unit=o_unit -rev=o_rev || return 1

testfiles=()
if (( $# > 0 )); then
Expand All @@ -16,6 +16,11 @@ 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
Expand Down

0 comments on commit 41c8efc

Please sign in to comment.