2024-01-14 21:19:00 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2024-04-29 02:57:30 +00:00
|
|
|
import { assert } from "@std/assert";
|
2024-06-27 08:50:19 +00:00
|
|
|
import { ALL, MIN } from "./_constants.ts";
|
2024-02-29 04:00:20 +00:00
|
|
|
import { formatRange } from "./format_range.ts";
|
2024-01-14 21:19:00 +00:00
|
|
|
import { isRange } from "./is_range.ts";
|
2024-02-29 23:01:26 +00:00
|
|
|
import type { Range } from "./types.ts";
|
2024-01-14 21:19:00 +00:00
|
|
|
|
|
|
|
Deno.test({
|
|
|
|
name: "isRange()",
|
|
|
|
fn: async (t) => {
|
2024-02-29 04:00:20 +00:00
|
|
|
const ranges: Range[] = [[
|
2024-01-14 21:19:00 +00:00
|
|
|
[ALL],
|
2024-03-01 06:43:28 +00:00
|
|
|
], [
|
|
|
|
[{
|
|
|
|
operator: ">=",
|
|
|
|
major: 0,
|
|
|
|
minor: 0,
|
|
|
|
patch: 0,
|
|
|
|
prerelease: [],
|
|
|
|
build: [],
|
|
|
|
}, {
|
|
|
|
operator: "<",
|
|
|
|
...MIN,
|
|
|
|
}],
|
2024-01-14 21:19:00 +00:00
|
|
|
]];
|
|
|
|
for (const r of ranges) {
|
2024-02-29 04:00:20 +00:00
|
|
|
await t.step(`${formatRange(r)}`, () => {
|
2024-01-14 21:19:00 +00:00
|
|
|
const actual = isRange(r);
|
|
|
|
assert(actual);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|