fisher/test/plugin-uninstall-handler.fish
Jorge Bucaran fbf973e9e4 Teach uninstall handler about uninstall options.
+ Now __fisher_plugin_uninstall_handler is aware of a third argument,
`option` that can be used to indicate the event handler or uninstall
file abot any options available in `fisher uninstall`, namely, --force.

+ In addition, the uninstaller mechanism no longer receives the name of
the plugin, as this information is usually already available to plugins
anyway.

+ Finally, a path to the parent directory where the uninstall.fish file
is located is given instead of the full path to the file. Again, the
plugin usually knows the name of the file, `uninstall.fish`.
2016-02-17 13:53:24 +09:00

30 lines
721 B
Fish

set -l path $DIRNAME/.t-$TESTNAME-(random)
set -l option "--foobar"
function -S setup
mkdir -p $path
echo "echo source \$argv" > $path/uninstall.fish
function emit
echo "emit $argv"
end
end
function -S teardown
rm -rf $path
functions -e emit
end
test "$TESTNAME - Evaluate uninstaller with path and \$option as arguments"
"source $path $option" = (
__fisher_plugin_uninstall_handler foo $path/uninstall.fish $option | sed -n 1p
)
end
test "$TESTNAME - Emit uninstall_<plugin> events with path and \$option as argument"
"emit uninstall_foo $path $option" = (
__fisher_plugin_uninstall_handler foo $path/uninstall.fish $option | sed -n 2p
)
end