13
@test "plugin_remove_command removes a plugin" {
16
run asdf plugin-remove "dummy"
18
[ "$output" = "plugin-remove ${ASDF_DIR}/plugins/dummy" ]
21
@test "plugin_remove_command should exit with 1 when not passed any arguments" {
22
run asdf plugin-remove
24
[ "$output" = "No plugin given" ]
27
@test "plugin_remove_command should exit with 1 when passed invalid plugin name" {
28
run asdf plugin-remove "does-not-exist"
30
[ "$output" = "No such plugin: does-not-exist" ]
33
@test "plugin_remove_command should remove installed versions" {
35
run asdf install dummy 1.0
37
[ -d "$ASDF_DIR/installs/dummy" ]
39
run asdf plugin-remove dummy
41
[ ! -d "$ASDF_DIR/installs/dummy" ]
44
@test "plugin_remove_command should also remove shims for that plugin" {
46
run asdf install dummy 1.0
48
[ -f "$ASDF_DIR/shims/dummy" ]
50
run asdf plugin-remove dummy
52
[ ! -f "$ASDF_DIR/shims/dummy" ]
55
@test "plugin_remove_command should not remove unrelated shims" {
57
run asdf install dummy 1.0
60
echo "# asdf-plugin: gummy" >"$ASDF_DIR/shims/gummy"
62
run asdf plugin-remove dummy
66
[ -f "$ASDF_DIR/shims/gummy" ]
69
@test "plugin_remove_command executes pre-plugin-remove script" {
72
run asdf plugin-remove dummy
74
[ "$output" = "plugin-remove ${ASDF_DIR}/plugins/dummy" ]
77
@test "plugin_remove_command executes configured pre hook (generic)" {
80
cat >"$HOME/.asdfrc" <<-'EOM'
81
pre_asdf_plugin_remove = echo REMOVE ${@}
84
run asdf plugin-remove dummy
86
local expected_output="REMOVE dummy
87
plugin-remove ${ASDF_DIR}/plugins/dummy"
88
[ "$output" = "${expected_output}" ]
91
@test "plugin_remove_command executes configured pre hook (specific)" {
94
cat >"$HOME/.asdfrc" <<-'EOM'
95
pre_asdf_plugin_remove_dummy = echo REMOVE
98
run asdf plugin-remove dummy
100
local expected_output="REMOVE
101
plugin-remove ${ASDF_DIR}/plugins/dummy"
102
[ "$output" = "${expected_output}" ]
105
@test "plugin_remove_command executes configured post hook (generic)" {
108
cat >"$HOME/.asdfrc" <<-'EOM'
109
post_asdf_plugin_remove = echo REMOVE ${@}
112
run asdf plugin-remove dummy
114
local expected_output="plugin-remove ${ASDF_DIR}/plugins/dummy
116
[ "$output" = "${expected_output}" ]
119
@test "plugin_remove_command executes configured post hook (specific)" {
122
cat >"$HOME/.asdfrc" <<-'EOM'
123
post_asdf_plugin_remove_dummy = echo REMOVE
126
run asdf plugin-remove dummy
128
local expected_output="plugin-remove ${ASDF_DIR}/plugins/dummy
130
[ "$output" = "${expected_output}" ]