| 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();
|
|
|