deno.land / std@0.224.0 / semver / format_range_test.ts

format_range_test.ts
View Documentation
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
// Copyright Isaac Z. Schlueter and Contributors. All rights reserved. ISC license.// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.import { assertEquals } from "../assert/mod.ts";import { formatRange } from "./format_range.ts";import { parseRange } from "./parse_range.ts";
Deno.test({ name: "formatRange()", fn: async (t) => { const versions: [string, string][] = [ ["1.0.0 - 2.0.0", ">=1.0.0 <=2.0.0"], ["1.0.0", "1.0.0"], [">=*", "*"], ["", "*"], ["*", "*"], [">=1.0.0", ">=1.0.0"], [">1.0.0", ">1.0.0"], ["<=2.0.0", "<=2.0.0"], ["1", ">=1.0.0 <2.0.0"], ["<=2.0.0", "<=2.0.0"], ["<=2.0.0", "<=2.0.0"], ["<2.0.0", "<2.0.0"], ["<2.0.0", "<2.0.0"], [">=0.1.97", ">=0.1.97"], [">=0.1.97", ">=0.1.97"], ["0.1.20 || 1.2.4", "0.1.20||1.2.4"], [">=0.2.3 || <0.0.1", ">=0.2.3||<0.0.1"], [">=0.2.3 || <0.0.1", ">=0.2.3||<0.0.1"], [">=0.2.3 || <0.0.1", ">=0.2.3||<0.0.1"], ["||", "*||*"], ["2.x.x", ">=2.0.0 <3.0.0"], ["1.2.x", ">=1.2.0 <1.3.0"], ["1.2.x || 2.x", ">=1.2.0 <1.3.0||>=2.0.0 <3.0.0"], ["1.2.x || 2.x", ">=1.2.0 <1.3.0||>=2.0.0 <3.0.0"], ["x", "*"], ["2.*.*", ">=2.0.0 <3.0.0"], ["1.2.*", ">=1.2.0 <1.3.0"], ["1.2.* || 2.*", ">=1.2.0 <1.3.0||>=2.0.0 <3.0.0"], ["2", ">=2.0.0 <3.0.0"], ["2.3", ">=2.3.0 <2.4.0"], ["~2.4", ">=2.4.0 <2.5.0"], ["~2.4", ">=2.4.0 <2.5.0"], ["~>3.2.1", ">=3.2.1 <3.3.0"], ["~1", ">=1.0.0 <2.0.0"], ["~>1", ">=1.0.0 <2.0.0"], ["~1.0", ">=1.0.0 <1.1.0"], ["^0", ">=0.0.0 <1.0.0"], ["^0.1", ">=0.1.0 <0.2.0"], ["^1.0", ">=1.0.0 <2.0.0"], ["^1.2", ">=1.2.0 <2.0.0"], ["^0.0.1", ">=0.0.1 <0.0.2"], ["^0.0.1-beta", ">=0.0.1-beta <0.0.2"], ["^0.1.2", ">=0.1.2 <0.2.0"], ["^1.2.3", ">=1.2.3 <2.0.0"], ["^1.2.3-beta.4", ">=1.2.3-beta.4 <2.0.0"], ["<1", "<1.0.0"], [">=1", ">=1.0.0"], ["<1.2", "<1.2.0"], ["1", ">=1.0.0 <2.0.0"], ];
for (const [r, expected] of versions) { await t.step({ name: r, fn: () => { const range = parseRange(r); const actual = formatRange(range); assertEquals(actual, expected); }, }); } },});
std

Version Info

Tagged at
6 months ago