From 9a2effc493b13b2e4108a46d3e95758841180c7e Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 4 Jan 2024 11:53:20 +0100 Subject: [PATCH 1/8] initial commit --- semver/format_range.ts | 14 ++++++++++++++ semver/range_format.ts | 11 +++++------ semver/range_test.ts | 4 ++-- 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 semver/format_range.ts diff --git a/semver/format_range.ts b/semver/format_range.ts new file mode 100644 index 000000000000..ac2fb98d02c2 --- /dev/null +++ b/semver/format_range.ts @@ -0,0 +1,14 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +import type { SemVerRange } from "./types.ts"; +import { comparatorFormat } from "./comparator_format.ts"; + +/** + * Formats the range into a string + * @example >=0.0.0 || <1.0.0 + * @param range The range to format + * @returns A string representation of the range + */ +export function formatRange(range: SemVerRange): string { + return range.ranges.map((c) => c.map((c) => comparatorFormat(c)).join(" ")) + .join("||"); +} diff --git a/semver/range_format.ts b/semver/range_format.ts index 9dabafd67ce4..c8b7ea223b5e 100644 --- a/semver/range_format.ts +++ b/semver/range_format.ts @@ -1,14 +1,13 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import type { SemVerRange } from "./types.ts"; -import { comparatorFormat } from "./comparator_format.ts"; + +import { formatRange } from "./format_range.ts"; /** * Formats the range into a string * @example >=0.0.0 || <1.0.0 * @param range The range to format * @returns A string representation of the range + * + * @deprecated (will be removed after 0.213.0) Use {@linkcode formatRange} instead. */ -export function rangeFormat(range: SemVerRange): string { - return range.ranges.map((c) => c.map((c) => comparatorFormat(c)).join(" ")) - .join("||"); -} +export const rangeFormat = formatRange; diff --git a/semver/range_test.ts b/semver/range_test.ts index 59029572e0c9..b8a18d288b95 100644 --- a/semver/range_test.ts +++ b/semver/range_test.ts @@ -1,7 +1,7 @@ // Copyright Isaac Z. Schlueter and Contributors. All rights reserved. ISC license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. import { assert, assertEquals } from "../assert/mod.ts"; -import { rangeFormat } from "./range_format.ts"; +import { formatRange } from "./format_range.ts"; import { parse } from "./parse.ts"; import { parseRange } from "./parse_range.ts"; import { testRange } from "./test_range.ts"; @@ -278,7 +278,7 @@ Deno.test({ name: `${r} -> ${expected}`, fn: () => { const range = parseRange(r); - const actual = rangeFormat(range); + const actual = formatRange(range); assertEquals(actual, expected); }, }); From 01617871f82a7a3ab55e82cedfa12217c5f12716 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 5 Jan 2024 12:24:49 +0100 Subject: [PATCH 2/8] update deprecation structure --- semver/range_format.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/semver/range_format.ts b/semver/range_format.ts index c8b7ea223b5e..73c7e2bff1ea 100644 --- a/semver/range_format.ts +++ b/semver/range_format.ts @@ -1,6 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. import { formatRange } from "./format_range.ts"; +import { SemVerRange } from "./types.ts"; /** * Formats the range into a string @@ -10,4 +11,6 @@ import { formatRange } from "./format_range.ts"; * * @deprecated (will be removed after 0.213.0) Use {@linkcode formatRange} instead. */ -export const rangeFormat = formatRange; +export function rangeFormat(range: SemVerRange): string { + return formatRange(range); +} From 84028da23363f935817bfb71e5b453577cc1a991 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Sun, 7 Jan 2024 09:30:47 +1100 Subject: [PATCH 3/8] chore: add `format_range_test.ts` --- semver/format_range_test.ts | 73 +++++++++++++++++++++++++++++++++++++ semver/range_test.ts | 71 +----------------------------------- 2 files changed, 74 insertions(+), 70 deletions(-) create mode 100644 semver/format_range_test.ts diff --git a/semver/format_range_test.ts b/semver/format_range_test.ts new file mode 100644 index 000000000000..3b4721af7a92 --- /dev/null +++ b/semver/format_range_test.ts @@ -0,0 +1,73 @@ +// 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: "validRange", + 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} -> ${expected}`, + fn: () => { + const range = parseRange(r); + const actual = formatRange(range); + assertEquals(actual, expected); + }, + }); + } + }, +}); diff --git a/semver/range_test.ts b/semver/range_test.ts index b8a18d288b95..eb13f708b498 100644 --- a/semver/range_test.ts +++ b/semver/range_test.ts @@ -1,7 +1,6 @@ // Copyright Isaac Z. Schlueter and Contributors. All rights reserved. ISC license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { assert, assertEquals } from "../assert/mod.ts"; -import { formatRange } from "./format_range.ts"; +import { assert } from "../assert/mod.ts"; import { parse } from "./parse.ts"; import { parseRange } from "./parse_range.ts"; import { testRange } from "./test_range.ts"; @@ -217,71 +216,3 @@ Deno.test("negativeUnlockedPrereleaseRange", function () { assert(!found, `${v} satisfied by ${r} unexpectedly`); } }); - -Deno.test({ - name: "validRange", - 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} -> ${expected}`, - fn: () => { - const range = parseRange(r); - const actual = formatRange(range); - assertEquals(actual, expected); - }, - }); - } - }, -}); From 2e789c5fb3556d109e4ac06042556366395cdff1 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Sun, 7 Jan 2024 09:31:26 +1100 Subject: [PATCH 4/8] tweak --- semver/format_range_test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/semver/format_range_test.ts b/semver/format_range_test.ts index 3b4721af7a92..f6757e8f9d3a 100644 --- a/semver/format_range_test.ts +++ b/semver/format_range_test.ts @@ -5,7 +5,7 @@ import { formatRange } from "./format_range.ts"; import { parseRange } from "./parse_range.ts"; Deno.test({ - name: "validRange", + name: "formatRange()", fn: async (t) => { const versions: [string, string][] = [ ["1.0.0 - 2.0.0", ">=1.0.0 <=2.0.0"], From 95896faa3db023d9ec27509743e734ba667ea3a8 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 4 Jan 2024 11:53:20 +0100 Subject: [PATCH 5/8] initial commit --- semver/format_range.ts | 14 ++++++++++++++ semver/range_format.ts | 11 +++++------ semver/range_test.ts | 4 ++-- 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 semver/format_range.ts diff --git a/semver/format_range.ts b/semver/format_range.ts new file mode 100644 index 000000000000..ac2fb98d02c2 --- /dev/null +++ b/semver/format_range.ts @@ -0,0 +1,14 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +import type { SemVerRange } from "./types.ts"; +import { comparatorFormat } from "./comparator_format.ts"; + +/** + * Formats the range into a string + * @example >=0.0.0 || <1.0.0 + * @param range The range to format + * @returns A string representation of the range + */ +export function formatRange(range: SemVerRange): string { + return range.ranges.map((c) => c.map((c) => comparatorFormat(c)).join(" ")) + .join("||"); +} diff --git a/semver/range_format.ts b/semver/range_format.ts index 9dabafd67ce4..c8b7ea223b5e 100644 --- a/semver/range_format.ts +++ b/semver/range_format.ts @@ -1,14 +1,13 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import type { SemVerRange } from "./types.ts"; -import { comparatorFormat } from "./comparator_format.ts"; + +import { formatRange } from "./format_range.ts"; /** * Formats the range into a string * @example >=0.0.0 || <1.0.0 * @param range The range to format * @returns A string representation of the range + * + * @deprecated (will be removed after 0.213.0) Use {@linkcode formatRange} instead. */ -export function rangeFormat(range: SemVerRange): string { - return range.ranges.map((c) => c.map((c) => comparatorFormat(c)).join(" ")) - .join("||"); -} +export const rangeFormat = formatRange; diff --git a/semver/range_test.ts b/semver/range_test.ts index 59029572e0c9..b8a18d288b95 100644 --- a/semver/range_test.ts +++ b/semver/range_test.ts @@ -1,7 +1,7 @@ // Copyright Isaac Z. Schlueter and Contributors. All rights reserved. ISC license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. import { assert, assertEquals } from "../assert/mod.ts"; -import { rangeFormat } from "./range_format.ts"; +import { formatRange } from "./format_range.ts"; import { parse } from "./parse.ts"; import { parseRange } from "./parse_range.ts"; import { testRange } from "./test_range.ts"; @@ -278,7 +278,7 @@ Deno.test({ name: `${r} -> ${expected}`, fn: () => { const range = parseRange(r); - const actual = rangeFormat(range); + const actual = formatRange(range); assertEquals(actual, expected); }, }); From 50ccb25c8d8322043cf76e1321474be4ae672c81 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 5 Jan 2024 12:24:49 +0100 Subject: [PATCH 6/8] update deprecation structure --- semver/range_format.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/semver/range_format.ts b/semver/range_format.ts index c8b7ea223b5e..73c7e2bff1ea 100644 --- a/semver/range_format.ts +++ b/semver/range_format.ts @@ -1,6 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. import { formatRange } from "./format_range.ts"; +import { SemVerRange } from "./types.ts"; /** * Formats the range into a string @@ -10,4 +11,6 @@ import { formatRange } from "./format_range.ts"; * * @deprecated (will be removed after 0.213.0) Use {@linkcode formatRange} instead. */ -export const rangeFormat = formatRange; +export function rangeFormat(range: SemVerRange): string { + return formatRange(range); +} From 2832ec6d53a6d5d6cd061e8f037fefe5536a9d38 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Sun, 7 Jan 2024 09:30:47 +1100 Subject: [PATCH 7/8] chore: add `format_range_test.ts` --- semver/format_range_test.ts | 73 +++++++++++++++++++++++++++++++++++++ semver/range_test.ts | 71 +----------------------------------- 2 files changed, 74 insertions(+), 70 deletions(-) create mode 100644 semver/format_range_test.ts diff --git a/semver/format_range_test.ts b/semver/format_range_test.ts new file mode 100644 index 000000000000..3b4721af7a92 --- /dev/null +++ b/semver/format_range_test.ts @@ -0,0 +1,73 @@ +// 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: "validRange", + 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} -> ${expected}`, + fn: () => { + const range = parseRange(r); + const actual = formatRange(range); + assertEquals(actual, expected); + }, + }); + } + }, +}); diff --git a/semver/range_test.ts b/semver/range_test.ts index b8a18d288b95..eb13f708b498 100644 --- a/semver/range_test.ts +++ b/semver/range_test.ts @@ -1,7 +1,6 @@ // Copyright Isaac Z. Schlueter and Contributors. All rights reserved. ISC license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { assert, assertEquals } from "../assert/mod.ts"; -import { formatRange } from "./format_range.ts"; +import { assert } from "../assert/mod.ts"; import { parse } from "./parse.ts"; import { parseRange } from "./parse_range.ts"; import { testRange } from "./test_range.ts"; @@ -217,71 +216,3 @@ Deno.test("negativeUnlockedPrereleaseRange", function () { assert(!found, `${v} satisfied by ${r} unexpectedly`); } }); - -Deno.test({ - name: "validRange", - 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} -> ${expected}`, - fn: () => { - const range = parseRange(r); - const actual = formatRange(range); - assertEquals(actual, expected); - }, - }); - } - }, -}); From cbab051d105961c96ca9a1c164f645b21f84150d Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Sun, 7 Jan 2024 09:31:26 +1100 Subject: [PATCH 8/8] tweak --- semver/format_range_test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/semver/format_range_test.ts b/semver/format_range_test.ts index 3b4721af7a92..f6757e8f9d3a 100644 --- a/semver/format_range_test.ts +++ b/semver/format_range_test.ts @@ -5,7 +5,7 @@ import { formatRange } from "./format_range.ts"; import { parseRange } from "./parse_range.ts"; Deno.test({ - name: "validRange", + name: "formatRange()", fn: async (t) => { const versions: [string, string][] = [ ["1.0.0 - 2.0.0", ">=1.0.0 <=2.0.0"],