blob: e5e324828f77e6c09a2762384560085ea2f83018 (
plain)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
|
# file : tests/standard-version/testscript
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
: valid
:
: Roundtrip version.
:
{
: non-prerelease
:
$* <<EOF >>EOF
1.2.3
EOF
: prerelease
:
{
: final
:
$* <<EOF >>EOF
1.2.3-a.1
1.2.3-b.1
EOF
: snapshot
:
$* <<EOF >>EOF
1.2.3-a.1.z
1.2.3-a.0.456
1.2.3-a.1.456.340c0a26a5ef
EOF
: earliest
:
$* <<EOF >>EOF
1.2.3-
EOF
}
: revision
:
$* <<EOF >>EOF
1.2.3+4
1.2.3-a.4+5
1.2.3-a.4.z+5
1.2.3-a.4.567+8
1.2.3-a.4.567.340c0a26a5ef+8
EOF
: epoch
:
$* <<EOF >>EOF
4~1.2.3
EOF
}
: invalid
:
{
: major
:
$* <'a' 2>'invalid major version' == 1
: no-major-dot
:
$* <'1' 2>"'.' expected after major version" == 1
: minor
:
$* <'1.a' 2>'invalid minor version' == 1
: no-minor-dot
:
$* <'1.2' 2>"'.' expected after minor version" == 1
: bugfix
:
$* <'1.2.a' 2>'invalid bugfix version' == 1
: zero-version
:
$* <'1~0.0.0' 2>'0.0.0 version' == 1
: a-b-expected
:
$* <'1.2.3-k' 2>"'a' or 'b' expected in pre-release" == 1
: prerelease-dot-expected
:
$* <'1.2.3-a' 2>"'.' expected after pre-release letter" == 1
: prerelease
:
$* <'1.2.3-a.b' 2>'invalid pre-release' == 1
: final-prerelease
:
$* <'1.2.3-b.0' 2>'invalid final pre-release' == 1
: snapshot-num
:
$* <'1.2.3-a.1.0' 2>'invalid snapshot number' == 1
: snapshot-id
:
$* <'1.2.3-a.1.1.@' 2>'invalid snapshot id' == 1
: revision
:
{
: non-prerelease
:
$* <'1.2.3+a' 2>'invalid revision' == 1
: prerelease
:
$* <'1.2.3-a.1+a' 2>'invalid revision' == 1
: snapshot-num
:
$* <'1.2.3-a.0.1+a' 2>'invalid revision' == 1
: snapshot-id
:
$* <'1.2.3-a.0.1.83jdgsf+0' 2>'invalid revision' == 1
: earliest-prerelease
:
$* <'1.2.3-+1' 2>"'a' or 'b' expected in pre-release" == 1
}
: trailing-junk-after
:
{
: snapshot-num
:
$* <'1.2.3-a.1.z.a' 2>'junk after version' == 1
: revision
:
$* <'1.2.3-a.1.z+1a' 2>'junk after version' == 1
}
}
: alpha
:
{
test.options += -a
$* '1.2.3' >n: non-prerelease
$* '1.2.3-b.1' >n: beta
$* '1.2.3-a.1' >y: final
$* '1.2.3-a.0.1' >y: snapshot
$* '1.2.3-' >y: earliest
}
: beta
:
{
test.options += -b
$* '1.2.3' >n: non-prerelease
$* '1.2.3-a.1' >n: alpha
$* '1.2.3-b.1' >y: final
$* '1.2.3-b.0.1' >y: snapshot
$* '1.2.3-' >n: earliest
}
: compare
:
{
test.options += -c
: epoch
:
{
$* '4~1.2.3' '4~1.2.3' >'0' : equal
$* '1.2.4' '4~1.2.3' >'-1': less
}
: non-prerelease
:
{
$* '1.2.3' '1.2.3' >'0' : equal
$* '1.2.3' '1.2.4' >'-1' : less
}
: prerelease
:
{
$* '1.2.3-a.1' '1.2.3-a.1' >'0' : equal
$* '1.2.3' '1.2.3-a.1' >'1' : release-gt-prerelease
$* '1.2.3-a.2' '1.2.3-b.1' >'-1' : a-lt-b
$* '1.2.3-a.1' '1.2.3-a.1.2' >'-1' : final-lt-snapshot
$* '1.2.3-a.1.2.xy' '1.2.3-a.1.2' >'0' : ignore-snapshot-id
$* '1.2.3' '1.2.3-a.0.1' >'1' : release-gt-snapshot
$* '1.2.3-a.0.1' '1.2.3-a.1' >'-1' : snapshot-lt-final
$* '1.2.3' '1.2.3-' >'1' : release-gt-earliest
$* '1.2.3-a.1' '1.2.3-' >'1' : final-gt-earliest
$* '1.2.3-a.0.1' '1.2.3-' >'1' : snapshot-gt-earliest
$* '1.2.2-b.499.z' '1.2.3-' >'-1' : prev-max-snapshot-lt-earliest
}
}
: constraints
:
{
test.options += -r
: range
:
{
: valid
:
$* <<EOI >>EOE
[1.2.3 1.2.4]
(1.2.3 1.2.4)
[ 1.2.3- 1.2.4- ]
EOI
[1.2.3 1.2.4]
(1.2.3 1.2.4)
[1.2.3- 1.2.4-]
EOE
: invalid
:
{
$* <'' 2>'invalid constraint' == 1 : empty
$* <'1' 2>'invalid constraint' == 1 : no-opening
$* <'[ ' 2>'no min version' == 1 : no-min
$* <'[1.2.3' 2>'no max version' == 1 : no-max
$* <'[1.2.3 1.2.4' 2>'no closing bracket' == 1 : no-closing
$* <'[1.2.3 1.2.4)]' 2>'junk after constraint' == 1 : junk
: invalid-min
:
$* <'[1' 2>"invalid min version: '.' expected after major version" == 1
: invalid-max
:
$* <'[1.2.3 1' 2>"invalid max version: '.' expected after major version" == 1
: min-gt-max
:
$* <'[1.2.4 1.2.3]' 2>'min version is greater than max version' == 1
: open-end
:
$* <'[1.2.3 1.2.3)' 2>'equal version endpoints not closed' == 1
: earliest-prerelease
:
$* <'[1.2.3- 1.2.3-]' 2>'equal version endpoints are earliest' == 1
}
}
: comparison
:
{
: valid
:
$* <<EOI >>EOE
== 1.2.3
>= 1.2.3
<= 1.2.3
> 1.2.3
< 1.2.3
>=1.2.3-
<=1.2.3-
>1.2.3-
<1.2.3-
EOI
== 1.2.3
>= 1.2.3
<= 1.2.3
> 1.2.3
< 1.2.3
>= 1.2.3-
<= 1.2.3-
> 1.2.3-
< 1.2.3-
EOE
: invalid
:
{
$* <'>=' 2>'no version' == 1 : no-version
: eq-earliest
:
$* <'==1.2.3-' 2>"invalid version: 'a' or 'b' expected in pre-release" == 1
: junk
:
$* <'>= 1.2.3-a.1.1.ads@' 2>'invalid version: junk after version' == 1
}
}
}
|