forked from asdf-vm/asdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremove_command.bats
68 lines (52 loc) · 1.44 KB
/
remove_command.bats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bats
load test_helpers
setup() {
setup_asdf_dir
}
teardown() {
clean_asdf_dir
}
@test "plugin_remove_command removes a plugin" {
install_dummy_plugin
run asdf plugin-remove "dummy"
[ "$status" -eq 0 ]
[ "$output" = "" ]
}
@test "plugin_remove_command should exit with 1 when not passed any arguments" {
run asdf plugin-remove
[ "$status" -eq 1 ]
[ "$output" = "No plugin given" ]
}
@test "plugin_remove_command should exit with 1 when passed invalid plugin name" {
run asdf plugin-remove "does-not-exist"
[ "$status" -eq 1 ]
[ "$output" = "No such plugin: does-not-exist" ]
}
@test "plugin_remove_command should remove installed versions" {
install_dummy_plugin
run asdf install dummy 1.0
[ "$status" -eq 0 ]
[ -d $ASDF_DIR/installs/dummy ]
run asdf plugin-remove dummy
[ "$status" -eq 0 ]
[ ! -d $ASDF_DIR/installs/dummy ]
}
@test "plugin_remove_command should also remove shims for that plugin" {
install_dummy_plugin
run asdf install dummy 1.0
[ "$status" -eq 0 ]
[ -f $ASDF_DIR/shims/dummy ]
run asdf plugin-remove dummy
[ "$status" -eq 0 ]
[ ! -f $ASDF_DIR/shims/dummy ]
}
@test "plugin_remove_command should not remove unrelated shims" {
install_dummy_plugin
run asdf install dummy 1.0
# make an unrelated shim
echo "# asdf-plugin: gummy" > $ASDF_DIR/shims/gummy
run asdf plugin-remove dummy
[ "$status" -eq 0 ]
# unrelated shim should exist
[ -f $ASDF_DIR/shims/gummy ]
}