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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 " factory NewName.named() {}", | 320 " factory NewName.named() {}", |
321 "}", | 321 "}", |
322 "f() {", | 322 "f() {", |
323 " new NewName();", | 323 " new NewName();", |
324 " new NewName.named();", | 324 " new NewName.named();", |
325 "}", | 325 "}", |
326 ""); | 326 ""); |
327 } | 327 } |
328 | 328 |
329 public void test_OK_multipleUnits_onReference() throws Exception { | 329 public void test_OK_multipleUnits_onReference() throws Exception { |
330 setUnitContent("Test1.dart", new String[] { | 330 setUnitContent( |
| 331 "Test1.dart", |
331 "// filler filler filler filler filler filler filler filler filler fille
r", | 332 "// filler filler filler filler filler filler filler filler filler fille
r", |
332 "part of test;", | |
333 "class Test {", | 333 "class Test {", |
334 "}"}); | 334 "}"); |
335 setUnitContent("Test2.dart", new String[] { | 335 setUnitContent( |
| 336 "Test2.dart", |
336 "// filler filler filler filler filler filler filler filler filler fille
r", | 337 "// filler filler filler filler filler filler filler filler filler fille
r", |
337 "part of test;", | |
338 "f() {", | 338 "f() {", |
339 " Test test = new Test();", | 339 " Test test = new Test();", |
340 "}"}); | 340 "}"); |
341 setUnitContent("Test3.dart", new String[] { | 341 setUnitContent( |
| 342 "Test3.dart", |
342 "// filler filler filler filler filler filler filler filler filler fille
r", | 343 "// filler filler filler filler filler filler filler filler filler fille
r", |
343 "part of test;", | |
344 "class B extends Test {", | 344 "class B extends Test {", |
345 "}"}); | 345 "}"); |
346 setTestUnitContent( | 346 setTestUnitContent( |
347 "// filler filler filler filler filler filler filler filler filler fille
r", | 347 "// filler filler filler filler filler filler filler filler filler fille
r", |
348 "library test;", | 348 "#library('test');", |
349 "part 'Test1.dart';", | 349 "#source('Test1.dart');", |
350 "part 'Test2.dart';", | 350 "#source('Test2.dart');", |
351 "part 'Test3.dart';"); | 351 "#source('Test3.dart');"); |
352 // get units, because they have not library | 352 // get units, because they have not library |
353 CompilationUnit unit1 = testProject.getUnit("Test1.dart"); | 353 CompilationUnit unit1 = testProject.getUnit("Test1.dart"); |
354 CompilationUnit unit2 = testProject.getUnit("Test2.dart"); | 354 CompilationUnit unit2 = testProject.getUnit("Test2.dart"); |
355 CompilationUnit unit3 = testProject.getUnit("Test3.dart"); | 355 CompilationUnit unit3 = testProject.getUnit("Test3.dart"); |
356 // find Type to rename | 356 // find Type to rename |
357 Type type = findElement(unit2, "Test test ="); | 357 Type type = findElement(unit2, "Test test ="); |
358 // do rename | 358 // do rename |
359 renameType(type, "NewName"); | 359 renameType(type, "NewName"); |
360 assertUnitContent(unit1, new String[] { | 360 assertUnitContent( |
| 361 unit1, |
361 "// filler filler filler filler filler filler filler filler filler fille
r", | 362 "// filler filler filler filler filler filler filler filler filler fille
r", |
362 "part of test;", | |
363 "class NewName {", | 363 "class NewName {", |
364 "}"}); | 364 "}"); |
365 assertUnitContent(unit2, new String[] { | 365 assertUnitContent( |
| 366 unit2, |
366 "// filler filler filler filler filler filler filler filler filler fille
r", | 367 "// filler filler filler filler filler filler filler filler filler fille
r", |
367 "part of test;", | |
368 "f() {", | 368 "f() {", |
369 " NewName test = new NewName();", | 369 " NewName test = new NewName();", |
370 "}"}); | 370 "}"); |
371 assertUnitContent(unit3, new String[] { | 371 assertUnitContent( |
| 372 unit3, |
372 "// filler filler filler filler filler filler filler filler filler fille
r", | 373 "// filler filler filler filler filler filler filler filler filler fille
r", |
373 "part of test;", | |
374 "class B extends NewName {", | 374 "class B extends NewName {", |
375 "}"}); | 375 "}"); |
376 } | 376 } |
377 | 377 |
378 /** | 378 /** |
379 * When we rename {@link Type}, we should rename also its constructors and ref
erences to | 379 * When we rename {@link Type}, we should rename also its constructors and ref
erences to |
380 * constructors. | 380 * constructors. |
381 */ | 381 */ |
382 public void test_OK_renameConstructor() throws Exception { | 382 public void test_OK_renameConstructor() throws Exception { |
383 setTestUnitContent( | 383 setTestUnitContent( |
384 "// filler filler filler filler filler filler filler filler filler fille
r", | 384 "// filler filler filler filler filler filler filler filler filler fille
r", |
385 "class Test {", | 385 "class Test {", |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 assertEquals(RefactoringStatus.ERROR, showStatusSeverities.get(0).intValue()
); | 1132 assertEquals(RefactoringStatus.ERROR, showStatusSeverities.get(0).intValue()
); |
1133 assertEquals("File 'Test/" | 1133 assertEquals("File 'Test/" |
1134 + unitName | 1134 + unitName |
1135 + "' in library 'Test' already declares top-level " | 1135 + "' in library 'Test' already declares top-level " |
1136 + shadowName | 1136 + shadowName |
1137 + " 'NewName'", showStatusMessages.get(0)); | 1137 + " 'NewName'", showStatusMessages.get(0)); |
1138 // no source changes | 1138 // no source changes |
1139 assertEquals(source, testUnit.getSource()); | 1139 assertEquals(source, testUnit.getSource()); |
1140 } | 1140 } |
1141 } | 1141 } |
OLD | NEW |