| 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 false).toRequest('0'); | 577 false).toRequest('0'); |
| 578 return serverChannel.sendRequest(request); | 578 return serverChannel.sendRequest(request); |
| 579 } | 579 } |
| 580 } | 580 } |
| 581 | 581 |
| 582 | 582 |
| 583 @ReflectiveTestCase() | 583 @ReflectiveTestCase() |
| 584 class InlineMethodTest extends _AbstractGetRefactoring_Test { | 584 class InlineMethodTest extends _AbstractGetRefactoring_Test { |
| 585 InlineMethodOptions options = new InlineMethodOptions(true, true); | 585 InlineMethodOptions options = new InlineMethodOptions(true, true); |
| 586 | 586 |
| 587 test_feedback() { |
| 588 addTestFile(''' |
| 589 class A { |
| 590 int f; |
| 591 test(int p) { |
| 592 print(f + p); |
| 593 } |
| 594 main() { |
| 595 test(1); |
| 596 } |
| 597 } |
| 598 '''); |
| 599 return getRefactoringResult(() { |
| 600 return _sendInlineRequest('test(int p)'); |
| 601 }).then((result) { |
| 602 InlineMethodFeedback feedback = result.feedback; |
| 603 expect(feedback.className, 'A'); |
| 604 expect(feedback.methodName, 'test'); |
| 605 expect(feedback.isDeclaration, isTrue); |
| 606 }); |
| 607 } |
| 608 |
| 587 test_init_fatalError_noMethod() { | 609 test_init_fatalError_noMethod() { |
| 588 addTestFile('// nothing to inline'); | 610 addTestFile('// nothing to inline'); |
| 589 return getRefactoringResult(() { | 611 return getRefactoringResult(() { |
| 590 return _sendInlineRequest('// nothing'); | 612 return _sendInlineRequest('// nothing'); |
| 591 }).then((result) { | 613 }).then((result) { |
| 592 assertResultProblemsFatal( | 614 assertResultProblemsFatal( |
| 593 result, | 615 result, |
| 594 'Method declaration or reference must be selected to activate this ref
actoring.'); | 616 'Method declaration or reference must be selected to activate this ref
actoring.'); |
| 595 // ...there is no any change | 617 // ...there is no any change |
| 596 expect(result.change, isNull); | 618 expect(result.change, isNull); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 } | 1094 } |
| 1073 | 1095 |
| 1074 @override | 1096 @override |
| 1075 void setUp() { | 1097 void setUp() { |
| 1076 super.setUp(); | 1098 super.setUp(); |
| 1077 server.handlers = [new EditDomainHandler(server),]; | 1099 server.handlers = [new EditDomainHandler(server),]; |
| 1078 createProject(); | 1100 createProject(); |
| 1079 handler = new EditDomainHandler(server); | 1101 handler = new EditDomainHandler(server); |
| 1080 } | 1102 } |
| 1081 } | 1103 } |
| OLD | NEW |