blob: 899d2b67147869f3133e4c60caf04da6accae5d7 [file] [log] [blame]
* Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
* for details. All rights reserved. Use of this source code is governed by a
* BSD-style license that can be found in the LICENSE file.
* @assertion
* @description IDNA2003 handling in domain name labels. The PASS/FAIL results
* of this test are set to the behavior in IDNA2003.
import "../../testharness.dart";
import "resources/utilities.dart";
List cases = [
// For IDNA Compatibility test material see
// 1) Deviant character tests (deviant from IDNA2008)
// U+00DF normalizes to "ss" during IDNA2003's mapping phase
// The ς U+03C2 GREEK SMALL LETTER FINAL SIGMA is mapped to U+03C3
// The ZWJ U+200D ZERO WIDTH JOINER is mapped to nothing.
// The ZWNJ U+200C ZERO WIDTH NON-JOINER is mapped to nothing.
// 2) Normalization tests
// using Latin letter kra ‘ĸ’ in domain
// \u2A74 decomposes into ::=
// U+0341; COMBINING ACUTE TONE MARK is normalized to U+0301
// 3) Characters mapped away : See RFC 3454 B.1
// U+2060 WORD JOINER is mapped to nothing.
// U+FEFF ZERO WIDTH NO-BREAK SPACE is mapped to nothing.
// U+FE00 VARIATION SELECTOR-1 is mapped to nothing.
// 4) Prohibited code points
// Using prohibited high-ASCII \u00A0
// using prohibited non-ASCII space chars 1680 (Ogham space mark)
// Using prohibited lower ASCII control character \u001F
// Using prohibited U+06DD ARABIC END OF AYAH
// Using prohibited U+180E MONGOLIAN VOWEL SEPARATOR
// Using prohibited Non-character code points 1FFFE [NONCHARACTER CODE POINTS]
// ["look\uD83F\",""],
// Using prohibited U+DEAD half surrogate code point
// FIXME: ["look\",""],
// Using prohibited Inappropriate for plain text U+FFFA; INTERLINEAR ANNOTATION SEPARATOR
// Using prohibited Inappropriate for canonical representation 2FF0-2FFB; [IDEOGRAPHIC DESCRIPTION CHARACTERS]
// Using prohibited Change display properties or are deprecated 202E; RIGHT-TO-LEFT OVERRIDE
// Using prohibited Change display properties or are deprecated 206B; ACTIVATE SYMMETRIC SWAPPING
// Using prohibited Tagging characters E0001; LANGUAGE TAG
// ["look\uDB40\",""],
// Using prohibited Tagging characters E0020-E007F; [TAGGING CHARACTERS]
// ["look\uDB40\",""],
// Using prohibited Characters with bidirectional property 05BE
void main() {
for (var i = 0; i < cases.length; ++i) {
String test_vector = cases[i][0];;
String actual=canonicalize('http://$test_vector/');
String expected='http://${cases[i][1]}/';
Expect.equals(expected, actual);
}, "$i");