Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:io'; | 5 import 'dart:io'; |
| 6 import 'dart:convert'; | 6 import 'dart:convert'; |
| 7 | 7 |
| 8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 | 9 |
| 10 // This only works reliabily for "ASCII" cross platform as that is the only | 10 // This only works reliabily for "ASCII" cross platform as that is the only |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 testDecodeEncode(bytes); | 29 testDecodeEncode(bytes); |
| 30 testEncodeDecode(str); | 30 testEncodeDecode(str); |
| 31 } | 31 } |
| 32 | 32 |
| 33 main() { | 33 main() { |
| 34 test([65, 66, 67]); | 34 test([65, 66, 67]); |
| 35 test([65, 0, 67]); | 35 test([65, 0, 67]); |
| 36 test([0, 65, 0, 67, 0]); | 36 test([0, 65, 0, 67, 0]); |
| 37 test([0, 0, 0]); | 37 test([0, 0, 0]); |
| 38 test(new Iterable.generate(128, (i) => i).toList()); | 38 test(new Iterable.generate(128, (i) => i).toList()); |
| 39 // This might break on some Windows systems. | |
| 40 testEncodeDecode('\u00c6\u00d8\u00c5'); | |
|
ricow1
2015/06/25 07:03:38
couldn't you just move it down to line 50 if this
| |
| 41 if (Platform.isWindows) { | 39 if (Platform.isWindows) { |
| 42 // On Windows the default Windows code page cannot encode these | 40 // On Windows the default Windows code page cannot encode these |
| 43 // Unicode characters and the ? character is used. | 41 // Unicode characters and the ? character is used. |
| 44 Expect.listEquals( | 42 Expect.listEquals( |
| 45 SYSTEM_ENCODING.encode('\u1234\u5678\u9abc'), | 43 SYSTEM_ENCODING.encode('\u1234\u5678\u9abc'), |
| 46 '???'.codeUnits); | 44 '???'.codeUnits); |
| 47 } else { | 45 } else { |
| 48 // On all systems except for Windows UTF-8 is used as the system | 46 // On all systems except for Windows UTF-8 is used as the system |
| 49 // encoding. | 47 // encoding. |
| 50 Expect.listEquals( | 48 Expect.listEquals( |
| 51 SYSTEM_ENCODING.encode('\u1234\u5678\u9abc'), | 49 SYSTEM_ENCODING.encode('\u1234\u5678\u9abc'), |
| 52 UTF8.encode('\u1234\u5678\u9abc')); | 50 UTF8.encode('\u1234\u5678\u9abc')); |
| 53 } | 51 } |
| 54 } | 52 } |
| OLD | NEW |