| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "package:expect/expect.dart"; |
| 6 |
| 5 // Dart test program for testing class 'Strings'. | 7 // Dart test program for testing class 'Strings'. |
| 6 | 8 |
| 7 class StringsTest { | 9 class StringsTest { |
| 8 | 10 |
| 9 StringsTest() {} | 11 StringsTest() {} |
| 10 | 12 |
| 11 toString() { | 13 toString() { |
| 12 return "Strings Tester"; | 14 return "Strings Tester"; |
| 13 } | 15 } |
| 14 static testCreation() { | 16 static testCreation() { |
| 15 String s = "Hello"; | 17 String s = "Hello"; |
| 16 List<int> l = new List(s.length); | 18 List<int> l = new List(s.length); |
| 17 for (int i = 0; i < l.length; i++) { | 19 for (int i = 0; i < l.length; i++) { |
| 18 l[i] = s.codeUnitAt(i); | 20 l[i] = s.codeUnitAt(i); |
| 19 } | 21 } |
| 20 String s2 = new String.fromCharCodes(l); | 22 String s2 = new String.fromCharCodes(l); |
| 21 Expect.equals(s, s2); | 23 Expect.equals(s, s2); |
| 22 } | 24 } |
| 23 | 25 |
| 24 static void testMain() { | 26 static void testMain() { |
| 25 testCreation(); | 27 testCreation(); |
| 26 } | 28 } |
| 27 } | 29 } |
| 28 | 30 |
| 29 | 31 |
| 30 main() { | 32 main() { |
| 31 StringsTest.testMain(); | 33 StringsTest.testMain(); |
| 32 } | 34 } |
| OLD | NEW |