forked from asdf-vm/asdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlatest_command.bats
90 lines (76 loc) · 2.67 KB
/
latest_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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env bats
load test_helpers
setup() {
setup_asdf_dir
install_dummy_plugin
install_dummy_legacy_plugin
}
teardown() {
clean_asdf_dir
}
####################################################
#### plugin with bin/latest-stable ####
####################################################
@test "[latest_command - dummy_plugin] shows latest stable version" {
run asdf latest dummy
[ "2.0.0" = "$output" ]
[ "$status" -eq 0 ]
}
@test "[latest_command - dummy_plugin] shows latest stable version that matches the given string" {
run asdf latest dummy 1
[ "1.1.0" = "$output" ]
[ "$status" -eq 0 ]
}
@test "[latest_command - dummy_plugin] an invalid version should return an error" {
run asdf latest dummy 3
[ "No compatible versions available (dummy 3)" = "$output" ]
[ "$status" -eq 1 ]
}
####################################################
#### plugin without bin/latest-stable ####
####################################################
@test "[latest_command - dummy_legacy_plugin] shows latest stable version" {
run asdf latest legacy-dummy
[ "5.1.0" = "$output" ]
[ "$status" -eq 0 ]
}
@test "[latest_command - dummy_legacy_plugin] shows latest stable version that matches the given string" {
run asdf latest legacy-dummy 1
[ "1.1.0" = "$output" ]
[ "$status" -eq 0 ]
}
@test "[latest_command - dummy_legacy_plugin] No stable version should return an error" {
run asdf latest legacy-dummy 3
[ -z "$output" ]
[ "$status" -eq 1 ]
}
@test "[latest_command - dummy_legacy_plugin] do not show latest unstable version that matches the given string" {
run asdf latest legacy-dummy 4
[ "4.0.0" = "$output" ]
[ "$status" -eq 0 ]
}
@test "[latest_command - dummy_legacy_plugin] do not show latest unstable version with capital characters that matches the given string" {
run asdf latest legacy-dummy 5
[ "5.1.0" = "$output" ]
[ "$status" -eq 0 ]
}
@test "[latest_command - dummy_legacy_plugin] an invalid version should return an error" {
run asdf latest legacy-dummy 6
[ "No compatible versions available (legacy-dummy 6)" = "$output" ]
[ "$status" -eq 1 ]
}
################################
#### latest --all ####
################################
@test "[latest_command - all plugins] shows the latest stable version of all plugins" {
run asdf install dummy 2.0.0
run asdf install legacy-dummy 4.0.0
run asdf latest --all
[ $'dummy\t2.0.0\tinstalled\nlegacy-dummy\t5.1.0\tmissing' = "$output" ]
[ "$status" -eq 0 ]
}
@test "[latest_command - all plugins] not installed plugin should return missing" {
run asdf latest --all
[ $'dummy\t2.0.0\tmissing\nlegacy-dummy\t5.1.0\tmissing' = "$output" ]
[ "$status" -eq 0 ]
}