Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: packages/utf/test/utf8_test.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « packages/utf/test/utf82_test.dart ('k') | packages/utf/test/utf_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library utf.utf8_test; 5 library utf.utf8_test;
6 6
7 import "package:expect/expect.dart"; 7 import 'package:test/test.dart';
8 import "package:utf/utf.dart"; 8 import "package:utf/utf.dart";
9 9
10 import 'expect.dart' as Expect;
11
10 String decode(List<int> bytes) => decodeUtf8(bytes); 12 String decode(List<int> bytes) => decodeUtf8(bytes);
11 13
12 main() { 14 void main() {
13 // Google favorite: "Îñţérñåţîöñåļîžåţîờñ". 15 test('Google favorite: "Îñţérñåţîöñåļîžåţîờñ"', () {
14 String string = decode([0xc3, 0x8e, 0xc3, 0xb1, 0xc5, 0xa3, 0xc3, 0xa9, 0x72, 16 String string = decode([
15 0xc3, 0xb1, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xc3, 17 0xc3, 0x8e, 0xc3, 0xb1, 0xc5, 0xa3, 0xc3, 0xa9, 0x72, // 8
16 0xb6, 0xc3, 0xb1, 0xc3, 0xa5, 0xc4, 0xbc, 0xc3, 0xae, 18 0xc3, 0xb1, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xc3,
17 0xc5, 0xbe, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xe1, 19 0xb6, 0xc3, 0xb1, 0xc3, 0xa5, 0xc4, 0xbc, 0xc3, 0xae,
18 0xbb, 0x9d, 0xc3, 0xb1]); 20 0xc5, 0xbe, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xe1,
19 Expect.stringEquals("Îñţérñåţîöñåļîžåţîờñ", string); 21 0xbb, 0x9d, 0xc3, 0xb1
22 ]);
23 Expect.stringEquals("Îñţérñåţîöñåļîžåţîờñ", string);
24 });
20 25
21 // Blueberry porridge in Danish: "blåbærgrød". 26 test('Blueberry porridge in Danish: "blåbærgrød"', () {
22 string = decode([0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6, 0x72, 0x67, 0x72, 27 var string = decode([
23 0xc3, 0xb8, 0x64]); 28 0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6, 0x72, 0x67, 0x72, // 8
24 Expect.stringEquals("blåbærgrød", string); 29 0xc3, 0xb8, 0x64
30 ]);
31 Expect.stringEquals("blåbærgrød", string);
32 });
25 33
26 // "சிவா அணாமாைல", that is "Siva Annamalai" in Tamil. 34 test('"சிவா அணாமாைல", that is "Siva Annamalai" in Tamil.', () {
27 string = decode([0xe0, 0xae, 0x9a, 0xe0, 0xae, 0xbf, 0xe0, 0xae, 0xb5, 0xe0, 35 var string = decode([
28 0xae, 0xbe, 0x20, 0xe0, 0xae, 0x85, 0xe0, 0xae, 0xa3, 0xe0, 36 0xe0, 0xae, 0x9a, 0xe0, 0xae, 0xbf, 0xe0, 0xae, 0xb5, 0xe0, // 8
29 0xae, 0xbe, 0xe0, 0xae, 0xae, 0xe0, 0xae, 0xbe, 0xe0, 0xaf, 37 0xae, 0xbe, 0x20, 0xe0, 0xae, 0x85, 0xe0, 0xae, 0xa3, 0xe0,
30 0x88, 0xe0, 0xae, 0xb2]); 38 0xae, 0xbe, 0xe0, 0xae, 0xae, 0xe0, 0xae, 0xbe, 0xe0, 0xaf,
31 Expect.stringEquals("சிவா அணாமாைல", string); 39 0x88, 0xe0, 0xae, 0xb2
40 ]);
41 Expect.stringEquals("சிவா அணாமாைல", string);
42 });
32 43
33 // "िसवा अणामालै", that is "Siva Annamalai" in Devanagari. 44 test('"िसवा अणामालै", that is "Siva Annamalai" in Devanagari', () {
34 string = decode([0xe0, 0xa4, 0xbf, 0xe0, 0xa4, 0xb8, 0xe0, 0xa4, 0xb5, 0xe0, 45 var string = decode([
35 0xa4, 0xbe, 0x20, 0xe0, 0xa4, 0x85, 0xe0, 0xa4, 0xa3, 0xe0, 46 0xe0, 0xa4, 0xbf, 0xe0, 0xa4, 0xb8, 0xe0, 0xa4, 0xb5, 0xe0, // 8
36 0xa4, 0xbe, 0xe0, 0xa4, 0xae, 0xe0, 0xa4, 0xbe, 0xe0, 0xa4, 47 0xa4, 0xbe, 0x20, 0xe0, 0xa4, 0x85, 0xe0, 0xa4, 0xa3, 0xe0,
37 0xb2, 0xe0, 0xa5, 0x88]); 48 0xa4, 0xbe, 0xe0, 0xa4, 0xae, 0xe0, 0xa4, 0xbe, 0xe0, 0xa4,
38 Expect.stringEquals("िसवा अणामालै", string); 49 0xb2, 0xe0, 0xa5, 0x88
50 ]);
51 Expect.stringEquals("िसवा अणामालै", string);
52 });
39 53
40 // DESERET CAPITAL LETTER BEE, unicode 0x10412(0xD801+0xDC12) 54 test('DESERET CAPITAL LETTER BEE, unicode 0x10412(0xD801+0xDC12', () {
41 // UTF-8: F0 90 90 92 55 // UTF-8: F0 90 90 92
42 string = decode([0xf0, 0x90, 0x90, 0x92]); 56 var string = decode([0xf0, 0x90, 0x90, 0x92]);
43 Expect.equals(string.length, 2); 57 Expect.equals(string.length, 2);
44 Expect.equals("𐐒".length, 2); 58 Expect.equals("𐐒".length, 2);
45 Expect.stringEquals("𐐒", string); 59 Expect.stringEquals("𐐒", string);
46 60 });
47 // TODO(ahe): Add tests of bad input. 61 // TODO(ahe): Add tests of bad input.
48 } 62 }
OLDNEW
« no previous file with comments | « packages/utf/test/utf82_test.dart ('k') | packages/utf/test/utf_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698