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

Unified 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, 5 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/utf/test/utf8_test.dart
diff --git a/packages/utf/test/utf8_test.dart b/packages/utf/test/utf8_test.dart
index 3e8c87e92706ba50b7edcb51147a71c72ed2f928..306efe492afe9f6345572188584d3f03766c7810 100644
--- a/packages/utf/test/utf8_test.dart
+++ b/packages/utf/test/utf8_test.dart
@@ -4,45 +4,59 @@
library utf.utf8_test;
-import "package:expect/expect.dart";
+import 'package:test/test.dart';
import "package:utf/utf.dart";
-String decode(List<int> bytes) => decodeUtf8(bytes);
+import 'expect.dart' as Expect;
-main() {
- // Google favorite: "Îñţérñåţîöñåļîžåţîờñ".
- String string = decode([0xc3, 0x8e, 0xc3, 0xb1, 0xc5, 0xa3, 0xc3, 0xa9, 0x72,
- 0xc3, 0xb1, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xc3,
- 0xb6, 0xc3, 0xb1, 0xc3, 0xa5, 0xc4, 0xbc, 0xc3, 0xae,
- 0xc5, 0xbe, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xe1,
- 0xbb, 0x9d, 0xc3, 0xb1]);
- Expect.stringEquals("Îñţérñåţîöñåļîžåţîờñ", string);
-
- // Blueberry porridge in Danish: "blåbærgrød".
- string = decode([0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6, 0x72, 0x67, 0x72,
- 0xc3, 0xb8, 0x64]);
- Expect.stringEquals("blåbærgrød", string);
-
- // "சிவா அணாமாைல", that is "Siva Annamalai" in Tamil.
- string = decode([0xe0, 0xae, 0x9a, 0xe0, 0xae, 0xbf, 0xe0, 0xae, 0xb5, 0xe0,
- 0xae, 0xbe, 0x20, 0xe0, 0xae, 0x85, 0xe0, 0xae, 0xa3, 0xe0,
- 0xae, 0xbe, 0xe0, 0xae, 0xae, 0xe0, 0xae, 0xbe, 0xe0, 0xaf,
- 0x88, 0xe0, 0xae, 0xb2]);
- Expect.stringEquals("சிவா அணாமாைல", string);
-
- // "िसवा अणामालै", that is "Siva Annamalai" in Devanagari.
- string = decode([0xe0, 0xa4, 0xbf, 0xe0, 0xa4, 0xb8, 0xe0, 0xa4, 0xb5, 0xe0,
- 0xa4, 0xbe, 0x20, 0xe0, 0xa4, 0x85, 0xe0, 0xa4, 0xa3, 0xe0,
- 0xa4, 0xbe, 0xe0, 0xa4, 0xae, 0xe0, 0xa4, 0xbe, 0xe0, 0xa4,
- 0xb2, 0xe0, 0xa5, 0x88]);
- Expect.stringEquals("िसवा अणामालै", string);
-
- // DESERET CAPITAL LETTER BEE, unicode 0x10412(0xD801+0xDC12)
- // UTF-8: F0 90 90 92
- string = decode([0xf0, 0x90, 0x90, 0x92]);
- Expect.equals(string.length, 2);
- Expect.equals("𐐒".length, 2);
- Expect.stringEquals("𐐒", string);
+String decode(List<int> bytes) => decodeUtf8(bytes);
+void main() {
+ test('Google favorite: "Îñţérñåţîöñåļîžåţîờñ"', () {
+ String string = decode([
+ 0xc3, 0x8e, 0xc3, 0xb1, 0xc5, 0xa3, 0xc3, 0xa9, 0x72, // 8
+ 0xc3, 0xb1, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xc3,
+ 0xb6, 0xc3, 0xb1, 0xc3, 0xa5, 0xc4, 0xbc, 0xc3, 0xae,
+ 0xc5, 0xbe, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xe1,
+ 0xbb, 0x9d, 0xc3, 0xb1
+ ]);
+ Expect.stringEquals("Îñţérñåţîöñåļîžåţîờñ", string);
+ });
+
+ test('Blueberry porridge in Danish: "blåbærgrød"', () {
+ var string = decode([
+ 0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6, 0x72, 0x67, 0x72, // 8
+ 0xc3, 0xb8, 0x64
+ ]);
+ Expect.stringEquals("blåbærgrød", string);
+ });
+
+ test('"சிவா அணாமாைல", that is "Siva Annamalai" in Tamil.', () {
+ var string = decode([
+ 0xe0, 0xae, 0x9a, 0xe0, 0xae, 0xbf, 0xe0, 0xae, 0xb5, 0xe0, // 8
+ 0xae, 0xbe, 0x20, 0xe0, 0xae, 0x85, 0xe0, 0xae, 0xa3, 0xe0,
+ 0xae, 0xbe, 0xe0, 0xae, 0xae, 0xe0, 0xae, 0xbe, 0xe0, 0xaf,
+ 0x88, 0xe0, 0xae, 0xb2
+ ]);
+ Expect.stringEquals("சிவா அணாமாைல", string);
+ });
+
+ test('"िसवा अणामालै", that is "Siva Annamalai" in Devanagari', () {
+ var string = decode([
+ 0xe0, 0xa4, 0xbf, 0xe0, 0xa4, 0xb8, 0xe0, 0xa4, 0xb5, 0xe0, // 8
+ 0xa4, 0xbe, 0x20, 0xe0, 0xa4, 0x85, 0xe0, 0xa4, 0xa3, 0xe0,
+ 0xa4, 0xbe, 0xe0, 0xa4, 0xae, 0xe0, 0xa4, 0xbe, 0xe0, 0xa4,
+ 0xb2, 0xe0, 0xa5, 0x88
+ ]);
+ Expect.stringEquals("िसवा अणामालै", string);
+ });
+
+ test('DESERET CAPITAL LETTER BEE, unicode 0x10412(0xD801+0xDC12', () {
+ // UTF-8: F0 90 90 92
+ var string = decode([0xf0, 0x90, 0x90, 0x92]);
+ Expect.equals(string.length, 2);
+ Expect.equals("𐐒".length, 2);
+ Expect.stringEquals("𐐒", string);
+ });
// TODO(ahe): Add tests of bad input.
}
« 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