Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameMethodProcessorTest.java

Issue 11233061: Revert "Parts must start with 'part of'" and "Attempt to fix VM build" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 " return 42;", 197 " return 42;",
198 " }", 198 " }",
199 "}", 199 "}",
200 "f() {", 200 "f() {",
201 " A a = new A();", 201 " A a = new A();",
202 " print(a.newName);", 202 " print(a.newName);",
203 "}", 203 "}",
204 ""); 204 "");
205 } 205 }
206 206
207 public void test_OK_inexactReferences() throws Exception {
208 setTestUnitContent(
209 "// filler filler filler filler filler filler filler filler filler fille r",
210 "class A {",
211 " test() {}",
212 "}",
213 "f1(A a) {",
214 " a.test();",
215 "}",
216 "f2(a) {",
217 " a.test();",
218 "}",
219 "");
220 Method method = findElement("test() {}");
221 // do rename
222 renameMethod(method, "newName");
223 assertTestUnitContent(
224 "// filler filler filler filler filler filler filler filler filler fille r",
225 "class A {",
226 " newName() {}",
227 "}",
228 "f1(A a) {",
229 " a.newName();",
230 "}",
231 "f2(a) {",
232 " a.newName();",
233 "}",
234 "");
235 }
236
237 public void test_OK_multipleUnits_onReference() throws Exception { 207 public void test_OK_multipleUnits_onReference() throws Exception {
238 setUnitContent("Test1.dart", new String[] { 208 setUnitContent(
209 "Test1.dart",
239 "// filler filler filler filler filler filler filler filler filler fille r", 210 "// filler filler filler filler filler filler filler filler filler fille r",
240 "part of test;",
241 "class A {", 211 "class A {",
242 " test(var p) {}", 212 " test(var p) {}",
243 " int bar = 2;", 213 " int bar = 2;",
244 " f1() {", 214 " f1() {",
245 " test(3);", 215 " test(3);",
246 " bar = 4;", 216 " bar = 4;",
247 " }", 217 " }",
248 "}"}); 218 "}");
249 setUnitContent("Test2.dart", new String[] { 219 setUnitContent(
220 "Test2.dart",
250 "// filler filler filler filler filler filler filler filler filler fille r", 221 "// filler filler filler filler filler filler filler filler filler fille r",
251 "part of test;",
252 "f2() {", 222 "f2() {",
253 " A a = new A();", 223 " A a = new A();",
254 " a.test(5);", 224 " a.test(5);",
255 "}"}); 225 "}");
256 setUnitContent("Test3.dart", new String[] { 226 setUnitContent(
227 "Test3.dart",
257 "// filler filler filler filler filler filler filler filler filler fille r", 228 "// filler filler filler filler filler filler filler filler filler fille r",
258 "part of test;",
259 "class B extends A {", 229 "class B extends A {",
260 " f3() {", 230 " f3() {",
261 " test(6);", 231 " test(6);",
262 " }", 232 " }",
263 "}"}); 233 "}");
264 setTestUnitContent( 234 setTestUnitContent(
265 "// filler filler filler filler filler filler filler filler filler fille r", 235 "// filler filler filler filler filler filler filler filler filler fille r",
266 "library test;", 236 "#library('test');",
267 "part 'Test1.dart';", 237 "#source('Test1.dart');",
268 "part 'Test2.dart';", 238 "#source('Test2.dart');",
269 "part 'Test3.dart';"); 239 "#source('Test3.dart');");
270 // get units, because they have not library 240 // get units, because they have not library
271 CompilationUnit unit1 = testProject.getUnit("Test1.dart"); 241 CompilationUnit unit1 = testProject.getUnit("Test1.dart");
272 CompilationUnit unit2 = testProject.getUnit("Test2.dart"); 242 CompilationUnit unit2 = testProject.getUnit("Test2.dart");
273 CompilationUnit unit3 = testProject.getUnit("Test3.dart"); 243 CompilationUnit unit3 = testProject.getUnit("Test3.dart");
274 // find Field to rename 244 // find Field to rename
275 Method method = findElement(unit2, "test(5);"); 245 Method method = findElement(unit2, "test(5);");
276 // do rename 246 // do rename
277 renameMethod(method, "newName"); 247 renameMethod(method, "newName");
278 assertUnitContent(unit1, new String[] { 248 assertUnitContent(
249 unit1,
279 "// filler filler filler filler filler filler filler filler filler fille r", 250 "// filler filler filler filler filler filler filler filler filler fille r",
280 "part of test;",
281 "class A {", 251 "class A {",
282 " newName(var p) {}", 252 " newName(var p) {}",
283 " int bar = 2;", 253 " int bar = 2;",
284 " f1() {", 254 " f1() {",
285 " newName(3);", 255 " newName(3);",
286 " bar = 4;", 256 " bar = 4;",
287 " }", 257 " }",
288 "}"}); 258 "}");
289 assertUnitContent(unit2, new String[] { 259 assertUnitContent(
260 unit2,
290 "// filler filler filler filler filler filler filler filler filler fille r", 261 "// filler filler filler filler filler filler filler filler filler fille r",
291 "part of test;",
292 "f2() {", 262 "f2() {",
293 " A a = new A();", 263 " A a = new A();",
294 " a.newName(5);", 264 " a.newName(5);",
295 "}"}); 265 "}");
296 assertUnitContent(unit3, new String[] { 266 assertUnitContent(
267 unit3,
297 "// filler filler filler filler filler filler filler filler filler fille r", 268 "// filler filler filler filler filler filler filler filler filler fille r",
298 "part of test;",
299 "class B extends A {", 269 "class B extends A {",
300 " f3() {", 270 " f3() {",
301 " newName(6);", 271 " newName(6);",
302 " }", 272 " }",
303 "}"}); 273 "}");
304 } 274 }
305 275
306 public void test_OK_namedConstructor_newName() throws Exception { 276 public void test_OK_namedConstructor_newName() throws Exception {
307 setTestUnitContent( 277 setTestUnitContent(
308 "// filler filler filler filler filler filler filler filler filler fille r", 278 "// filler filler filler filler filler filler filler filler filler fille r",
309 "class A {", 279 "class A {",
310 " A.test() {}", 280 " A.test() {}",
311 "}", 281 "}",
312 "main() {", 282 "main() {",
313 " new A.test();", 283 " new A.test();",
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 "f2() {", 453 "f2() {",
484 " A a = new A();", 454 " A a = new A();",
485 " a.newName(5);", 455 " a.newName(5);",
486 "}", 456 "}",
487 "class B extends A {", 457 "class B extends A {",
488 " f3() {", 458 " f3() {",
489 " newName(6);", 459 " newName(6);",
490 " }", 460 " }",
491 "}"); 461 "}");
492 } 462 }
463
464 public void test_OK_inexactReferences() throws Exception {
465 setTestUnitContent(
466 "// filler filler filler filler filler filler filler filler filler fille r",
467 "class A {",
468 " test() {}",
469 "}",
470 "f1(A a) {",
471 " a.test();",
472 "}",
473 "f2(a) {",
474 " a.test();",
475 "}",
476 "");
477 Method method = findElement("test() {}");
478 // do rename
479 renameMethod(method, "newName");
480 assertTestUnitContent(
481 "// filler filler filler filler filler filler filler filler filler fille r",
482 "class A {",
483 " newName() {}",
484 "}",
485 "f1(A a) {",
486 " a.newName();",
487 "}",
488 "f2(a) {",
489 " a.newName();",
490 "}",
491 "");
492 }
493 493
494 public void test_OK_singleUnit_onReference() throws Exception { 494 public void test_OK_singleUnit_onReference() throws Exception {
495 setTestUnitContent( 495 setTestUnitContent(
496 "// filler filler filler filler filler filler filler filler filler fille r", 496 "// filler filler filler filler filler filler filler filler filler fille r",
497 "class A {", 497 "class A {",
498 " test(var p) {}", 498 " test(var p) {}",
499 " int bar = 2;", 499 " int bar = 2;",
500 " f1() {", 500 " f1() {",
501 " test(3);", 501 " test(3);",
502 " bar = 4;", 502 " bar = 4;",
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 "// filler filler filler filler filler filler filler filler filler fille r", 845 "// filler filler filler filler filler filler filler filler filler fille r",
846 "class A {", 846 "class A {",
847 " newName(var p) {}", 847 " newName(var p) {}",
848 " f1() {", 848 " f1() {",
849 " newName(0);", 849 " newName(0);",
850 " }", 850 " }",
851 "}", 851 "}",
852 "somethingBad"); 852 "somethingBad");
853 } 853 }
854 } 854 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698