| Index: pkg/analysis_server/test/services/refactoring/extract_method_test.dart
|
| diff --git a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
|
| index 95c05a5da76e45da150d9d71f855ef7d00496ce4..956de7e5ff126dbf5506bbced1bb014e72e5e14a 100644
|
| --- a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
|
| +++ b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
|
| @@ -1373,6 +1373,27 @@ int res(Foo<String, int> foo, String s) => foo(s);
|
| ''');
|
| }
|
|
|
| + test_singleExpression_returnType_importLibrary() async {
|
| + _addLibraryReturningAsync();
|
| + indexTestUnit('''
|
| +import 'asyncLib.dart';
|
| +main() {
|
| + var a = newFuture();
|
| +}
|
| +''');
|
| + _createRefactoringForString('newFuture()');
|
| + // apply refactoring
|
| + return _assertSuccessfulRefactoring('''
|
| +import 'asyncLib.dart';
|
| +import 'dart:async';
|
| +main() {
|
| + var a = res();
|
| +}
|
| +
|
| +Future<int> res() => newFuture();
|
| +''');
|
| + }
|
| +
|
| test_singleExpression_returnTypeGeneric() {
|
| indexTestUnit('''
|
| main() {
|
| @@ -2203,6 +2224,35 @@ void res(int a) {
|
| ''');
|
| }
|
|
|
| + test_statements_parameters_importType() {
|
| + _addLibraryReturningAsync();
|
| + indexTestUnit('''
|
| +import 'asyncLib.dart';
|
| +main() {
|
| + var v = newFuture();
|
| +// start
|
| + print(v);
|
| +// end
|
| +}
|
| +''');
|
| + _createRefactoringForStartEndComments();
|
| + // apply refactoring
|
| + return _assertSuccessfulRefactoring('''
|
| +import 'asyncLib.dart';
|
| +import 'dart:async';
|
| +main() {
|
| + var v = newFuture();
|
| +// start
|
| + res(v);
|
| +// end
|
| +}
|
| +
|
| +void res(Future<int> v) {
|
| + print(v);
|
| +}
|
| +''');
|
| + }
|
| +
|
| test_statements_return_last() {
|
| indexTestUnit('''
|
| main() {
|
| @@ -2406,6 +2456,14 @@ void res() {
|
| ''');
|
| }
|
|
|
| + void _addLibraryReturningAsync() {
|
| + addSource('/asyncLib.dart', r'''
|
| +library asyncLib;
|
| +import 'dart:async';
|
| +Future<int> newFuture() => null;
|
| +''');
|
| + }
|
| +
|
| Future _assertConditionsError(String message) async {
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| assertRefactoringStatus(
|
|
|