| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.services.refactoring.rename_local; | 5 library test.services.refactoring.rename_local; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import '../../reflective_tests.dart'; | 10 import '../../reflective_tests.dart'; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 RefactoringProblemSeverity.ERROR, | 54 RefactoringProblemSeverity.ERROR, |
| 55 expectedMessage: "Duplicate function 'newName'."); | 55 expectedMessage: "Duplicate function 'newName'."); |
| 56 }); | 56 }); |
| 57 } | 57 } |
| 58 | 58 |
| 59 test_checkFinalConditions_hasLocalVariable_after() { | 59 test_checkFinalConditions_hasLocalVariable_after() { |
| 60 indexTestUnit(''' | 60 indexTestUnit(''' |
| 61 main() { | 61 main() { |
| 62 int test = 0; | 62 int test = 0; |
| 63 var newName = 1; | 63 var newName = 1; |
| 64 print(newName); |
| 64 } | 65 } |
| 65 '''); | 66 '''); |
| 66 createRenameRefactoringAtString('test = 0'); | 67 createRenameRefactoringAtString('test = 0'); |
| 67 // check status | 68 // check status |
| 68 refactoring.newName = 'newName'; | 69 refactoring.newName = 'newName'; |
| 69 return refactoring.checkFinalConditions().then((status) { | 70 return refactoring.checkFinalConditions().then((status) { |
| 71 expect(status.problems, hasLength(1)); |
| 70 assertRefactoringStatus( | 72 assertRefactoringStatus( |
| 71 status, | 73 status, |
| 72 RefactoringProblemSeverity.ERROR, | 74 RefactoringProblemSeverity.ERROR, |
| 73 expectedMessage: "Duplicate local variable 'newName'.", | 75 expectedMessage: "Duplicate local variable 'newName'.", |
| 74 expectedContextSearch: 'newName = 1;'); | 76 expectedContextSearch: 'newName = 1;'); |
| 75 }); | 77 }); |
| 76 } | 78 } |
| 77 | 79 |
| 78 test_checkFinalConditions_hasLocalVariable_before() { | 80 test_checkFinalConditions_hasLocalVariable_before() { |
| 79 indexTestUnit(''' | 81 indexTestUnit(''' |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 main() { | 482 main() { |
| 481 int test = 0; | 483 int test = 0; |
| 482 } | 484 } |
| 483 '''); | 485 '''); |
| 484 // configure refactoring | 486 // configure refactoring |
| 485 createRenameRefactoringAtString('test = 0'); | 487 createRenameRefactoringAtString('test = 0'); |
| 486 // old name | 488 // old name |
| 487 expect(refactoring.oldName, 'test'); | 489 expect(refactoring.oldName, 'test'); |
| 488 } | 490 } |
| 489 } | 491 } |
| OLD | NEW |