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 class StringReplaceTest { | 7 class StringReplaceTest { |
6 static testMain() { | 8 static testMain() { |
7 Expect.equals( | 9 Expect.equals( |
8 "AtoBtoCDtoE", "AfromBtoCDtoE".replaceFirst("from", "to")); | 10 "AtoBtoCDtoE", "AfromBtoCDtoE".replaceFirst("from", "to")); |
9 | 11 |
10 // Test with the replaced string at the begining. | 12 // Test with the replaced string at the begining. |
11 Expect.equals( | 13 Expect.equals( |
12 "toABtoCDtoE", "fromABtoCDtoE".replaceFirst("from", "to")); | 14 "toABtoCDtoE", "fromABtoCDtoE".replaceFirst("from", "to")); |
13 | 15 |
14 // Test with the replaced string at the end. | 16 // Test with the replaced string at the end. |
(...skipping 24 matching lines...) Expand all Loading... |
39 Expect.equals("to", "".replaceFirst("", "to")); | 41 Expect.equals("to", "".replaceFirst("", "to")); |
40 | 42 |
41 // Test replacing the empty string. | 43 // Test replacing the empty string. |
42 Expect.equals("toAtoBtoCto", "AtoBtoCto".replaceFirst("", "to")); | 44 Expect.equals("toAtoBtoCto", "AtoBtoCto".replaceFirst("", "to")); |
43 } | 45 } |
44 } | 46 } |
45 | 47 |
46 main() { | 48 main() { |
47 StringReplaceTest.testMain(); | 49 StringReplaceTest.testMain(); |
48 } | 50 } |
OLD | NEW |