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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 "int get newName() {", | 143 "int get newName() {", |
144 " return 42;", | 144 " return 42;", |
145 "}", | 145 "}", |
146 "f() {", | 146 "f() {", |
147 " print(newName);", | 147 " print(newName);", |
148 "}", | 148 "}", |
149 ""); | 149 ""); |
150 } | 150 } |
151 | 151 |
152 public void test_OK_multipleUnits_onReference() throws Exception { | 152 public void test_OK_multipleUnits_onReference() throws Exception { |
153 setUnitContent("Test1.dart", new String[] { | 153 setUnitContent( |
| 154 "Test1.dart", |
154 "// filler filler filler filler filler filler filler filler filler fille
r", | 155 "// filler filler filler filler filler filler filler filler filler fille
r", |
155 "part of test;", | |
156 "test() {}", | 156 "test() {}", |
157 ""}); | 157 ""); |
158 setUnitContent("Test2.dart", new String[] { | 158 setUnitContent( |
| 159 "Test2.dart", |
159 "// filler filler filler filler filler filler filler filler filler fille
r", | 160 "// filler filler filler filler filler filler filler filler filler fille
r", |
160 "part of test;", | |
161 "f() {", | 161 "f() {", |
162 " test();", | 162 " test();", |
163 "}"}); | 163 "}"); |
164 setTestUnitContent( | 164 setTestUnitContent( |
165 "// filler filler filler filler filler filler filler filler filler fille
r", | 165 "// filler filler filler filler filler filler filler filler filler fille
r", |
166 "library test;", | 166 "#library('test');", |
167 "part 'Test1.dart';", | 167 "#source('Test1.dart');", |
168 "part 'Test2.dart';"); | 168 "#source('Test2.dart');"); |
169 // get units, because they have not library | 169 // get units, because they have not library |
170 CompilationUnit unit1 = testProject.getUnit("Test1.dart"); | 170 CompilationUnit unit1 = testProject.getUnit("Test1.dart"); |
171 CompilationUnit unit2 = testProject.getUnit("Test2.dart"); | 171 CompilationUnit unit2 = testProject.getUnit("Test2.dart"); |
172 // find Function to rename | 172 // find Function to rename |
173 DartFunction function = findElement(unit2, "test();"); | 173 DartFunction function = findElement(unit2, "test();"); |
174 // do rename | 174 // do rename |
175 renameFunction(function, "newName"); | 175 renameFunction(function, "newName"); |
176 assertUnitContent(unit1, new String[] { | 176 assertUnitContent( |
| 177 unit1, |
177 "// filler filler filler filler filler filler filler filler filler fille
r", | 178 "// filler filler filler filler filler filler filler filler filler fille
r", |
178 "part of test;", | |
179 "newName() {}", | 179 "newName() {}", |
180 ""}); | 180 ""); |
181 assertUnitContent(unit2, new String[] { | 181 assertUnitContent( |
| 182 unit2, |
182 "// filler filler filler filler filler filler filler filler filler fille
r", | 183 "// filler filler filler filler filler filler filler filler filler fille
r", |
183 "part of test;", | |
184 "f() {", | 184 "f() {", |
185 " newName();", | 185 " newName();", |
186 "}"}); | 186 "}"); |
187 } | 187 } |
188 | 188 |
189 public void test_OK_setter() throws Exception { | 189 public void test_OK_setter() throws Exception { |
190 setTestUnitContent( | 190 setTestUnitContent( |
191 "// filler filler filler filler filler filler filler filler filler fille
r", | 191 "// filler filler filler filler filler filler filler filler filler fille
r", |
192 "void set test(x) {", | 192 "void set test(x) {", |
193 "}", | 193 "}", |
194 "f() {", | 194 "f() {", |
195 " test = 42;", | 195 " test = 42;", |
196 "}", | 196 "}", |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 assertThat(showStatusMessages).hasSize(1); | 587 assertThat(showStatusMessages).hasSize(1); |
588 assertEquals("File 'Test/" | 588 assertEquals("File 'Test/" |
589 + unitName | 589 + unitName |
590 + "' in library 'Test' already declares top-level " | 590 + "' in library 'Test' already declares top-level " |
591 + shadowName | 591 + shadowName |
592 + " 'newName'", showStatusMessages.get(0)); | 592 + " 'newName'", showStatusMessages.get(0)); |
593 // no source changes | 593 // no source changes |
594 assertEquals(source, testUnit.getSource()); | 594 assertEquals(source, testUnit.getSource()); |
595 } | 595 } |
596 } | 596 } |
OLD | NEW |