asdf

Форк
0
/
latest_command.bats 
90 строк · 2.7 Кб
1
#!/usr/bin/env bats
2

3
load test_helpers
4

5
setup() {
6
  setup_asdf_dir
7
  install_dummy_plugin
8
  install_dummy_legacy_plugin
9
}
10

11
teardown() {
12
  clean_asdf_dir
13
}
14

15
####################################################
16
####       plugin with bin/latest-stable        ####
17
####################################################
18
@test "[latest_command - dummy_plugin] shows latest stable version" {
19
  run asdf latest dummy
20
  [ "2.0.0" = "$output" ]
21
  [ "$status" -eq 0 ]
22
}
23

24
@test "[latest_command - dummy_plugin] shows latest stable version that matches the given string" {
25
  run asdf latest dummy 1
26
  [ "1.1.0" = "$output" ]
27
  [ "$status" -eq 0 ]
28
}
29

30
@test "[latest_command - dummy_plugin] an invalid version should return an error" {
31
  run asdf latest dummy 3
32
  [ "No compatible versions available (dummy 3)" = "$output" ]
33
  [ "$status" -eq 1 ]
34
}
35

36
####################################################
37
####      plugin without bin/latest-stable      ####
38
####################################################
39
@test "[latest_command - dummy_legacy_plugin] shows latest stable version" {
40
  run asdf latest legacy-dummy
41
  [ "5.1.0" = "$output" ]
42
  [ "$status" -eq 0 ]
43
}
44

45
@test "[latest_command - dummy_legacy_plugin] shows latest stable version that matches the given string" {
46
  run asdf latest legacy-dummy 1
47
  [ "1.1.0" = "$output" ]
48
  [ "$status" -eq 0 ]
49
}
50

51
@test "[latest_command - dummy_legacy_plugin] No stable version should return an error" {
52
  run asdf latest legacy-dummy 3
53
  [ -z "$output" ]
54
  [ "$status" -eq 1 ]
55
}
56

57
@test "[latest_command - dummy_legacy_plugin] do not show latest unstable version that matches the given string" {
58
  run asdf latest legacy-dummy 4
59
  [ "4.0.0" = "$output" ]
60
  [ "$status" -eq 0 ]
61
}
62

63
@test "[latest_command - dummy_legacy_plugin] do not show latest unstable version with capital characters that matches the given string" {
64
  run asdf latest legacy-dummy 5
65
  [ "5.1.0" = "$output" ]
66
  [ "$status" -eq 0 ]
67
}
68

69
@test "[latest_command - dummy_legacy_plugin] an invalid version should return an error" {
70
  run asdf latest legacy-dummy 6
71
  [ "No compatible versions available (legacy-dummy 6)" = "$output" ]
72
  [ "$status" -eq 1 ]
73
}
74

75
################################
76
####      latest --all      ####
77
################################
78
@test "[latest_command - all plugins] shows the latest stable version of all plugins" {
79
  run asdf install dummy 2.0.0
80
  run asdf install legacy-dummy 4.0.0
81
  run asdf latest --all
82
  [ $'dummy\t2.0.0\tinstalled\nlegacy-dummy\t5.1.0\tmissing' = "$output" ]
83
  [ "$status" -eq 0 ]
84
}
85

86
@test "[latest_command - all plugins] not installed plugin should return missing" {
87
  run asdf latest --all
88
  [ $'dummy\t2.0.0\tmissing\nlegacy-dummy\t5.1.0\tmissing' = "$output" ]
89
  [ "$status" -eq 0 ]
90
}
91

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.