| Index: tests/corelib/string_replace_all_test.dart
|
| diff --git a/tests/corelib/string_replace_all_test.dart b/tests/corelib/string_replace_all_test.dart
|
| index f63a9f7dc80c3e0e17ff02fe1b887e3ed4861d03..79c5674f9bcc95379c351dd635c00d4a9b063559 100644
|
| --- a/tests/corelib/string_replace_all_test.dart
|
| +++ b/tests/corelib/string_replace_all_test.dart
|
| @@ -5,20 +5,16 @@
|
| import "package:expect/expect.dart";
|
|
|
| testReplaceAll() {
|
| - Expect.equals(
|
| - "aXXcaXXdae", "abcabdae".replaceAll("b", "XX"));
|
| + Expect.equals("aXXcaXXdae", "abcabdae".replaceAll("b", "XX"));
|
|
|
| // Test with the replaced string at the begining.
|
| - Expect.equals(
|
| - "XXbcXXbdXXe", "abcabdae".replaceAll("a", "XX"));
|
| + Expect.equals("XXbcXXbdXXe", "abcabdae".replaceAll("a", "XX"));
|
|
|
| // Test with the replaced string at the end.
|
| - Expect.equals(
|
| - "abcabdaXX", "abcabdae".replaceAll("e", "XX"));
|
| + Expect.equals("abcabdaXX", "abcabdae".replaceAll("e", "XX"));
|
|
|
| // Test when there are no occurence of the string to replace.
|
| - Expect.equals(
|
| - "abcabdae", "abcabdae".replaceAll("f", "XX"));
|
| + Expect.equals("abcabdae", "abcabdae".replaceAll("f", "XX"));
|
|
|
| // Test when the string to change is the empty string.
|
| Expect.equals("", "".replaceAll("from", "to"));
|
| @@ -37,8 +33,7 @@ testReplaceAll() {
|
| Expect.equals("to", "to".replaceAll("from", "to"));
|
|
|
| // Test replacing by the empty string.
|
| - Expect.equals(
|
| - "bcbde", "abcabdae".replaceAll("a", ""));
|
| + Expect.equals("bcbde", "abcabdae".replaceAll("a", ""));
|
| Expect.equals("AB", "AfromB".replaceAll("from", ""));
|
|
|
| // Test changing the empty string.
|
| @@ -60,20 +55,16 @@ testReplaceAll() {
|
|
|
| testReplaceAllMapped() {
|
| String mark(Match m) => "[${m[0]}]";
|
| - Expect.equals(
|
| - "a[b]ca[b]dae", "abcabdae".replaceAllMapped("b", mark));
|
| + Expect.equals("a[b]ca[b]dae", "abcabdae".replaceAllMapped("b", mark));
|
|
|
| // Test with the replaced string at the begining.
|
| - Expect.equals(
|
| - "[a]bc[a]bd[a]e", "abcabdae".replaceAllMapped("a", mark));
|
| + Expect.equals("[a]bc[a]bd[a]e", "abcabdae".replaceAllMapped("a", mark));
|
|
|
| // Test with the replaced string at the end.
|
| - Expect.equals(
|
| - "abcabda[e]", "abcabdae".replaceAllMapped("e", mark));
|
| + Expect.equals("abcabda[e]", "abcabdae".replaceAllMapped("e", mark));
|
|
|
| // Test when there are no occurence of the string to replace.
|
| - Expect.equals(
|
| - "abcabdae", "abcabdae".replaceAllMapped("f", mark));
|
| + Expect.equals("abcabdae", "abcabdae".replaceAllMapped("f", mark));
|
|
|
| // Test when the string to change is the empty string.
|
| Expect.equals("", "".replaceAllMapped("from", mark));
|
| @@ -86,8 +77,7 @@ testReplaceAllMapped() {
|
| Expect.equals("[from][from]", "fromfrom".replaceAllMapped("from", mark));
|
|
|
| // Test replacing by the empty string.
|
| - Expect.equals(
|
| - "bcbde", "abcabdae".replaceAllMapped("a", (m) => ""));
|
| + Expect.equals("bcbde", "abcabdae".replaceAllMapped("a", (m) => ""));
|
| Expect.equals("AB", "AfromB".replaceAllMapped("from", (m) => ""));
|
|
|
| // Test changing the empty string.
|
| @@ -101,23 +91,19 @@ testSplitMapJoin() {
|
| String mark(Match m) => "[${m[0]}]";
|
| String wrap(String s) => "<${s}>";
|
|
|
| - Expect.equals(
|
| - "<a>[b]<ca>[b]<dae>",
|
| + Expect.equals("<a>[b]<ca>[b]<dae>",
|
| "abcabdae".splitMapJoin("b", onMatch: mark, onNonMatch: wrap));
|
|
|
| // Test with the replaced string at the begining.
|
| - Expect.equals(
|
| - "<>[a]<bc>[a]<bd>[a]<e>",
|
| + Expect.equals("<>[a]<bc>[a]<bd>[a]<e>",
|
| "abcabdae".splitMapJoin("a", onMatch: mark, onNonMatch: wrap));
|
|
|
| // Test with the replaced string at the end.
|
| - Expect.equals(
|
| - "<abcabda>[e]<>",
|
| + Expect.equals("<abcabda>[e]<>",
|
| "abcabdae".splitMapJoin("e", onMatch: mark, onNonMatch: wrap));
|
|
|
| // Test when there are no occurence of the string to replace.
|
| - Expect.equals(
|
| - "<abcabdae>",
|
| + Expect.equals("<abcabdae>",
|
| "abcabdae".splitMapJoin("f", onMatch: mark, onNonMatch: wrap));
|
|
|
| // Test when the string to change is the empty string.
|
| @@ -125,31 +111,26 @@ testSplitMapJoin() {
|
|
|
| // Test when the string to change is a substring of the string to
|
| // replace.
|
| - Expect.equals("<fro>",
|
| - "fro".splitMapJoin("from", onMatch: mark, onNonMatch: wrap));
|
| + Expect.equals(
|
| + "<fro>", "fro".splitMapJoin("from", onMatch: mark, onNonMatch: wrap));
|
|
|
| // Test when matches are adjacent
|
| Expect.equals("<>[from]<>[from]<>",
|
| - "fromfrom".splitMapJoin("from", onMatch: mark, onNonMatch: wrap));
|
| + "fromfrom".splitMapJoin("from", onMatch: mark, onNonMatch: wrap));
|
|
|
| // Test changing the empty string.
|
| Expect.equals("<>[]<>", "".splitMapJoin("", onMatch: mark, onNonMatch: wrap));
|
|
|
| // Test replacing the empty string.
|
| - Expect.equals("<>[]<A>[]<B>[]<C>[]<>", "ABC".splitMapJoin("", onMatch: mark,
|
| - onNonMatch: wrap));
|
| + Expect.equals("<>[]<A>[]<B>[]<C>[]<>",
|
| + "ABC".splitMapJoin("", onMatch: mark, onNonMatch: wrap));
|
|
|
| // Test with only onMatch.
|
| - Expect.equals(
|
| - "[a]bc[a]bd[a]e",
|
| - "abcabdae".splitMapJoin("a", onMatch: mark));
|
| -
|
| + Expect.equals("[a]bc[a]bd[a]e", "abcabdae".splitMapJoin("a", onMatch: mark));
|
|
|
| // Test with only onNonMatch
|
| Expect.equals(
|
| - "<>a<bc>a<bd>a<e>",
|
| - "abcabdae".splitMapJoin("a", onNonMatch: wrap));
|
| -
|
| + "<>a<bc>a<bd>a<e>", "abcabdae".splitMapJoin("a", onNonMatch: wrap));
|
| }
|
|
|
| main() {
|
|
|