OLD | NEW |
(Empty) | |
| 1 dart_library.library('lib/convert/utf84_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__utf84_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const convert = dart_sdk.convert; |
| 8 const _interceptors = dart_sdk._interceptors; |
| 9 const dart = dart_sdk.dart; |
| 10 const dartx = dart_sdk.dartx; |
| 11 const expect$ = expect.expect; |
| 12 const utf84_test = Object.create(null); |
| 13 let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))(); |
| 14 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c
ore.int)))(); |
| 15 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da
rt.void, [])))(); |
| 16 let StringToListOfint = () => (StringToListOfint = dart.constFn(dart.definiteF
unctionType(ListOfint(), [core.String])))(); |
| 17 let ListOfintToListOfint = () => (ListOfintToListOfint = dart.constFn(dart.def
initeFunctionType(ListOfint(), [ListOfint()])))(); |
| 18 let ListOfintToString = () => (ListOfintToString = dart.constFn(dart.definiteF
unctionType(core.String, [ListOfint()])))(); |
| 19 utf84_test.testEnglishPhrase = "The quick brown fox jumps over the lazy dog."; |
| 20 utf84_test.testEnglishUtf8 = dart.constList([84, 104, 101, 32, 113, 117, 105,
99, 107, 32, 98, 114, 111, 119, 110, 32, 102, 111, 120, 32, 106, 117, 109, 112,
115, 32, 111, 118, 101, 114, 32, 116, 104, 101, 32, 108, 97, 122, 121, 32, 100,
111, 103, 46], core.int); |
| 21 utf84_test.testDanishPhrase = "Quizdeltagerne spiste jordbær med " + "fløde me
ns cirkusklovnen Wolther spillede på xylofon."; |
| 22 utf84_test.testDanishUtf8 = dart.constList([81, 117, 105, 122, 100, 101, 108,
116, 97, 103, 101, 114, 110, 101, 32, 115, 112, 105, 115, 116, 101, 32, 106, 111
, 114, 100, 98, 195, 166, 114, 32, 109, 101, 100, 32, 102, 108, 195, 184, 100, 1
01, 32, 109, 101, 110, 115, 32, 99, 105, 114, 107, 117, 115, 107, 108, 111, 118,
110, 101, 110, 32, 87, 111, 108, 116, 104, 101, 114, 32, 115, 112, 105, 108, 10
8, 101, 100, 101, 32, 112, 195, 165, 32, 120, 121, 108, 111, 102, 111, 110, 46],
core.int); |
| 23 utf84_test.testHebrewPhrase = "דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקל
יטה"; |
| 24 utf84_test.testHebrewUtf8 = dart.constList([215, 147, 215, 146, 32, 215, 161,
215, 167, 215, 168, 215, 159, 32, 215, 169, 215, 152, 32, 215, 145, 215, 153, 21
5, 157, 32, 215, 158, 215, 144, 215, 149, 215, 155, 215, 150, 215, 145, 32, 215,
149, 215, 156, 215, 164, 215, 170, 215, 162, 32, 215, 158, 215, 166, 215, 144,
32, 215, 156, 215, 149, 32, 215, 151, 215, 145, 215, 168, 215, 148, 32, 215, 144
, 215, 153, 215, 154, 32, 215, 148, 215, 167, 215, 156, 215, 153, 215, 152, 215,
148], core.int); |
| 25 utf84_test.testRussianPhrase = "Съешь же ещё этих мягких " + "французских було
к да выпей чаю"; |
| 26 utf84_test.testRussianUtf8 = dart.constList([208, 161, 209, 138, 208, 181, 209
, 136, 209, 140, 32, 208, 182, 208, 181, 32, 208, 181, 209, 137, 209, 145, 32, 2
09, 141, 209, 130, 208, 184, 209, 133, 32, 208, 188, 209, 143, 208, 179, 208, 18
6, 208, 184, 209, 133, 32, 209, 132, 209, 128, 208, 176, 208, 189, 209, 134, 209
, 131, 208, 183, 209, 129, 208, 186, 208, 184, 209, 133, 32, 208, 177, 209, 131,
208, 187, 208, 190, 208, 186, 32, 208, 180, 208, 176, 32, 208, 178, 209, 139, 2
08, 191, 208, 181, 208, 185, 32, 209, 135, 208, 176, 209, 142], core.int); |
| 27 utf84_test.testGreekPhrase = "Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ " + "στὸ χρυσα
φὶ ξέφωτο"; |
| 28 utf84_test.testGreekUtf8 = dart.constList([206, 147, 206, 177, 206, 182, 206,
173, 206, 181, 207, 130, 32, 206, 186, 206, 177, 225, 189, 182, 32, 206, 188, 20
7, 133, 207, 129, 207, 132, 206, 185, 225, 189, 178, 207, 130, 32, 206, 180, 225
, 189, 178, 206, 189, 32, 206, 184, 225, 189, 176, 32, 206, 178, 207, 129, 225,
191, 182, 32, 207, 128, 206, 185, 225, 189, 176, 32, 207, 131, 207, 132, 225, 18
9, 184, 32, 207, 135, 207, 129, 207, 133, 207, 131, 206, 177, 207, 134, 225, 189
, 182, 32, 206, 190, 206, 173, 207, 134, 207, 137, 207, 132, 206, 191], core.int
); |
| 29 utf84_test.testKatakanaPhrase = "イロハニホヘト チリヌルヲ ワカヨタレソ " + "ツネナラム ウヰノオクヤマ ケフコエテ
アサキユメミシ ヱヒモセスン"; |
| 30 utf84_test.testKatakanaUtf8 = dart.constList([227, 130, 164, 227, 131, 173, 22
7, 131, 143, 227, 131, 139, 227, 131, 155, 227, 131, 152, 227, 131, 136, 32, 227
, 131, 129, 227, 131, 170, 227, 131, 140, 227, 131, 171, 227, 131, 178, 32, 227,
131, 175, 227, 130, 171, 227, 131, 168, 227, 130, 191, 227, 131, 172, 227, 130,
189, 32, 227, 131, 132, 227, 131, 141, 227, 131, 138, 227, 131, 169, 227, 131,
160, 32, 227, 130, 166, 227, 131, 176, 227, 131, 142, 227, 130, 170, 227, 130, 1
75, 227, 131, 164, 227, 131, 158, 32, 227, 130, 177, 227, 131, 149, 227, 130, 17
9, 227, 130, 168, 227, 131, 134, 32, 227, 130, 162, 227, 130, 181, 227, 130, 173
, 227, 131, 166, 227, 131, 161, 227, 131, 159, 227, 130, 183, 32, 227, 131, 177,
227, 131, 146, 227, 131, 162, 227, 130, 187, 227, 130, 185, 227, 131, 179], cor
e.int); |
| 31 utf84_test.main = function() { |
| 32 utf84_test.testUtf8bytesToCodepoints(); |
| 33 utf84_test.testUtf8BytesToString(); |
| 34 utf84_test.testEncodeToUtf8(); |
| 35 }; |
| 36 dart.fn(utf84_test.main, VoidTovoid()); |
| 37 utf84_test.encodeUtf8 = function(str) { |
| 38 return convert.UTF8.encode(str); |
| 39 }; |
| 40 dart.fn(utf84_test.encodeUtf8, StringToListOfint()); |
| 41 utf84_test.utf8ToRunes = function(codeUnits) { |
| 42 return convert.UTF8.decode(codeUnits, {allowMalformed: true})[dartx.runes].t
oList(); |
| 43 }; |
| 44 dart.fn(utf84_test.utf8ToRunes, ListOfintToListOfint()); |
| 45 utf84_test.decodeUtf8 = function(codeUnits) { |
| 46 return convert.UTF8.decode(codeUnits); |
| 47 }; |
| 48 dart.fn(utf84_test.decodeUtf8, ListOfintToString()); |
| 49 utf84_test.testEncodeToUtf8 = function() { |
| 50 expect$.Expect.listEquals(utf84_test.testEnglishUtf8, utf84_test.encodeUtf8(
utf84_test.testEnglishPhrase), "english to utf8"); |
| 51 expect$.Expect.listEquals(utf84_test.testDanishUtf8, utf84_test.encodeUtf8(u
tf84_test.testDanishPhrase), "encode danish to utf8"); |
| 52 expect$.Expect.listEquals(utf84_test.testHebrewUtf8, utf84_test.encodeUtf8(u
tf84_test.testHebrewPhrase), "Hebrew to utf8"); |
| 53 expect$.Expect.listEquals(utf84_test.testRussianUtf8, utf84_test.encodeUtf8(
utf84_test.testRussianPhrase), "Russian to utf8"); |
| 54 expect$.Expect.listEquals(utf84_test.testGreekUtf8, utf84_test.encodeUtf8(ut
f84_test.testGreekPhrase), "Greek to utf8"); |
| 55 expect$.Expect.listEquals(utf84_test.testKatakanaUtf8, utf84_test.encodeUtf8
(utf84_test.testKatakanaPhrase), "Katakana to utf8"); |
| 56 }; |
| 57 dart.fn(utf84_test.testEncodeToUtf8, VoidTovoid()); |
| 58 utf84_test.testUtf8bytesToCodepoints = function() { |
| 59 expect$.Expect.listEquals(JSArrayOfint().of([954, 972, 963, 956, 949]), utf8
4_test.utf8ToRunes(JSArrayOfint().of([206, 186, 207, 140, 207, 131, 206, 188, 20
6, 181])), "κόσμε"); |
| 60 expect$.Expect.listEquals([], utf84_test.utf8ToRunes(JSArrayOfint().of([])),
"no input"); |
| 61 expect$.Expect.listEquals(JSArrayOfint().of([0]), utf84_test.utf8ToRunes(JSA
rrayOfint().of([0])), "0"); |
| 62 expect$.Expect.listEquals(JSArrayOfint().of([128]), utf84_test.utf8ToRunes(J
SArrayOfint().of([194, 128])), "80"); |
| 63 expect$.Expect.listEquals(JSArrayOfint().of([2048]), utf84_test.utf8ToRunes(
JSArrayOfint().of([224, 160, 128])), "800"); |
| 64 expect$.Expect.listEquals(JSArrayOfint().of([65536]), utf84_test.utf8ToRunes
(JSArrayOfint().of([240, 144, 128, 128])), "10000"); |
| 65 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([248, 13
6, 128, 128, 128])), "200000"); |
| 66 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE]), utf84
_test.utf8ToRunes(JSArrayOfint().of([252, 132, 128, 128, 128, 128])), "4000000")
; |
| 67 expect$.Expect.listEquals(JSArrayOfint().of([127]), utf84_test.utf8ToRunes(J
SArrayOfint().of([127])), "7f"); |
| 68 expect$.Expect.listEquals(JSArrayOfint().of([2047]), utf84_test.utf8ToRunes(
JSArrayOfint().of([223, 191])), "7ff"); |
| 69 expect$.Expect.listEquals(JSArrayOfint().of([65535]), utf84_test.utf8ToRunes
(JSArrayOfint().of([239, 191, 191])), "ffff"); |
| 70 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE]), utf84_test.ut
f8ToRunes(JSArrayOfint().of([247, 191, 191, 191])), "1fffff"); |
| 71 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([251, 19
1, 191, 191, 191])), "3ffffff"); |
| 72 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE]), utf84
_test.utf8ToRunes(JSArrayOfint().of([253, 191, 191, 191, 191, 191])), "4000000")
; |
| 73 expect$.Expect.listEquals(JSArrayOfint().of([55295]), utf84_test.utf8ToRunes
(JSArrayOfint().of([237, 159, 191])), "d7ff"); |
| 74 expect$.Expect.listEquals(JSArrayOfint().of([57344]), utf84_test.utf8ToRunes
(JSArrayOfint().of([238, 128, 128])), "e000"); |
| 75 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([239, 191, 189])), "fffd
"); |
| 76 expect$.Expect.listEquals(JSArrayOfint().of([1114111]), utf84_test.utf8ToRun
es(JSArrayOfint().of([244, 143, 191, 191])), "10ffff"); |
| 77 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([244, 144, 128, 128])),
"110000"); |
| 78 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([128])), "80 => replacem
ent character"); |
| 79 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([191])), "bf => replacem
ent character"); |
| 80 let allContinuationBytes = JSArrayOfint().of([]); |
| 81 let matchingReplacementChars = JSArrayOfint().of([]); |
| 82 for (let i = 128; i < 192; i++) { |
| 83 allContinuationBytes[dartx.add](i); |
| 84 matchingReplacementChars[dartx.add](convert.UNICODE_REPLACEMENT_CHARACTER_
RUNE); |
| 85 } |
| 86 expect$.Expect.listEquals(matchingReplacementChars, utf84_test.utf8ToRunes(a
llContinuationBytes), "80 - bf => replacement character x 64"); |
| 87 let allFirstTwoByteSeq = JSArrayOfint().of([]); |
| 88 matchingReplacementChars = JSArrayOfint().of([]); |
| 89 for (let i = 192; i < 224; i++) { |
| 90 allFirstTwoByteSeq[dartx.addAll](JSArrayOfint().of([i, 32])); |
| 91 matchingReplacementChars[dartx.addAll](JSArrayOfint().of([convert.UNICODE_
REPLACEMENT_CHARACTER_RUNE, 32])); |
| 92 } |
| 93 expect$.Expect.listEquals(matchingReplacementChars, utf84_test.utf8ToRunes(a
llFirstTwoByteSeq), "c0 - df + space => replacement character + space x 32"); |
| 94 let allFirstThreeByteSeq = JSArrayOfint().of([]); |
| 95 matchingReplacementChars = JSArrayOfint().of([]); |
| 96 for (let i = 224; i < 240; i++) { |
| 97 allFirstThreeByteSeq[dartx.addAll](JSArrayOfint().of([i, 32])); |
| 98 matchingReplacementChars[dartx.addAll](JSArrayOfint().of([convert.UNICODE_
REPLACEMENT_CHARACTER_RUNE, 32])); |
| 99 } |
| 100 expect$.Expect.listEquals(matchingReplacementChars, utf84_test.utf8ToRunes(a
llFirstThreeByteSeq), "e0 - ef + space => replacement character x 16"); |
| 101 let allFirstFourByteSeq = JSArrayOfint().of([]); |
| 102 matchingReplacementChars = JSArrayOfint().of([]); |
| 103 for (let i = 240; i < 248; i++) { |
| 104 allFirstFourByteSeq[dartx.addAll](JSArrayOfint().of([i, 32])); |
| 105 matchingReplacementChars[dartx.addAll](JSArrayOfint().of([convert.UNICODE_
REPLACEMENT_CHARACTER_RUNE, 32])); |
| 106 } |
| 107 expect$.Expect.listEquals(matchingReplacementChars, utf84_test.utf8ToRunes(a
llFirstFourByteSeq), "f0 - f7 + space => replacement character x 8"); |
| 108 let allFirstFiveByteSeq = JSArrayOfint().of([]); |
| 109 matchingReplacementChars = JSArrayOfint().of([]); |
| 110 for (let i = 248; i < 252; i++) { |
| 111 allFirstFiveByteSeq[dartx.addAll](JSArrayOfint().of([i, 32])); |
| 112 matchingReplacementChars[dartx.addAll](JSArrayOfint().of([convert.UNICODE_
REPLACEMENT_CHARACTER_RUNE, 32])); |
| 113 } |
| 114 expect$.Expect.listEquals(matchingReplacementChars, utf84_test.utf8ToRunes(a
llFirstFiveByteSeq), "f8 - fb + space => replacement character x 4"); |
| 115 let allFirstSixByteSeq = JSArrayOfint().of([]); |
| 116 matchingReplacementChars = JSArrayOfint().of([]); |
| 117 for (let i = 252; i < 254; i++) { |
| 118 allFirstSixByteSeq[dartx.addAll](JSArrayOfint().of([i, 32])); |
| 119 matchingReplacementChars[dartx.addAll](JSArrayOfint().of([convert.UNICODE_
REPLACEMENT_CHARACTER_RUNE, 32])); |
| 120 } |
| 121 expect$.Expect.listEquals(matchingReplacementChars, utf84_test.utf8ToRunes(a
llFirstSixByteSeq), "fc - fd + space => replacement character x 2"); |
| 122 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([194])), "2-byte sequenc
e with last byte missing"); |
| 123 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([224, 128])), "3-byte se
quence with last byte missing"); |
| 124 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([240, 128, 128])), "4-by
te sequence with last byte missing"); |
| 125 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE]), utf84_test.ut
f8ToRunes(JSArrayOfint().of([248, 136, 128, 128])), "5-byte sequence with last b
yte missing"); |
| 126 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([252, 12
8, 128, 128, 128])), "6-byte sequence with last byte missing"); |
| 127 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([223])), "2-byte sequenc
e with last byte missing (hi)"); |
| 128 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([239, 191])), "3-byte se
quence with last byte missing (hi)"); |
| 129 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([247, 191, 191])
), "4-byte sequence with last byte missing (hi)"); |
| 130 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE]), utf84_test.ut
f8ToRunes(JSArrayOfint().of([251, 191, 191, 191])), "5-byte sequence with last b
yte missing (hi)"); |
| 131 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([253, 19
1, 191, 191, 191])), "6-byte sequence with last byte missing (hi)"); |
| 132 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert
.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE,
convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACT
ER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT
_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REP
LACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNI
CODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, con
vert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_R
UNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE]), utf84
_test.utf8ToRunes(JSArrayOfint().of([194, 224, 128, 240, 128, 128, 248, 136, 128
, 128, 252, 128, 128, 128, 128, 223, 239, 191, 247, 191, 191, 251, 191, 191, 191
, 253, 191, 191, 191, 191])), "Concatenation of incomplete sequences"); |
| 133 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([254])), "fe"); |
| 134 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([255])), "ff"); |
| 135 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE]), utf84_test.ut
f8ToRunes(JSArrayOfint().of([254, 254, 255, 255])), "fe fe ff ff"); |
| 136 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([192, 175])), "c0 af"); |
| 137 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([224, 128, 175])), "e0 8
0 af"); |
| 138 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([240, 128, 128, 175])),
"f0 80 80 af"); |
| 139 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([248, 12
8, 128, 128, 175])), "f8 80 80 80 af"); |
| 140 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE]), utf84
_test.utf8ToRunes(JSArrayOfint().of([252, 128, 128, 128, 128, 175])), "fc 80 80
80 80 af"); |
| 141 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([193, 191])), "c1 bf"); |
| 142 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([224, 159, 191])), "e0 9
f bf"); |
| 143 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([240, 143, 191, 191])),
"f0 8f bf bf"); |
| 144 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([248, 13
5, 191, 191, 191])), "f8 87 bf bf bf"); |
| 145 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE]), utf84
_test.utf8ToRunes(JSArrayOfint().of([252, 131, 191, 191, 191, 191])), "fc 83 bf
bf bf bf"); |
| 146 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([192, 128])), "c0 80"); |
| 147 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([224, 128, 128])), "e0 8
0 80"); |
| 148 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([240, 128, 128, 128])),
"f0 80 80 80"); |
| 149 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE]), utf84_test.utf8ToRunes(JSArrayOfint().of([248, 12
8, 128, 128, 128])), "f8 80 80 80 80"); |
| 150 expect$.Expect.listEquals(JSArrayOfint().of([convert.UNICODE_REPLACEMENT_CHA
RACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACE
MENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE
_REPLACEMENT_CHARACTER_RUNE, convert.UNICODE_REPLACEMENT_CHARACTER_RUNE]), utf84
_test.utf8ToRunes(JSArrayOfint().of([252, 128, 128, 128, 128, 128])), "fc 80 80
80 80 80"); |
| 151 expect$.Expect.listEquals(JSArrayOfint().of([65534]), utf84_test.utf8ToRunes
(JSArrayOfint().of([239, 191, 190])), "U+FFFE"); |
| 152 expect$.Expect.listEquals(JSArrayOfint().of([65535]), utf84_test.utf8ToRunes
(JSArrayOfint().of([239, 191, 191])), "U+FFFF"); |
| 153 }; |
| 154 dart.fn(utf84_test.testUtf8bytesToCodepoints, VoidTovoid()); |
| 155 utf84_test.testUtf8BytesToString = function() { |
| 156 expect$.Expect.stringEquals(utf84_test.testEnglishPhrase, utf84_test.decodeU
tf8(utf84_test.testEnglishUtf8), "English"); |
| 157 expect$.Expect.stringEquals(utf84_test.testDanishPhrase, utf84_test.decodeUt
f8(utf84_test.testDanishUtf8), "Danish"); |
| 158 expect$.Expect.stringEquals(utf84_test.testHebrewPhrase, utf84_test.decodeUt
f8(utf84_test.testHebrewUtf8), "Hebrew"); |
| 159 expect$.Expect.stringEquals(utf84_test.testRussianPhrase, utf84_test.decodeU
tf8(utf84_test.testRussianUtf8), "Russian"); |
| 160 expect$.Expect.stringEquals(utf84_test.testGreekPhrase, utf84_test.decodeUtf
8(utf84_test.testGreekUtf8), "Greek"); |
| 161 expect$.Expect.stringEquals(utf84_test.testKatakanaPhrase, utf84_test.decode
Utf8(utf84_test.testKatakanaUtf8), "Katakana"); |
| 162 }; |
| 163 dart.fn(utf84_test.testUtf8BytesToString, VoidTovoid()); |
| 164 // Exports: |
| 165 exports.utf84_test = utf84_test; |
| 166 }); |
OLD | NEW |