forked from asdf-vm/asdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhere_command.bats
71 lines (56 loc) · 1.77 KB
/
where_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
69
70
71
#!/usr/bin/env bats
load test_helpers
setup() {
setup_asdf_dir
install_dummy_plugin
install_dummy_version 1.0
install_dummy_version 2.1
install_dummy_version ref-master
}
teardown() {
clean_asdf_dir
}
@test "where shows install location of selected version" {
run asdf where 'dummy' '1.0'
[ "$status" -eq 0 ]
[ "$output" = "$ASDF_DIR/installs/dummy/1.0" ]
}
@test "where understands versions installed by ref" {
run asdf where 'dummy' 'ref:master'
[ "$status" -eq 0 ]
[ "$output" = "$ASDF_DIR/installs/dummy/ref-master" ]
}
@test "where shows install location of current version if no version specified" {
echo 'dummy 2.1' >>"$HOME/.tool-versions"
run asdf where 'dummy'
[ "$status" -eq 0 ]
[ "$output" = "$ASDF_DIR/installs/dummy/2.1" ]
}
@test "where shows install location of first current version if not version specified and multiple current versions" {
echo 'dummy 2.1 1.0' >>"$HOME/.tool-versions"
run asdf where 'dummy'
[ "$status" -eq 0 ]
[ "$output" = "$ASDF_DIR/installs/dummy/2.1" ]
}
@test "where should error when the plugin doesn't exist" {
run asdf where "foobar"
[ "$status" -eq 1 ]
[ "$output" = "No such plugin: foobar" ]
}
@test "where should error when version is not installed" {
run asdf where 'dummy' '1.6'
[ "$status" -eq 1 ]
[ "$output" = "Version not installed" ]
}
@test "where should error when system version is set" {
run asdf where 'dummy' 'system'
[ "$status" -eq 1 ]
[ "$output" = "System version is selected" ]
}
@test "where should error when no current version selected and version not specified" {
run asdf where 'dummy'
local expected
expected="No version is set for dummy; please run \`asdf <global | shell | local> dummy <version>\`"
[ "$status" -eq 1 ]
[ "$output" = "$expected" ]
}