Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions tests/plugins.zunit
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,39 @@
ZBIN=$ZPFX/bin
export LC_CTYPE=C
export LANG=C
export ZTMP=$(mktemp -qu) TMPQ=,
}

@test '(un)load-ices' {
rm -f $ZTMP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved to the setup function.

# @zinit-scheduler with "burst" argument executes all tasks "now"
eval zinit load'"[[ \$TMPQ = , ]]"' atload"\"!touch \$ZTMP; TMPQ=.; TMPE=.\"" unload'"[[ \$TMPQ = . ]]"' for zdharma-continuum/null && @zinit-scheduler burst && @zinit-scheduler burst
state=$?
# Test if plugin effects withdrawal on unload is working
assert "$TMPE" different_to .
# Test if plugin is marked as unloaded
assert "$ZINIT_REGISTERED_PLUGINS[-1]" different_to zdharma-continuum/null
assert "$state" equals 0
# Test if plugin is loaded
assert "$ZTMP" is_file
}

@test 'wait-ice-with-condition' {
rm -f $ZTMP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved to the setup function.

# @zinit-scheduler with "burst" argument executes all tasks "now"
eval zinit wait'"[[ -n $ZTMP ]]"' atload'"touch $ZTMP"' for zdharma-continuum/null && @zinit-scheduler burst
state=$?
assert $state equals 0
assert $ZTMP is_file
}

@test 'wait-ice' {
rm -f $ZTMP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved to the setup function.

# @zinit-scheduler with "burst" argument executes all tasks "now"
eval zinit wait nocd atload'"touch $ZTMP"' for zdharma-continuum/null && @zinit-scheduler burst
state=$?
assert "$state" equals 0
assert "$ZTMP" is_file
}

# @test 'nnn' {
Expand Down