OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, 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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 Context context = new Context(); | 881 Context context = new Context(); |
882 context.addSourceFolder(tmpFolder); | 882 context.addSourceFolder(tmpFolder); |
883 context.addSourceFiles(tmpFolder); | 883 context.addSourceFiles(tmpFolder); |
884 CompilationUnit unit = context.translate(); | 884 CompilationUnit unit = context.translate(); |
885 assertEquals(toString(// | 885 assertEquals(toString(// |
886 "class A {", | 886 "class A {", |
887 " bool testA(Class a, Class b) => a == b;", | 887 " bool testA(Class a, Class b) => a == b;", |
888 "}"), getFormattedSource(unit)); | 888 "}"), getFormattedSource(unit)); |
889 } | 889 } |
890 | 890 |
| 891 public void test_forbiddenNames_forEach() throws Exception { |
| 892 File file = setFileLines( |
| 893 "test/Test.java", |
| 894 toString( |
| 895 "// filler filler filler filler filler filler filler filler filler f
iller", |
| 896 "package test;", |
| 897 "public class Test {", |
| 898 " static void main(String [] vars) {", |
| 899 " for (String var: vars) {", |
| 900 " print(var);", |
| 901 " }", |
| 902 " }", |
| 903 " static void print(String p) {}", |
| 904 "}", |
| 905 "")); |
| 906 Context context = new Context(); |
| 907 context.addSourceFolder(tmpFolder); |
| 908 context.addSourceFile(file); |
| 909 CompilationUnit unit = context.translate(); |
| 910 assertEquals( |
| 911 toString( |
| 912 "class Test {", |
| 913 " static void main(List<String> vars) {", |
| 914 " for (String var2 in vars) {", |
| 915 " print(var2);", |
| 916 " }", |
| 917 " }", |
| 918 " static void print(String p) {", |
| 919 " }", |
| 920 "}"), |
| 921 getFormattedSource(unit)); |
| 922 } |
| 923 |
891 public void test_forbiddenNames_methods() throws Exception { | 924 public void test_forbiddenNames_methods() throws Exception { |
892 setFileLines( | 925 setFileLines( |
893 "test/Test.java", | 926 "test/Test.java", |
894 toString( | 927 toString( |
895 "// filler filler filler filler filler filler filler filler filler f
iller", | 928 "// filler filler filler filler filler filler filler filler filler f
iller", |
896 "package test;", | 929 "package test;", |
897 "public class Test {", | 930 "public class Test {", |
898 " void in() {}", | 931 " void in() {}", |
899 " void with() {}", | 932 " void with() {}", |
900 " void with(int p) {}", | 933 " void with(int p) {}", |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2059 " Test_A(List<int> args) {", | 2092 " Test_A(List<int> args) {", |
2060 " }", | 2093 " }", |
2061 "}", | 2094 "}", |
2062 "class Test_B extends Test_A {", | 2095 "class Test_B extends Test_A {", |
2063 " Test_B(List<int> args) : super(args) {", | 2096 " Test_B(List<int> args) : super(args) {", |
2064 " }", | 2097 " }", |
2065 "}"), | 2098 "}"), |
2066 getFormattedSource(unit)); | 2099 getFormattedSource(unit)); |
2067 } | 2100 } |
2068 } | 2101 } |
OLD | NEW |