| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env dart | |
| 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 3 // for details. All rights reserved. Use of this source code is governed by a | |
| 4 // BSD-style license that can be found in the LICENSE file. | |
| 5 | |
| 6 library unicode_tests; | |
| 7 import 'dunit.dart'; | |
| 8 | |
| 9 void main() { | |
| 10 TestSuite suite = new TestSuite(); | |
| 11 suite.registerTestClass(new UnicodeTests()); | |
| 12 suite.run(); | |
| 13 } | |
| 14 | |
| 15 class UnicodeTests extends TestClass { | |
| 16 static const String testPhrase = | |
| 17 "The quick brown fox jumps over the lazy dog."; | |
| 18 | |
| 19 static const List<int> testCodepoints = const<int> [ | |
| 20 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, | |
| 21 32, 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101, 114, | |
| 22 32, 116, 104, 101, 32, 108, 97, 122, 121, 32, 100, 111, 103, 46]; | |
| 23 | |
| 24 void registerTests(TestSuite suite) { | |
| 25 register("testCodepointsToString", testCodepointsToString, suite); | |
| 26 register("testStringCharCodes", testStringCharCodes, suite); | |
| 27 register("testEmptyStringFromCharCodes", testEmptyStringFromCharCodes, suite
); | |
| 28 register("testEmptyStringCharCodes", testEmptyStringCharCodes, suite); | |
| 29 } | |
| 30 | |
| 31 void testStringCharCodes() { | |
| 32 Expect.listEquals(testCodepoints, testPhrase.codeUnits); | |
| 33 } | |
| 34 | |
| 35 void testCodepointsToString() { | |
| 36 Expect.stringEquals(testPhrase, new String.fromCharCodes(testCodepoints)); | |
| 37 } | |
| 38 | |
| 39 void testEmptyStringFromCharCodes() { | |
| 40 Expect.stringEquals("", new String.fromCharCodes(<int>[])); | |
| 41 } | |
| 42 | |
| 43 void testEmptyStringCharCodes() { | |
| 44 Expect.listEquals([], "".codeUnits); | |
| 45 } | |
| 46 } | |
| OLD | NEW |