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

Unified Diff: tests/lib/convert/unicode_tests.dart

Issue 19883003: Add chunked conversion to converters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 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 | « tests/lib/convert/chunked_conversion_utf8_test.dart ('k') | tests/lib/convert/utf8_encode_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/convert/unicode_tests.dart
diff --git a/tests/lib/convert/utf8_encode_test.dart b/tests/lib/convert/unicode_tests.dart
similarity index 85%
copy from tests/lib/convert/utf8_encode_test.dart
copy to tests/lib/convert/unicode_tests.dart
index 3aa208c11641a937449a52f74bc377401d5e6aa8..582830737d04263861b75d0204f26f6071f3efba 100644
--- a/tests/lib/convert/utf8_encode_test.dart
+++ b/tests/lib/convert/unicode_tests.dart
@@ -2,9 +2,7 @@
// 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.
-library utf8_test;
-import "package:expect/expect.dart";
-import 'dart:convert';
+library utf8_tests;
// Google favorite: "Îñţérñåţîöñåļîžåţîờñ".
const INTER_BYTES = const [0xc3, 0x8e, 0xc3, 0xb1, 0xc5, 0xa3, 0xc3, 0xa9, 0x72,
@@ -47,7 +45,7 @@ const ASCII_BYTES = const [ 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
0x79, 0x7A ];
const ASCII_STRING = "abcdefghijklmnopqrstuvwxyz";
-const TESTS = const [
+const _TEST_PAIRS = const [
const [ const [], "" ],
const [ INTER_BYTES, INTER_STRING ],
const [ BLUEBERRY_BYTES, BLUEBERRY_STRING ],
@@ -57,12 +55,11 @@ const TESTS = const [
const [ DIGIT_BYTES, DIGIT_STRING ],
const [ ASCII_BYTES, ASCII_STRING ]];
-List<int> encode(String str) => new Utf8Encoder().convert(str);
-List<int> encode2(String str) => UTF8.encode(str);
-
-main() {
- Expect.equals(2, BEE_STRING.length);
- var tests = TESTS.expand((test) {
+_expandTestPairs() {
+ assert(2 == BEE_STRING.length);
+ var tests = [];
+ tests.addAll(_TEST_PAIRS);
+ tests.addAll(_TEST_PAIRS.expand((test) {
var bytes = test[0];
var string = test[1];
var longBytes = [];
@@ -72,11 +69,8 @@ main() {
longString += string;
}
return [test, [longBytes, longString]];
- });
- for (var test in tests) {
- List<int> bytes = test[0];
- String string = test[1];
- Expect.listEquals(bytes, encode(string));
- Expect.listEquals(bytes, encode2(string));
- }
+ }));
+ return tests;
}
+
+final List UNICODE_TESTS = _expandTestPairs();
« no previous file with comments | « tests/lib/convert/chunked_conversion_utf8_test.dart ('k') | tests/lib/convert/utf8_encode_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698