Skip to content

Commit 7913ac5

Browse files
Lekowatilde
authored andcommitted
test: separate the test fixtures between ICU and URL
We need to emit dependency of ICU's toASCII in order to update the WPT fixtures. Since ICU and URL isn't the same implementation and they also follow different specifications. ICU's toASCII shouldn't have a dependency on WPT fixtures. Refs: #33770 (comment) PR-URL: #35077 Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
1 parent 6f2af08 commit 7913ac5

File tree

2 files changed

+151
-5
lines changed

2 files changed

+151
-5
lines changed
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
[
2+
"This resource is focused on highlighting issues with UTS #46 ToASCII",
3+
{
4+
"comment": "Label with hyphens in 3rd and 4th position",
5+
"input": "aa--",
6+
"output": "aa--"
7+
},
8+
{
9+
"input": "a†--",
10+
"output": "xn--a---kp0a"
11+
},
12+
{
13+
"input": "ab--c",
14+
"output": "ab--c"
15+
},
16+
{
17+
"comment": "Label with leading hyphen",
18+
"input": "-x",
19+
"output": "-x"
20+
},
21+
{
22+
"input": "-†",
23+
"output": "xn----xhn"
24+
},
25+
{
26+
"input": "-x.xn--nxa",
27+
"output": "-x.xn--nxa"
28+
},
29+
{
30+
"input": "-x.β",
31+
"output": "-x.xn--nxa"
32+
},
33+
{
34+
"comment": "Label with trailing hyphen",
35+
"input": "x-.xn--nxa",
36+
"output": "x-.xn--nxa"
37+
},
38+
{
39+
"input": "x-.β",
40+
"output": "x-.xn--nxa"
41+
},
42+
{
43+
"comment": "Empty labels",
44+
"input": "x..xn--nxa",
45+
"output": "x..xn--nxa"
46+
},
47+
{
48+
"input": "x..β",
49+
"output": "x..xn--nxa"
50+
},
51+
{
52+
"comment": "Invalid Punycode",
53+
"input": "xn--a",
54+
"output": null
55+
},
56+
{
57+
"input": "xn--a.xn--nxa",
58+
"output": null
59+
},
60+
{
61+
"input": "xn--a.β",
62+
"output": null
63+
},
64+
{
65+
"comment": "Valid Punycode",
66+
"input": "xn--nxa.xn--nxa",
67+
"output": "xn--nxa.xn--nxa"
68+
},
69+
{
70+
"comment": "Mixed",
71+
"input": "xn--nxa.β",
72+
"output": "xn--nxa.xn--nxa"
73+
},
74+
{
75+
"input": "ab--c.xn--nxa",
76+
"output": "ab--c.xn--nxa"
77+
},
78+
{
79+
"input": "ab--c.β",
80+
"output": "ab--c.xn--nxa"
81+
},
82+
{
83+
"comment": "CheckJoiners is true",
84+
"input": "\u200D.example",
85+
"output": null
86+
},
87+
{
88+
"input": "xn--1ug.example",
89+
"output": null
90+
},
91+
{
92+
"comment": "CheckBidi is true",
93+
"input": "يa",
94+
"output": null
95+
},
96+
{
97+
"input": "xn--a-yoc",
98+
"output": null
99+
},
100+
{
101+
"comment": "processing_option is Nontransitional_Processing",
102+
"input": "ශ්‍රී",
103+
"output": "xn--10cl1a0b660p"
104+
},
105+
{
106+
"input": "نامه‌ای",
107+
"output": "xn--mgba3gch31f060k"
108+
},
109+
{
110+
"comment": "U+FFFD",
111+
"input": "\uFFFD.com",
112+
"output": null
113+
},
114+
{
115+
"comment": "U+FFFD character encoded in Punycode",
116+
"input": "xn--zn7c.com",
117+
"output": null
118+
},
119+
{
120+
"comment": "Label longer than 63 code points",
121+
"input": "x01234567890123456789012345678901234567890123456789012345678901x",
122+
"output": "x01234567890123456789012345678901234567890123456789012345678901x"
123+
},
124+
{
125+
"input": "x01234567890123456789012345678901234567890123456789012345678901†",
126+
"output": "xn--x01234567890123456789012345678901234567890123456789012345678901-6963b"
127+
},
128+
{
129+
"input": "x01234567890123456789012345678901234567890123456789012345678901x.xn--nxa",
130+
"output": "x01234567890123456789012345678901234567890123456789012345678901x.xn--nxa"
131+
},
132+
{
133+
"input": "x01234567890123456789012345678901234567890123456789012345678901x.β",
134+
"output": "x01234567890123456789012345678901234567890123456789012345678901x.xn--nxa"
135+
},
136+
{
137+
"comment": "Domain excluding TLD longer than 253 code points",
138+
"input": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.x",
139+
"output": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.x"
140+
},
141+
{
142+
"input": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa",
143+
"output": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa"
144+
},
145+
{
146+
"input": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.β",
147+
"output": "01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.01234567890123456789012345678901234567890123456789.0123456789012345678901234567890123456789012345678.xn--nxa"
148+
}
149+
]

test/parallel/test-icu-punycode.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ assert(!icu.hasConverter('x'),
1616
'hasConverter should report converter does not exist for x');
1717

1818
const tests = require('../fixtures/url-idna.js');
19-
const fixtures = require('../common/fixtures');
20-
const wptToASCIITests = require(
21-
fixtures.path('wpt', 'url', 'resources', 'toascii.json')
22-
);
19+
const fixtures = require('../fixtures/icu-punycode-toascii.json');
2320

2421
{
2522
for (const [i, { ascii, unicode }] of tests.entries()) {
@@ -33,7 +30,7 @@ const wptToASCIITests = require(
3330
}
3431

3532
{
36-
for (const [i, test] of wptToASCIITests.entries()) {
33+
for (const [i, test] of fixtures.entries()) {
3734
if (typeof test === 'string')
3835
continue; // skip comments
3936
const { comment, input, output } = test;

0 commit comments

Comments
 (0)