2025-01-01 04:12:39 +09:00
|
|
|
// Copyright 2018-2025 the Deno authors. MIT license.
|
2024-03-11 15:49:43 -07:00
|
|
|
|
|
|
|
import * as punycode from "node:punycode";
|
2024-07-25 15:30:28 +10:00
|
|
|
import { assertEquals } from "@std/assert";
|
2024-03-11 15:49:43 -07:00
|
|
|
|
|
|
|
Deno.test("regression #19214", () => {
|
2024-03-26 18:52:57 -04:00
|
|
|
const input = "个\uFFFD\uFFFD.hk";
|
2024-03-11 15:49:43 -07:00
|
|
|
|
|
|
|
assertEquals(punycode.toASCII(input), "xn--ciq6844ba.hk");
|
|
|
|
|
|
|
|
assertEquals(punycode.toUnicode("xn--ciq6844ba.hk"), input);
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test("Decode empty input", () => {
|
|
|
|
assertEquals(punycode.decode(""), "");
|
|
|
|
});
|