| 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 // TODO(ngeoffray): test String methods with null arguments. | 5 // TODO(ngeoffray): test String methods with null arguments. |
| 6 class StringTest { | 6 class StringTest { |
| 7 | 7 |
| 8 static testMain() { | 8 static testMain() { |
| 9 testOutOfRange(); | 9 testOutOfRange(); |
| 10 testIllegalArgument(); | 10 testIllegalArgument(); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 Expect.equals(4, "strstr".lastIndexOf("t", 5)); | 186 Expect.equals(4, "strstr".lastIndexOf("t", 5)); |
| 187 Expect.equals(4, "strstr".lastIndexOf("tr", 5)); | 187 Expect.equals(4, "strstr".lastIndexOf("tr", 5)); |
| 188 Expect.equals(3, "strstr".lastIndexOf("str", 5)); | 188 Expect.equals(3, "strstr".lastIndexOf("str", 5)); |
| 189 Expect.equals(3, "strstr".lastIndexOf("str", 5)); | 189 Expect.equals(3, "strstr".lastIndexOf("str", 5)); |
| 190 Expect.equals(3, "strstr".lastIndexOf("str", 5)); | 190 Expect.equals(3, "strstr".lastIndexOf("str", 5)); |
| 191 Expect.equals(3, "strstr".lastIndexOf("st", 5)); | 191 Expect.equals(3, "strstr".lastIndexOf("st", 5)); |
| 192 Expect.equals(3, "strstr".lastIndexOf("s", 5)); | 192 Expect.equals(3, "strstr".lastIndexOf("s", 5)); |
| 193 Expect.equals(5, "strstr".lastIndexOf("r", 5)); | 193 Expect.equals(5, "strstr".lastIndexOf("r", 5)); |
| 194 Expect.equals(2, "strstr".lastIndexOf("r", 4)); | 194 Expect.equals(2, "strstr".lastIndexOf("r", 4)); |
| 195 Expect.equals(2, "strstr".lastIndexOf("r", 3)); | 195 Expect.equals(2, "strstr".lastIndexOf("r", 3)); |
| 196 Expect.equals(5, "strstr".lastIndexOf("r")); |
| 197 Expect.equals(5, "strstr".lastIndexOf("r"), null); |
| 196 | 198 |
| 197 String str = "hello"; | 199 String str = "hello"; |
| 198 for (int i = 0; i < 10; i++) { | 200 for (int i = 0; i < 10; i++) { |
| 199 int result = str.lastIndexOf("", i); | 201 int result = str.lastIndexOf("", i); |
| 200 if (i > str.length) { | 202 if (i > str.length) { |
| 201 Expect.equals(str.length, result); | 203 Expect.equals(str.length, result); |
| 202 } else { | 204 } else { |
| 203 Expect.equals(i, result); | 205 Expect.equals(i, result); |
| 204 } | 206 } |
| 205 } | 207 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 294 } |
| 293 test("abc"); | 295 test("abc"); |
| 294 test(""); | 296 test(""); |
| 295 test(" "); | 297 test(" "); |
| 296 } | 298 } |
| 297 } | 299 } |
| 298 | 300 |
| 299 main() { | 301 main() { |
| 300 StringTest.testMain(); | 302 StringTest.testMain(); |
| 301 } | 303 } |
| OLD | NEW |