From 90189dd9974be01596ec776e63a4eceef1a036e0 Mon Sep 17 00:00:00 2001 From: Kenta Moriuchi Date: Tue, 7 Nov 2023 06:18:28 +0900 Subject: fix(ext): use `String#toWellFormed` in ext/webidl and ext/node (#21054) Fixes #18802 This PR adds `util.toUSVString` to node:util: ```js import util from "node:util"; util.toUSVString("string\ud801"); // => "string\ufffd" ``` --- cli/tests/unit_node/util_test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cli/tests/unit_node') diff --git a/cli/tests/unit_node/util_test.ts b/cli/tests/unit_node/util_test.ts index 64020141a..e90eed831 100644 --- a/cli/tests/unit_node/util_test.ts +++ b/cli/tests/unit_node/util_test.ts @@ -208,6 +208,14 @@ Deno.test({ }, }); +Deno.test({ + name: "[util] toUSVString", + fn() { + assertEquals(util.toUSVString("foo"), "foo"); + assertEquals(util.toUSVString("bar\ud801"), "bar\ufffd"); + }, +}); + Deno.test({ name: "[util] isDate", fn() { -- cgit v1.2.3