| 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.edit.refactoring; | 5 library test.edit.refactoring; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/edit/edit_domain.dart'; | 9 import 'package:analysis_server/src/edit/edit_domain.dart'; |
| 10 import 'package:analysis_server/src/protocol.dart'; | 10 import 'package:analysis_server/src/protocol.dart'; |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 return assertSuccessfulRefactoring(() { | 531 return assertSuccessfulRefactoring(() { |
| 532 return _sendInlineRequest('test + 2'); | 532 return _sendInlineRequest('test + 2'); |
| 533 }, ''' | 533 }, ''' |
| 534 main() { | 534 main() { |
| 535 int a = 42 + 2; | 535 int a = 42 + 2; |
| 536 print(42); | 536 print(42); |
| 537 } | 537 } |
| 538 '''); | 538 '''); |
| 539 } | 539 } |
| 540 | 540 |
| 541 test_feedback() { |
| 542 addTestFile(''' |
| 543 main() { |
| 544 int test = 42; |
| 545 print(test); |
| 546 print(test); |
| 547 } |
| 548 '''); |
| 549 return getRefactoringResult(() { |
| 550 return _sendInlineRequest('test ='); |
| 551 }).then((result) { |
| 552 InlineLocalVariableFeedback feedback = result.feedback; |
| 553 expect(feedback.name, 'test'); |
| 554 expect(feedback.occurrences, 2); |
| 555 }); |
| 556 } |
| 557 |
| 541 test_init_fatalError_notVariable() { | 558 test_init_fatalError_notVariable() { |
| 542 addTestFile('main() {}'); | 559 addTestFile('main() {}'); |
| 543 return getRefactoringResult(() { | 560 return getRefactoringResult(() { |
| 544 return _sendInlineRequest('main() {}'); | 561 return _sendInlineRequest('main() {}'); |
| 545 }).then((result) { | 562 }).then((result) { |
| 546 assertResultProblemsFatal( | 563 assertResultProblemsFatal( |
| 547 result, | 564 result, |
| 548 'Local variable declaration or reference must be selected to activate
this refactoring.'); | 565 'Local variable declaration or reference must be selected to activate
this refactoring.'); |
| 549 // ...there is no any change | 566 // ...there is no any change |
| 550 expect(result.change, isNull); | 567 expect(result.change, isNull); |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 } | 1072 } |
| 1056 | 1073 |
| 1057 @override | 1074 @override |
| 1058 void setUp() { | 1075 void setUp() { |
| 1059 super.setUp(); | 1076 super.setUp(); |
| 1060 server.handlers = [new EditDomainHandler(server),]; | 1077 server.handlers = [new EditDomainHandler(server),]; |
| 1061 createProject(); | 1078 createProject(); |
| 1062 handler = new EditDomainHandler(server); | 1079 handler = new EditDomainHandler(server); |
| 1063 } | 1080 } |
| 1064 } | 1081 } |
| OLD | NEW |