OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'package:expect/expect.dart'; |
| 6 |
| 7 const String testPhrase = |
| 8 "The quick brown fox jumps over the lazy dog."; |
| 9 |
| 10 const List<int> testCodepoints = const<int> [ |
| 11 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, |
| 12 32, 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101, 114, |
| 13 32, 116, 104, 101, 32, 108, 97, 122, 121, 32, 100, 111, 103, 46]; |
| 14 |
| 15 main() { |
| 16 testCodepointsToString(); |
| 17 testStringCharCodes(); |
| 18 testEmptyStringFromCharCodes(); |
| 19 testEmptyStringCharCodes(); |
| 20 } |
| 21 |
| 22 void testStringCharCodes() { |
| 23 Expect.listEquals(testCodepoints, testPhrase.codeUnits); |
| 24 } |
| 25 |
| 26 void testCodepointsToString() { |
| 27 Expect.stringEquals(testPhrase, new String.fromCharCodes(testCodepoints)); |
| 28 } |
| 29 |
| 30 void testEmptyStringFromCharCodes() { |
| 31 Expect.stringEquals("", new String.fromCharCodes(<int>[])); |
| 32 } |
| 33 |
| 34 void testEmptyStringCharCodes() { |
| 35 Expect.listEquals([], "".codeUnits); |
| 36 } |
OLD | NEW |