Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / url / script-tests / idna2008.js
blobde95b2a2e7449b1782ab11cbb1037c8990bebe53
1 description("IDNA2008 handling in domain name labels.");
3 debug("The PASS/FAIL results of this test are set to the behavior in IDNA2008.");
5 cases = [
6 // For IDNA Compatibility test material see
7 // http://www.unicode.org/reports/tr46/
8 // http://www.unicode.org/Public/idna/latest/IdnaMappingTable.txt
9 // We are testing disallowed, ignored, mapped, deviant, and valid cases.
10 // 1) Deviant character tests (deviant processing behavior from IDNA2003)
11 ["B\u00FCcher.de","xn--bcher-kva.de"],
12 // The ß U+00DF LATIN SMALL LETTER SHARP S does NOT normalize to "ss" like it does during IDNA2003's mapping phase
13 ["fa\u00DF.de","xn--fa-hia.de"],
14 // The ς U+03C2 GREEK SMALL LETTER FINAL SIGMA using βόλος.com
15 ["\u03B2\u03CC\u03BB\u03BF\u03C2.com","xn--nxasmm1c.com"],
16 // The ZWJ U+200D ZERO WIDTH JOINER
17 ["\u0DC1\u0DCA\u200D\u0DBB\u0DD3.com","xn--10cl1a0b660p.com"],
18 // The ZWNJ U+200C ZERO WIDTH NON-JOINER
19 ["\u0646\u0627\u0645\u0647\u200C\u0627\u06CC.com","xn--mgba3gch31f060k.com"],
20 // 2) Disallowed characters in IDNA2008
21 // U+2665 BLACK HEART SUIT
22 ["\u2665.net","\uFFFD.net"],
23 // U+0378 <reserved>
24 ["\u0378.net","\uFFFD.net"],
25 ["\u04C0.com","\uFFFD.com"],
26 ["\uD87E\uDC68.com","\uFFFD.com"],
27 ["\u2183.com","\uFFFD.com"],
28 // 3) Ignored characters should be removed * security risk
29 // U+034F COMBINING GRAPHEME JOINER
30 ["look\u034Fout.net","lookout.net"],
31 // 4) Mapped characters; four cases belows are actually UTS 46 tests.
32 ["gOoGle.com","google.com"],
33 // U+09DC is normalized to U+09A1, U+09BC before being turned to punycode.
34 ["\u09dc.com","xn--15b8c.com"],
35 // 1E9E; mapped; 0073 0073
36 ["\u1E9E.com","ss.com"],
37 // 5) Validity FAIL cases - these should each cause an error.
38 ["-foo.bar.com",""],
39 ["foo-.bar.com",""],
40 ["ab--cd.com",""],
41 ["xn--0.com",""],
42 ["foo\u0300.bar.com","foo%CC%80.bar.com"]
45 for (var i = 0; i < cases.length; ++i) {
46 test_vector = cases[i][0];
47 expected_result = cases[i][1];
48 shouldBe("canonicalize('http://" + test_vector + "/')",
49 "'http://" + expected_result + "/'");