-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathtest.bats
120 lines (107 loc) · 3.18 KB
/
test.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/env bats
function setup() {
true
}
function teardown() {
true
}
@test "devel (arg)" {
source tools/calculate_tags.sh
run calculate devel 4.0.0 "R Under development (unstable) (2022-03-21 r81954)"
echo "${lines[0]}"
echo "${lines[0]}" | grep -q "Tags to add: devel 4.0.0 4.0 4.0.0-devel 4.0-devel `date -I`$"
}
@test "devel (detect)" {
source tools/calculate_tags.sh
function get_r_version_number() { echo 4.0.0; }
export -f get_r_version_number
run calculate devel
echo "${lines[0]}"
echo "${lines[0]}" | grep -q "Tags to add: devel 4.0.0 4.0 4.0.0-devel 4.0-devel `date -I`$"
}
@test "patched (arg)" {
source tools/calculate_tags.sh
run calculate next 4.1.3 "R version 4.1.3 Patched (2022-03-10 r82100)"
echo "${lines[0]}"
echo "${lines[0]}" | grep -q "Tags to add: next patched 4.1.3-patched 4.1-patched$"
}
@test "patched (detect)" {
source tools/calculate_tags.sh
function get_r_version_number() {
echo 4.1.3;
}
function get_r_version_string() {
echo "R version 4.1.3 Patched (2022-03-10 r82100)"
}
run calculate next
echo "${lines[0]}"
echo "${lines[0]}" | grep -q "Tags to add: next patched 4.1.3-patched 4.1-patched$"
}
@test "next (arg)" {
source tools/calculate_tags.sh
run calculate next 4.2.0 "R version 4.2.0 alpha (2022-04-03 r82074)"
echo "${lines[0]}"
echo "${lines[0]}" | grep -q "Tags to add: next 4.2.0 4.2 alpha 4.2.0-alpha 4.2-alpha$"
}
@test "next (detect)" {
source tools/calculate_tags.sh
function get_r_version_number() {
echo 4.2.0;
}
function get_r_version_string() {
echo "R version 4.2.0 alpha (2022-04-03 r82074)";
}
export -f get_r_version_number
export -f get_r_version_string
run calculate next
echo "${lines[0]}"
echo "${lines[0]}" | grep -q "Tags to add: next 4.2.0 4.2 alpha 4.2.0-alpha 4.2-alpha$"
}
@test "release (arg)" {
source tools/calculate_tags.sh
function get_r_release_version() {
echo 4.1.3;
}
export -f get_r_release_version
run calculate 4.1.3 4.1.3
echo "${lines[0]}"
echo "${lines[0]}" | grep -q "Tags to add: 4.1.3 4.1 release latest$"
}
@test "release (detect)" {
source tools/calculate_tags.sh
function get_r_version_number() {
echo 4.1.3;
}
function get_r_release_version() {
echo 4.1.3;
}
export -f get_r_version_number
export -f get_r_release_version
run calculate 4.1.3
echo "${lines[0]}"
echo "${lines[0]}" | grep -q "Tags to add: 4.1.3 4.1 release latest$"
}
@test "old (arg)" {
source tools/calculate_tags.sh
function get_r_release_version() {
echo 4.1.3;
}
export -f get_r_release_version
run calculate 4.1.2 4.1.2
echo "${lines[0]}"
echo "${lines[0]}" | grep -q "Tags to add: 4.1.2 4.1$"
}
@test "old (detect)" {
source tools/calculate_tags.sh
function get_r_version_number() {
echo 4.1.2;
}
function get_r_release_version() {
echo 4.1.3;
}
export -f get_r_version_number
export -f get_r_release_version
run calculate 4.1.2
echo "${lines[0]}"
echo "${lines[0]}" | grep -q "Tags to add: 4.1.2 4.1$"
}