forked from denoland/std
-
Notifications
You must be signed in to change notification settings - Fork 0
/
outside_test.ts
29 lines (28 loc) · 955 Bytes
/
outside_test.ts
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
// Copyright Isaac Z. Schlueter and Contributors. All rights reserved. ISC license.
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../assert/mod.ts";
import { outside } from "./outside.ts";
import { parse } from "./parse.ts";
import { parseRange } from "./parse_range.ts";
Deno.test({
name: "outside",
fn: async (t) => {
const steps: [string, string, boolean][] = [
["1.2.3", "1.0.0 - 1.2.2", true],
["1.2.3", "1.0.0 - 1.2.3", false],
["0.0.0", "1.0.0 - 1.2.2", true],
["1.0.0", "1.0.0 - 1.2.3", false],
];
for (const [version, range, expected] of steps) {
await t.step({
name: `${range} ${expected ? "∋" : "∌"} ${version}`,
fn: () => {
const v = parse(version);
const r = parseRange(range);
const actual = outside(v, r);
assertEquals(actual, expected);
},
});
}
},
});