OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 translateSingleFile( | 866 translateSingleFile( |
867 "// filler filler filler filler filler filler filler filler filler fille
r", | 867 "// filler filler filler filler filler filler filler filler filler fille
r", |
868 "package test;", | 868 "package test;", |
869 "public class Test {", | 869 "public class Test {", |
870 " public String testA(String s, String p, String r) {", | 870 " public String testA(String s, String p, String r) {", |
871 " return s.replace(p, r);", | 871 " return s.replace(p, r);", |
872 " }", | 872 " }", |
873 " public String testB(String s, String r) {", | 873 " public String testB(String s, String r) {", |
874 " return s.replace('/', r);", | 874 " return s.replace('/', r);", |
875 " }", | 875 " }", |
| 876 " public String testC(String s, char r) {", |
| 877 " return s.replace('/', r);", |
| 878 " }", |
876 "}"); | 879 "}"); |
877 runProcessor(); | 880 runProcessor(); |
878 assertFormattedSource( | 881 assertFormattedSource( |
879 "class Test {", | 882 "class Test {", |
880 " String testA(String s, String p, String r) => s.replaceAll(p, r);", | 883 " String testA(String s, String p, String r) => s.replaceAll(p, r);", |
881 " String testB(String s, String r) => s.replaceAll('/', r);", | 884 " String testB(String s, String r) => s.replaceAll('/', r);", |
| 885 " String testC(String s, int r) => s.replaceAll('/', new String.fromCha
rCode(r));", |
882 "}"); | 886 "}"); |
883 } | 887 } |
884 | 888 |
885 public void test_String_startsWith() throws Exception { | 889 public void test_String_startsWith() throws Exception { |
886 translateSingleFile( | 890 translateSingleFile( |
887 "// filler filler filler filler filler filler filler filler filler fille
r", | 891 "// filler filler filler filler filler filler filler filler filler fille
r", |
888 "package test;", | 892 "package test;", |
889 "public class Test {", | 893 "public class Test {", |
890 " public boolean main(String s, String prefix, int index) {", | 894 " public boolean main(String s, String prefix, int index) {", |
891 " return s.startsWith(prefix, index);", | 895 " return s.startsWith(prefix, index);", |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 " main(Exception e) {", | 991 " main(Exception e) {", |
988 " print(e);", | 992 " print(e);", |
989 " }", | 993 " }", |
990 "}"); | 994 "}"); |
991 } | 995 } |
992 | 996 |
993 private void runProcessor() { | 997 private void runProcessor() { |
994 new ObjectSemanticProcessor(context).process(unit); | 998 new ObjectSemanticProcessor(context).process(unit); |
995 } | 999 } |
996 } | 1000 } |
OLD | NEW |