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"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 void main() { | 7 void main() { |
8 testOutOfRange(); | 8 testOutOfRange(); |
9 testIllegalArgument(); | 9 testIllegalArgument(); |
10 testConcat(); | 10 testConcat(); |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 Expect.isFalse("str".contains("string", 0)); | 323 Expect.isFalse("str".contains("string", 0)); |
324 | 324 |
325 Expect.isTrue("str".contains("", 0)); | 325 Expect.isTrue("str".contains("", 0)); |
326 Expect.isTrue("".contains("", 0)); | 326 Expect.isTrue("".contains("", 0)); |
327 Expect.isFalse("".contains("s", 0)); | 327 Expect.isFalse("".contains("s", 0)); |
328 } | 328 } |
329 | 329 |
330 void testReplaceAll() { | 330 void testReplaceAll() { |
331 Expect.equals("AtoBtoCDtoE", "AfromBfromCDfromE".replaceAll("from", "to")); | 331 Expect.equals("AtoBtoCDtoE", "AfromBfromCDfromE".replaceAll("from", "to")); |
332 | 332 |
333 // Test with the replaced string at the begining. | 333 // Test with the replaced string at the beginning. |
334 Expect.equals("toABtoCDtoE", "fromABfromCDfromE".replaceAll("from", "to")); | 334 Expect.equals("toABtoCDtoE", "fromABfromCDfromE".replaceAll("from", "to")); |
335 | 335 |
336 // Test with the replaced string at the end. | 336 // Test with the replaced string at the end. |
337 Expect.equals( | 337 Expect.equals( |
338 "toABtoCDtoEto", "fromABfromCDfromEfrom".replaceAll("from", "to")); | 338 "toABtoCDtoEto", "fromABfromCDfromEfrom".replaceAll("from", "to")); |
339 | 339 |
340 // Test when there are no occurence of the string to replace. | 340 // Test when there are no occurence of the string to replace. |
341 Expect.equals("ABC", "ABC".replaceAll("from", "to")); | 341 Expect.equals("ABC", "ABC".replaceAll("from", "to")); |
342 | 342 |
343 // Test when the string to change is the empty string. | 343 // Test when the string to change is the empty string. |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 Expect.equals('a', ''.padRight(1, 'a')); | 485 Expect.equals('a', ''.padRight(1, 'a')); |
486 Expect.equals('aaaaa', ''.padRight(5, 'a')); | 486 Expect.equals('aaaaa', ''.padRight(5, 'a')); |
487 Expect.equals('', ''.padRight(-2, 'a')); | 487 Expect.equals('', ''.padRight(-2, 'a')); |
488 | 488 |
489 Expect.equals('xyzxyzxyzxyzxyz', ''.padRight(5, 'xyz')); | 489 Expect.equals('xyzxyzxyzxyzxyz', ''.padRight(5, 'xyz')); |
490 Expect.equals('axyzxyzxyzxyz', 'a'.padRight(5, 'xyz')); | 490 Expect.equals('axyzxyzxyzxyz', 'a'.padRight(5, 'xyz')); |
491 Expect.equals('aaxyzxyzxyz', 'aa'.padRight(5, 'xyz')); | 491 Expect.equals('aaxyzxyzxyz', 'aa'.padRight(5, 'xyz')); |
492 Expect.equals('aa\u{10002}\u{10002}\u{10002}', 'aa'.padRight(5, '\u{10002}')); | 492 Expect.equals('aa\u{10002}\u{10002}\u{10002}', 'aa'.padRight(5, '\u{10002}')); |
493 Expect.equals('a', 'a'.padRight(10, '')); | 493 Expect.equals('a', 'a'.padRight(10, '')); |
494 } | 494 } |
OLD | NEW |