Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
|
Søren Gjesse
2013/07/24 09:26:41
No need for this change.
floitsch
2013/07/24 18:31:15
Done.
| |
| 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 utf8_test; | 5 library utf8_test; |
| 6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 String decode(List<int> bytes) => new Utf8Decoder().convert(bytes); | 9 String decode(List<int> bytes) => new Utf8Decoder().convert(bytes); |
| 10 | 10 |
| 11 main() { | 11 main() { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 35 0xa4, 0xbe, 0xe0, 0xa4, 0xae, 0xe0, 0xa4, 0xbe, 0xe0, 0xa4, | 35 0xa4, 0xbe, 0xe0, 0xa4, 0xae, 0xe0, 0xa4, 0xbe, 0xe0, 0xa4, |
| 36 0xb2, 0xe0, 0xa5, 0x88]); | 36 0xb2, 0xe0, 0xa5, 0x88]); |
| 37 Expect.stringEquals("िसवा अणामालै", string); | 37 Expect.stringEquals("िसवा अणामालै", string); |
| 38 | 38 |
| 39 // DESERET CAPITAL LETTER BEE, unicode 0x10412(0xD801+0xDC12) | 39 // DESERET CAPITAL LETTER BEE, unicode 0x10412(0xD801+0xDC12) |
| 40 // UTF-8: F0 90 90 92 | 40 // UTF-8: F0 90 90 92 |
| 41 string = decode([0xf0, 0x90, 0x90, 0x92]); | 41 string = decode([0xf0, 0x90, 0x90, 0x92]); |
| 42 Expect.equals(string.length, 2); | 42 Expect.equals(string.length, 2); |
| 43 Expect.equals("𐐒".length, 2); | 43 Expect.equals("𐐒".length, 2); |
| 44 Expect.stringEquals("𐐒", string); | 44 Expect.stringEquals("𐐒", string); |
| 45 | |
| 46 // TODO(ahe): Add tests of bad input. | |
| 47 } | 45 } |
| OLD | NEW |