OLD | NEW |
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.utf82_test; |
| 6 |
5 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
6 import 'package:utf/utf.dart'; | 8 import 'package:utf/utf.dart'; |
7 | 9 |
8 const String testEnglishPhrase = | 10 const String testEnglishPhrase = |
9 "The quick brown fox jumps over the lazy dog."; | 11 "The quick brown fox jumps over the lazy dog."; |
10 | 12 |
11 const List<int> testEnglishUtf8 = const<int> [ | 13 const List<int> testEnglishUtf8 = const<int> [ |
12 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63, | 14 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63, |
13 0x6b, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x6e, 0x20, | 15 0x6b, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x6e, 0x20, |
14 0x66, 0x6f, 0x78, 0x20, 0x6a, 0x75, 0x6d, 0x70, | 16 0x66, 0x6f, 0x78, 0x20, 0x6a, 0x75, 0x6d, 0x70, |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 Expect.stringEquals(testEnglishPhrase, | 456 Expect.stringEquals(testEnglishPhrase, |
455 new String.fromCharCodes(new List<int>.from(englishDecoder))); | 457 new String.fromCharCodes(new List<int>.from(englishDecoder))); |
456 | 458 |
457 IterableUtf8Decoder kataDecoder = decodeUtf8AsIterable(testKatakanaUtf8); | 459 IterableUtf8Decoder kataDecoder = decodeUtf8AsIterable(testKatakanaUtf8); |
458 // get the first character | 460 // get the first character |
459 Expect.equals(testKatakanaPhrase.codeUnits[0], kataDecoder.first); | 461 Expect.equals(testKatakanaPhrase.codeUnits[0], kataDecoder.first); |
460 // get the whole translation using the Iterable interface | 462 // get the whole translation using the Iterable interface |
461 Expect.stringEquals(testKatakanaPhrase, | 463 Expect.stringEquals(testKatakanaPhrase, |
462 new String.fromCharCodes(new List<int>.from(kataDecoder))); | 464 new String.fromCharCodes(new List<int>.from(kataDecoder))); |
463 } | 465 } |
OLD | NEW |