From d2f48ccf58f96bfdeec0aaa5f33f2ced4846ed08 Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Thu, 5 Jan 2017 14:21:29 -0800 Subject: [PATCH] Make subclasses of AbstractContextTest asynchronous. As a preliminary step before duplicating them for the new analysis driver. R=brianwilkerson@google.com BUG= Review-Url: https://codereview.chromium.org/2614033003 . --- .../test/abstract_context.dart | 14 +- .../test/abstract_single_unit.dart | 5 +- .../test/plugin/protocol_dart_test.dart | 40 +- .../test/services/correction/assist_test.dart | 504 ++++++++--------- .../test/services/correction/fix_test.dart | 505 +++++++++--------- .../correction/name_suggestion_test.dart | 68 +-- .../correction/source_range_test.dart | 40 +- .../test/services/correction/status_test.dart | 16 +- .../test/services/correction/util_test.dart | 52 +- .../reachable_source_collector_test.dart | 4 - .../test/services/index/index_test.dart | 44 +- .../test/services/index/index_unit_test.dart | 293 +++++----- .../refactoring/abstract_refactoring.dart | 8 +- .../convert_getter_to_method_test.dart | 18 +- .../convert_method_to_getter_test.dart | 34 +- .../refactoring/extract_local_test.dart | 218 ++++---- .../refactoring/extract_method_test.dart | 438 +++++++-------- .../refactoring/inline_local_test.dart | 122 ++--- .../refactoring/inline_method_test.dart | 290 +++++----- .../refactoring/rename_class_member_test.dart | 96 ++-- .../refactoring/rename_constructor_test.dart | 28 +- .../refactoring/rename_import_test.dart | 36 +- .../refactoring/rename_label_test.dart | 12 +- .../refactoring/rename_library_test.dart | 8 +- .../refactoring/rename_local_test.dart | 82 +-- .../refactoring/rename_unit_member_test.dart | 118 ++-- .../test/services/search/hierarchy_test.dart | 40 +- .../services/search/search_engine_test.dart | 78 +-- .../utilities/change_builder_dart_test.dart | 160 +++--- 29 files changed, 1687 insertions(+), 1684 deletions(-) diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart index ac7d8c0cfb8..ed9bb2f48e1 100644 --- a/pkg/analysis_server/test/abstract_context.dart +++ b/pkg/analysis_server/test/abstract_context.dart @@ -4,6 +4,8 @@ library testing.abstract_context; +import 'dart:async'; + import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/visitor.dart'; @@ -123,12 +125,12 @@ class AbstractContextTest { AnalysisEngine.instance.processRequiredPlugins(); } - CompilationUnit resolveDartUnit(Source unitSource, Source librarySource) { - return context.resolveCompilationUnit2(unitSource, librarySource); - } - - CompilationUnit resolveLibraryUnit(Source source) { - return context.resolveCompilationUnit2(source, source); + Future resolveLibraryUnit(Source source) async { + if (enableNewAnalysisDriver) { + return (await driver.getResult(source.fullName))?.unit; + } else { + return context.resolveCompilationUnit2(source, source); + } } void setUp() { diff --git a/pkg/analysis_server/test/abstract_single_unit.dart b/pkg/analysis_server/test/abstract_single_unit.dart index bda1d205790..779fa6b1638 100644 --- a/pkg/analysis_server/test/abstract_single_unit.dart +++ b/pkg/analysis_server/test/abstract_single_unit.dart @@ -4,6 +4,7 @@ library test.services.src.index.abstract_single_file; +import 'dart:async'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/error/error.dart'; @@ -98,9 +99,9 @@ class AbstractSingleUnitTest extends AbstractContextTest { return length; } - void resolveTestUnit(String code) { + Future resolveTestUnit(String code) async { addTestSource(code); - testUnit = resolveLibraryUnit(testSource); + testUnit = await resolveLibraryUnit(testSource); if (verifyNoTestUnitErrors) { assertNoErrorsInSource(testSource); } diff --git a/pkg/analysis_server/test/plugin/protocol_dart_test.dart b/pkg/analysis_server/test/plugin/protocol_dart_test.dart index 5f452205a37..a08ff889a4e 100644 --- a/pkg/analysis_server/test/plugin/protocol_dart_test.dart +++ b/pkg/analysis_server/test/plugin/protocol_dart_test.dart @@ -102,14 +102,14 @@ class ElementTest extends AbstractContextTest { return findChildElement(unit.element, name, kind); } - void test_fromElement_CLASS() { + test_fromElement_CLASS() async { engine.Source source = addSource( '/test.dart', ''' @deprecated abstract class _A {} class B {}'''); - engine.CompilationUnit unit = resolveLibraryUnit(source); + engine.CompilationUnit unit = await resolveLibraryUnit(source); { engine.ClassElement engineElement = findElementInUnit(unit, '_A'); // create notification Element @@ -143,14 +143,14 @@ class B {}'''); } } - void test_fromElement_CONSTRUCTOR() { + test_fromElement_CONSTRUCTOR() async { engine.Source source = addSource( '/test.dart', ''' class A { const A.myConstructor(int a, [String b]); }'''); - engine.CompilationUnit unit = resolveLibraryUnit(source); + engine.CompilationUnit unit = await resolveLibraryUnit(source); engine.ConstructorElement engineElement = findElementInUnit(unit, 'myConstructor'); // create notification Element @@ -183,14 +183,14 @@ class A { expect(element.flags, 0); } - void test_fromElement_ENUM() { + test_fromElement_ENUM() async { engine.Source source = addSource( '/test.dart', ''' @deprecated enum _E1 { one, two } enum E2 { three, four }'''); - engine.CompilationUnit unit = resolveLibraryUnit(source); + engine.CompilationUnit unit = await resolveLibraryUnit(source); { engine.ClassElement engineElement = findElementInUnit(unit, '_E1'); expect(engineElement.isDeprecated, isTrue); @@ -224,14 +224,14 @@ enum E2 { three, four }'''); } } - void test_fromElement_ENUM_CONSTANT() { + test_fromElement_ENUM_CONSTANT() async { engine.Source source = addSource( '/test.dart', ''' @deprecated enum _E1 { one, two } enum E2 { three, four }'''); - engine.CompilationUnit unit = resolveLibraryUnit(source); + engine.CompilationUnit unit = await resolveLibraryUnit(source); { engine.FieldElement engineElement = findElementInUnit(unit, 'one'); // create notification Element @@ -312,14 +312,14 @@ enum E2 { three, four }'''); } } - void test_fromElement_FIELD() { + test_fromElement_FIELD() async { engine.Source source = addSource( '/test.dart', ''' class A { static const myField = 42; }'''); - engine.CompilationUnit unit = resolveLibraryUnit(source); + engine.CompilationUnit unit = await resolveLibraryUnit(source); engine.FieldElement engineElement = findElementInUnit(unit, 'myField'); // create notification Element Element element = convertElement(engineElement); @@ -338,13 +338,13 @@ class A { expect(element.flags, Element.FLAG_CONST | Element.FLAG_STATIC); } - void test_fromElement_FUNCTION_TYPE_ALIAS() { + test_fromElement_FUNCTION_TYPE_ALIAS() async { engine.Source source = addSource( '/test.dart', ''' typedef int F(String x); '''); - engine.CompilationUnit unit = resolveLibraryUnit(source); + engine.CompilationUnit unit = await resolveLibraryUnit(source); engine.FunctionTypeAliasElement engineElement = findElementInUnit(unit, 'F'); // create notification Element @@ -365,14 +365,14 @@ typedef int F(String x); expect(element.flags, 0); } - void test_fromElement_GETTER() { + test_fromElement_GETTER() async { engine.Source source = addSource( '/test.dart', ''' class A { String get myGetter => 42; }'''); - engine.CompilationUnit unit = resolveLibraryUnit(source); + engine.CompilationUnit unit = await resolveLibraryUnit(source); engine.PropertyAccessorElement engineElement = findElementInUnit(unit, 'myGetter', engine.ElementKind.GETTER); // create notification Element @@ -392,7 +392,7 @@ class A { expect(element.flags, 0); } - void test_fromElement_LABEL() { + test_fromElement_LABEL() async { engine.Source source = addSource( '/test.dart', ''' @@ -402,7 +402,7 @@ myLabel: break myLabel; } }'''); - engine.CompilationUnit unit = resolveLibraryUnit(source); + engine.CompilationUnit unit = await resolveLibraryUnit(source); engine.LabelElement engineElement = findElementInUnit(unit, 'myLabel'); // create notification Element Element element = convertElement(engineElement); @@ -421,7 +421,7 @@ myLabel: expect(element.flags, 0); } - void test_fromElement_METHOD() { + test_fromElement_METHOD() async { engine.Source source = addSource( '/test.dart', ''' @@ -430,7 +430,7 @@ class A { return null; } }'''); - engine.CompilationUnit unit = resolveLibraryUnit(source); + engine.CompilationUnit unit = await resolveLibraryUnit(source); engine.MethodElement engineElement = findElementInUnit(unit, 'myMethod'); // create notification Element Element element = convertElement(engineElement); @@ -449,14 +449,14 @@ class A { expect(element.flags, Element.FLAG_STATIC); } - void test_fromElement_SETTER() { + test_fromElement_SETTER() async { engine.Source source = addSource( '/test.dart', ''' class A { set mySetter(String x) {} }'''); - engine.CompilationUnit unit = resolveLibraryUnit(source); + engine.CompilationUnit unit = await resolveLibraryUnit(source); engine.FieldElement engineFieldElement = findElementInUnit(unit, 'mySetter', engine.ElementKind.FIELD); engine.PropertyAccessorElement engineElement = engineFieldElement.setter; diff --git a/pkg/analysis_server/test/services/correction/assist_test.dart b/pkg/analysis_server/test/services/correction/assist_test.dart index 13d40c2722e..d7323a2d2f9 100644 --- a/pkg/analysis_server/test/services/correction/assist_test.dart +++ b/pkg/analysis_server/test/services/correction/assist_test.dart @@ -132,7 +132,7 @@ class A {} class _B extends A {} foo(f(_B p)) {} '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'my_lib.dart'; main() { foo((test) {}); @@ -150,7 +150,7 @@ class A {} class _B extends A {} List<_B> getValues() => []; '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'my_lib.dart'; class A { main() { @@ -171,7 +171,7 @@ class A {} class _B extends A {} List<_B> getValues() => []; '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'my_lib.dart'; main() { var v = getValues(); @@ -189,7 +189,7 @@ class A {} class _B extends A {} _B getValue() => new _B(); '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'my_lib.dart'; main() { var v = getValue(); @@ -199,7 +199,7 @@ main() { } test_addTypeAnnotation_classField_OK_final() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { final f = 0; } @@ -215,7 +215,7 @@ class A { } test_addTypeAnnotation_classField_OK_int() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { var f = 0; } @@ -231,7 +231,7 @@ class A { } test_addTypeAnnotation_declaredIdentifier_BAD_hasTypeAnnotation() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List items) { for (String item in items) { } @@ -241,7 +241,7 @@ main(List items) { } test_addTypeAnnotation_declaredIdentifier_BAD_inForEachBody() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List items) { for (var item in items) { 42; @@ -253,7 +253,7 @@ main(List items) { test_addTypeAnnotation_declaredIdentifier_BAD_unknownType() async { verifyNoTestUnitErrors = false; - resolveTestUnit(''' + await resolveTestUnit(''' main() { for (var item in unknownList) { } @@ -263,7 +263,7 @@ main() { } test_addTypeAnnotation_declaredIdentifier_generic_OK() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main(List> items) { for (var item in items) { @@ -285,7 +285,7 @@ class A { } test_addTypeAnnotation_declaredIdentifier_OK() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List items) { for (var item in items) { } @@ -320,7 +320,7 @@ main(List items) { import 'dart:async'; List> getFutures() => null; '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'my_lib.dart'; main() { for (var future in getFutures()) { @@ -341,7 +341,7 @@ main() { } test_addTypeAnnotation_declaredIdentifier_OK_final() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List items) { for (final item in items) { } @@ -359,7 +359,7 @@ main(List items) { } test_addTypeAnnotation_local_BAD_hasTypeAnnotation() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { int v = 42; } @@ -368,7 +368,7 @@ main() { } test_addTypeAnnotation_local_BAD_multiple() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var a = 1, b = ''; } @@ -378,7 +378,7 @@ main() { test_addTypeAnnotation_local_BAD_noValue() async { verifyNoTestUnitErrors = false; - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v; } @@ -387,7 +387,7 @@ main() { } test_addTypeAnnotation_local_BAD_null() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v = null; } @@ -396,7 +396,7 @@ main() { } test_addTypeAnnotation_local_BAD_onInitializer() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var abc = 0; } @@ -406,7 +406,7 @@ main() { test_addTypeAnnotation_local_BAD_unknown() async { verifyNoTestUnitErrors = false; - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v = unknownVar; } @@ -415,7 +415,7 @@ main() { } test_addTypeAnnotation_local_generic_OK_literal() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main(List items) { var v = items; @@ -435,7 +435,7 @@ class A { } test_addTypeAnnotation_local_generic_OK_local() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main(List items) { var v = items; @@ -461,7 +461,7 @@ class A { import 'dart:async'; Future getFutureInt() => null; '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'my_lib.dart'; main() { var v = getFutureInt(); @@ -551,7 +551,7 @@ class MyClass {} import '../aa/bbb/lib_a.dart'; MyClass newMyClass() => null; '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'ccc/lib_b.dart'; main() { var v = newMyClass(); @@ -570,7 +570,7 @@ main() { } test_addTypeAnnotation_local_OK_Function() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v = () => 1; } @@ -586,7 +586,7 @@ main() { } test_addTypeAnnotation_local_OK_int() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v = 0; } @@ -602,7 +602,7 @@ main() { } test_addTypeAnnotation_local_OK_List() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v = []; } @@ -618,7 +618,7 @@ main() { } test_addTypeAnnotation_local_OK_localType() async { - resolveTestUnit(''' + await resolveTestUnit(''' class C {} C f() => null; main() { @@ -638,7 +638,7 @@ main() { } test_addTypeAnnotation_local_OK_onName() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var abc = 0; } @@ -654,7 +654,7 @@ main() { } test_addTypeAnnotation_local_OK_onVar() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v = 0; } @@ -670,7 +670,7 @@ main() { } test_addTypeAnnotation_OK_privateType_sameLibrary() async { - resolveTestUnit(''' + await resolveTestUnit(''' class _A {} _A getValue() => new _A(); main() { @@ -690,7 +690,7 @@ main() { } test_addTypeAnnotation_parameter_BAD_hasExplicitType() async { - resolveTestUnit(''' + await resolveTestUnit(''' foo(f(int p)) {} main() { foo((num test) {}); @@ -700,7 +700,7 @@ main() { } test_addTypeAnnotation_parameter_BAD_noPropagatedType() async { - resolveTestUnit(''' + await resolveTestUnit(''' foo(f(p)) {} main() { foo((test) {}); @@ -710,7 +710,7 @@ main() { } test_addTypeAnnotation_parameter_OK() async { - resolveTestUnit(''' + await resolveTestUnit(''' foo(f(int p)) {} main() { foo((test) {}); @@ -728,21 +728,21 @@ main() { } test_addTypeAnnotation_topLevelField_BAD_multiple() async { - resolveTestUnit(''' + await resolveTestUnit(''' var A = 1, V = ''; '''); await assertNoAssistAt('var ', DartAssistKind.ADD_TYPE_ANNOTATION); } test_addTypeAnnotation_topLevelField_BAD_noValue() async { - resolveTestUnit(''' + await resolveTestUnit(''' var V; '''); await assertNoAssistAt('var ', DartAssistKind.ADD_TYPE_ANNOTATION); } test_addTypeAnnotation_topLevelField_OK_int() async { - resolveTestUnit(''' + await resolveTestUnit(''' var V = 0; '''); await assertHasAssistAt( @@ -754,7 +754,7 @@ int V = 0; } test_assignToLocalVariable() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { List bytes; readBytes(); @@ -779,7 +779,7 @@ List readBytes() => []; } test_assignToLocalVariable_alreadyAssignment() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var vvv; vvv = 42; @@ -789,7 +789,7 @@ main() { } test_assignToLocalVariable_inClosure() async { - resolveTestUnit(r''' + await resolveTestUnit(r''' main() { print(() { 12345; @@ -809,7 +809,7 @@ main() { } test_assignToLocalVariable_invocationArgument() async { - resolveTestUnit(r''' + await resolveTestUnit(r''' main() { f(12345); } @@ -819,7 +819,7 @@ int f(p) {} } test_assignToLocalVariable_throw() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { throw 42; } @@ -828,7 +828,7 @@ main() { } test_assignToLocalVariable_void() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { f(); } @@ -838,7 +838,7 @@ void f() {} } test_convertDocumentationIntoBlock_BAD_alreadyBlock() async { - resolveTestUnit(''' + await resolveTestUnit(''' /** * AAAAAAA */ @@ -849,7 +849,7 @@ class A {} } test_convertDocumentationIntoBlock_BAD_notDocumentation() async { - resolveTestUnit(''' + await resolveTestUnit(''' // AAAA class A {} '''); @@ -858,7 +858,7 @@ class A {} } test_convertDocumentationIntoBlock_OK_noSpaceBeforeText() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { /// AAAAA ///BBBBB @@ -884,7 +884,7 @@ class A { } test_convertDocumentationIntoBlock_OK_onReference() async { - resolveTestUnit(''' + await resolveTestUnit(''' /// AAAAAAA [int] AAAAAAA class A {} '''); @@ -900,7 +900,7 @@ class A {} } test_convertDocumentationIntoBlock_OK_onText() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { /// AAAAAAA [int] AAAAAAA /// BBBBBBBB BBBB BBBB @@ -924,7 +924,7 @@ class A { } test_convertDocumentationIntoLine_BAD_alreadyLine() async { - resolveTestUnit(''' + await resolveTestUnit(''' /// AAAAAAA class A {} '''); @@ -933,7 +933,7 @@ class A {} } test_convertDocumentationIntoLine_BAD_notDocumentation() async { - resolveTestUnit(''' + await resolveTestUnit(''' /* AAAA */ class A {} '''); @@ -942,7 +942,7 @@ class A {} } test_convertDocumentationIntoLine_OK_onReference() async { - resolveTestUnit(''' + await resolveTestUnit(''' /** * AAAAAAA [int] AAAAAAA */ @@ -958,7 +958,7 @@ class A {} } test_convertDocumentationIntoLine_OK_onText() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { /** * AAAAAAA [int] AAAAAAA @@ -982,7 +982,7 @@ class A { } test_convertDocumentationIntoLine_OK_onText_hasFirstLine() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { /** AAAAAAA [int] AAAAAAA * BBBBBBBB BBBB BBBB @@ -1005,14 +1005,14 @@ class A { } test_convertToBlockBody_BAD_noEnclosingFunction() async { - resolveTestUnit(''' + await resolveTestUnit(''' var v = 123; '''); await assertNoAssistAt('v =', DartAssistKind.CONVERT_INTO_BLOCK_BODY); } test_convertToBlockBody_BAD_notExpressionBlock() async { - resolveTestUnit(''' + await resolveTestUnit(''' fff() { return 123; } @@ -1021,7 +1021,7 @@ fff() { } test_convertToBlockBody_OK_async() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { mmm() async => 123; } @@ -1039,7 +1039,7 @@ class A { } test_convertToBlockBody_OK_closure() async { - resolveTestUnit(''' + await resolveTestUnit(''' setup(x) {} main() { setup(() => 42); @@ -1065,7 +1065,7 @@ main() { } test_convertToBlockBody_OK_closure_voidExpression() async { - resolveTestUnit(''' + await resolveTestUnit(''' setup(x) {} main() { setup(() => print('done')); @@ -1091,7 +1091,7 @@ main() { } test_convertToBlockBody_OK_constructor() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { factory A() => null; } @@ -1109,7 +1109,7 @@ class A { } test_convertToBlockBody_OK_method() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { mmm() => 123; } @@ -1127,7 +1127,7 @@ class A { } test_convertToBlockBody_OK_onName() async { - resolveTestUnit(''' + await resolveTestUnit(''' fff() => 123; '''); await assertHasAssistAt( @@ -1141,7 +1141,7 @@ fff() { } test_convertToBlockBody_OK_onValue() async { - resolveTestUnit(''' + await resolveTestUnit(''' fff() => 123; '''); await assertHasAssistAt( @@ -1155,7 +1155,7 @@ fff() { } test_convertToExpressionBody_BAD_already() async { - resolveTestUnit(''' + await resolveTestUnit(''' fff() => 42; '''); await assertNoAssistAt( @@ -1163,7 +1163,7 @@ fff() => 42; } test_convertToExpressionBody_BAD_moreThanOneStatement() async { - resolveTestUnit(''' + await resolveTestUnit(''' fff() { var v = 42; return v; @@ -1174,14 +1174,14 @@ fff() { } test_convertToExpressionBody_BAD_noEnclosingFunction() async { - resolveTestUnit(''' + await resolveTestUnit(''' var V = 42; '''); await assertNoAssistAt('V = ', DartAssistKind.CONVERT_INTO_EXPRESSION_BODY); } test_convertToExpressionBody_BAD_noReturn() async { - resolveTestUnit(''' + await resolveTestUnit(''' fff() { var v = 42; } @@ -1191,7 +1191,7 @@ fff() { } test_convertToExpressionBody_BAD_noReturnValue() async { - resolveTestUnit(''' + await resolveTestUnit(''' fff() { return; } @@ -1201,7 +1201,7 @@ fff() { } test_convertToExpressionBody_OK_async() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { mmm() async { return 42; @@ -1219,7 +1219,7 @@ class A { } test_convertToExpressionBody_OK_closure() async { - resolveTestUnit(''' + await resolveTestUnit(''' setup(x) {} main() { setup(() { @@ -1239,7 +1239,7 @@ main() { } test_convertToExpressionBody_OK_closure_voidExpression() async { - resolveTestUnit(''' + await resolveTestUnit(''' setup(x) {} main() { setup(() { @@ -1259,7 +1259,7 @@ main() { } test_convertToExpressionBody_OK_constructor() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { factory A() { return null; @@ -1277,7 +1277,7 @@ class A { } test_convertToExpressionBody_OK_function_onBlock() async { - resolveTestUnit(''' + await resolveTestUnit(''' fff() { return 42; } @@ -1291,7 +1291,7 @@ fff() => 42; } test_convertToExpressionBody_OK_function_onName() async { - resolveTestUnit(''' + await resolveTestUnit(''' fff() { return 42; } @@ -1305,7 +1305,7 @@ fff() => 42; } test_convertToExpressionBody_OK_method_onBlock() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { m() { // marker return 42; @@ -1323,7 +1323,7 @@ class A { } test_convertToExpressionBody_OK_topFunction_onReturnStatement() async { - resolveTestUnit(''' + await resolveTestUnit(''' fff() { return 42; } @@ -1337,7 +1337,7 @@ fff() => 42; } test_convertToFieldParameter_BAD_additionalUse() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int aaa2; int bbb2; @@ -1348,7 +1348,7 @@ class A { } test_convertToFieldParameter_BAD_notPureAssignment() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int aaa2; A(int aaa) : aaa2 = aaa * 2; @@ -1358,7 +1358,7 @@ class A { } test_convertToFieldParameter_OK_firstInitializer() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { double aaa2; int bbb2; @@ -1378,7 +1378,7 @@ class A { } test_convertToFieldParameter_OK_onParameterName_inInitializer() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int test2; A(int test) : test2 = test { @@ -1398,7 +1398,7 @@ class A { } test_convertToFieldParameter_OK_onParameterName_inParameters() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int test; A(int test) : test = test { @@ -1418,7 +1418,7 @@ class A { } test_convertToFieldParameter_OK_secondInitializer() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { double aaa2; int bbb2; @@ -1438,7 +1438,7 @@ class A { } test_convertToFinalField_BAD_hasSetter_inThisClass() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int get foo => null; void set foo(_) {} @@ -1448,7 +1448,7 @@ class A { } test_convertToFinalField_BAD_notExpressionBody() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int get foo { int v = 1 + 2; @@ -1460,7 +1460,7 @@ class A { } test_convertToFinalField_BAD_notGetter() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int foo() => 42; } @@ -1469,7 +1469,7 @@ class A { } test_convertToFinalField_OK_blockBody_onlyReturnStatement() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int get foo { return 1 + 2; @@ -1487,7 +1487,7 @@ class A { } test_convertToFinalField_OK_hasOverride() async { - resolveTestUnit(''' + await resolveTestUnit(''' const myAnnotation = const Object(); class A { @myAnnotation @@ -1507,7 +1507,7 @@ class A { } test_convertToFinalField_OK_hasSetter_inSuper() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { void set foo(_) {} } @@ -1529,7 +1529,7 @@ class B extends A { } test_convertToFinalField_OK_notNull() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int get foo => 1 + 2; } @@ -1545,7 +1545,7 @@ class A { } test_convertToFinalField_OK_null() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int get foo => null; } @@ -1561,7 +1561,7 @@ class A { } test_convertToFinalField_OK_onName() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int get foo => 42; } @@ -1577,7 +1577,7 @@ class A { } test_convertToFinalField_OK_onReturnType_parameterized() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { List get foo => null; } @@ -1593,7 +1593,7 @@ class A { } test_convertToFinalField_OK_onReturnType_simple() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int get foo => 42; } @@ -1609,7 +1609,7 @@ class A { } test_convertToForIndex_BAD_bodyNotBlock() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List items) { for (String item in items) print(item); } @@ -1619,7 +1619,7 @@ main(List items) { } test_convertToForIndex_BAD_doesNotDeclareVariable() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List items) { String item; for (item in items) { @@ -1631,7 +1631,7 @@ main(List items) { } test_convertToForIndex_BAD_iterableIsNotVariable() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { for (String item in ['a', 'b', 'c']) { print(item); @@ -1643,7 +1643,7 @@ main() { } test_convertToForIndex_BAD_iterableNotList() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(Iterable items) { for (String item in items) { print(item); @@ -1655,7 +1655,7 @@ main(Iterable items) { } test_convertToForIndex_BAD_usesIJK() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List items) { for (String item in items) { print(item); @@ -1668,7 +1668,7 @@ main(List items) { } test_convertToForIndex_OK_onDeclaredIdentifier_name() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List items) { for (String item in items) { print(item); @@ -1689,7 +1689,7 @@ main(List items) { } test_convertToForIndex_OK_onDeclaredIdentifier_type() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List items) { for (String item in items) { print(item); @@ -1710,7 +1710,7 @@ main(List items) { } test_convertToForIndex_OK_onFor() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List items) { for (String item in items) { print(item); @@ -1731,7 +1731,7 @@ main(List items) { } test_convertToForIndex_OK_usesI() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List items) { for (String item in items) { int i = 0; @@ -1752,7 +1752,7 @@ main(List items) { } test_convertToForIndex_OK_usesIJ() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List items) { for (String item in items) { print(item); @@ -1775,7 +1775,7 @@ main(List items) { } test_convertToGetter_BAD_noInitializer() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { final int foo; } @@ -1784,7 +1784,7 @@ class A { } test_convertToGetter_BAD_notFinal() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int foo = 1; } @@ -1793,7 +1793,7 @@ class A { } test_convertToGetter_BAD_notSingleField() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { final int foo = 1, bar = 2; } @@ -1802,7 +1802,7 @@ class A { } test_convertToGetter_OK() async { - resolveTestUnit(''' + await resolveTestUnit(''' const myAnnotation = const Object(); class A { @myAnnotation @@ -1822,7 +1822,7 @@ class A { } test_convertToGetter_OK_noType() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { final foo = 42; } @@ -1838,7 +1838,7 @@ class A { } test_convertToIsNot_BAD_is_alreadyIsNot() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { p is! String; } @@ -1847,7 +1847,7 @@ main(p) { } test_convertToIsNot_BAD_is_noEnclosingParenthesis() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { p is String; } @@ -1856,7 +1856,7 @@ main(p) { } test_convertToIsNot_BAD_is_noPrefix() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { (p is String); } @@ -1865,7 +1865,7 @@ main(p) { } test_convertToIsNot_BAD_is_notIsExpression() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { 123 + 456; } @@ -1875,7 +1875,7 @@ main(p) { test_convertToIsNot_BAD_is_notTheNotOperator() async { verifyNoTestUnitErrors = false; - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { ++(p is String); } @@ -1884,7 +1884,7 @@ main(p) { } test_convertToIsNot_BAD_not_alreadyIsNot() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { !(p is! String); } @@ -1893,7 +1893,7 @@ main(p) { } test_convertToIsNot_BAD_not_noEnclosingParenthesis() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { !p; } @@ -1902,7 +1902,7 @@ main(p) { } test_convertToIsNot_BAD_not_notIsExpression() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { !(p == null); } @@ -1912,7 +1912,7 @@ main(p) { test_convertToIsNot_BAD_not_notTheNotOperator() async { verifyNoTestUnitErrors = false; - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { ++(p is String); } @@ -1921,7 +1921,7 @@ main(p) { } test_convertToIsNot_OK_childOfIs_left() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { !(p is String); } @@ -1937,7 +1937,7 @@ main(p) { } test_convertToIsNot_OK_childOfIs_right() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { !(p is String); } @@ -1953,7 +1953,7 @@ main(p) { } test_convertToIsNot_OK_is() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { !(p is String); } @@ -1969,7 +1969,7 @@ main(p) { } test_convertToIsNot_OK_is_higherPrecedencePrefix() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { !!(p is String); } @@ -1985,7 +1985,7 @@ main(p) { } test_convertToIsNot_OK_is_not_higherPrecedencePrefix() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { !!(p is String); } @@ -2001,7 +2001,7 @@ main(p) { } test_convertToIsNot_OK_not() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { !(p is String); } @@ -2017,7 +2017,7 @@ main(p) { } test_convertToIsNot_OK_parentheses() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { !(p is String); } @@ -2034,7 +2034,7 @@ main(p) { test_convertToIsNotEmpty_BAD_noBang() async { verifyNoTestUnitErrors = false; - resolveTestUnit(''' + await resolveTestUnit(''' main(String str) { ~str.isEmpty; } @@ -2044,7 +2044,7 @@ main(String str) { } test_convertToIsNotEmpty_BAD_noIsNotEmpty() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { bool get isEmpty => false; } @@ -2057,7 +2057,7 @@ main(A a) { } test_convertToIsNotEmpty_BAD_notInPrefixExpression() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(String str) { str.isEmpty; } @@ -2067,7 +2067,7 @@ main(String str) { } test_convertToIsNotEmpty_BAD_notIsEmpty() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(int p) { !p.isEven; } @@ -2076,7 +2076,7 @@ main(int p) { } test_convertToIsNotEmpty_OK_on_isEmpty() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(String str) { !str.isEmpty; } @@ -2092,7 +2092,7 @@ main(String str) { } test_convertToIsNotEmpty_OK_on_str() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(String str) { !str.isEmpty; } @@ -2108,7 +2108,7 @@ main(String str) { } test_convertToIsNotEmpty_OK_propertyAccess() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(String str) { !'text'.isEmpty; } @@ -2124,7 +2124,7 @@ main(String str) { } test_convertToNormalParameter_OK_dynamic() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { var test; A(this.test) { @@ -2144,7 +2144,7 @@ class A { } test_convertToNormalParameter_OK_firstInitializer() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int test; A(this.test) { @@ -2164,7 +2164,7 @@ class A { } test_convertToNormalParameter_OK_secondInitializer() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { double aaa; int bbb; @@ -2184,7 +2184,7 @@ class A { } test_encapsulateField_BAD_alreadyPrivate() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int _test = 42; } @@ -2196,7 +2196,7 @@ main(A a) { } test_encapsulateField_BAD_final() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { final int test = 42; } @@ -2205,7 +2205,7 @@ class A { } test_encapsulateField_BAD_multipleFields() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int aaa, bbb, ccc; } @@ -2217,7 +2217,7 @@ main(A a) { } test_encapsulateField_BAD_notOnName() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int test = 1 + 2 + 3; } @@ -2227,7 +2227,7 @@ class A { test_encapsulateField_BAD_parseError() async { verifyNoTestUnitErrors = false; - resolveTestUnit(''' + await resolveTestUnit(''' class A { int; // marker } @@ -2239,7 +2239,7 @@ main(A a) { } test_encapsulateField_BAD_static() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { static int test = 42; } @@ -2248,7 +2248,7 @@ class A { } test_encapsulateField_OK_hasType() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int test = 42; A(this.test); @@ -2278,7 +2278,7 @@ main(A a) { } test_encapsulateField_OK_noType() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { var test = 42; } @@ -2306,7 +2306,7 @@ main(A a) { } test_exchangeBinaryExpressionArguments_BAD_extraLength() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { 111 + 222; } @@ -2316,7 +2316,7 @@ main() { } test_exchangeBinaryExpressionArguments_BAD_onOperand() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { 111 + 222; } @@ -2326,7 +2326,7 @@ main() { } test_exchangeBinaryExpressionArguments_BAD_selectionWithBinary() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { 1 + 2 + 3; } @@ -2341,7 +2341,7 @@ main() { for (int i = 0; i <= 0; i++) { String initialOperator = initialOperators[i]; String resultOperator = resultOperators[i]; - resolveTestUnit(''' + await resolveTestUnit(''' bool main(int a, int b) { return a $initialOperator b; } @@ -2358,7 +2358,7 @@ bool main(int a, int b) { } test_exchangeBinaryExpressionArguments_OK_extended_mixOperator_1() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { 1 * 2 * 3 + 4; } @@ -2374,7 +2374,7 @@ main() { } test_exchangeBinaryExpressionArguments_OK_extended_mixOperator_2() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { 1 + 2 - 3 + 4; } @@ -2390,7 +2390,7 @@ main() { } test_exchangeBinaryExpressionArguments_OK_extended_sameOperator_afterFirst() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { 1 + 2 + 3; } @@ -2406,7 +2406,7 @@ main() { } test_exchangeBinaryExpressionArguments_OK_extended_sameOperator_afterSecond() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { 1 + 2 + 3; } @@ -2422,7 +2422,7 @@ main() { } test_exchangeBinaryExpressionArguments_OK_simple_afterOperator() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { 1 + 2; } @@ -2438,7 +2438,7 @@ main() { } test_exchangeBinaryExpressionArguments_OK_simple_beforeOperator() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { 1 + 2; } @@ -2454,7 +2454,7 @@ main() { } test_exchangeBinaryExpressionArguments_OK_simple_fullSelection() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { 1 + 2; } @@ -2471,7 +2471,7 @@ main() { } test_exchangeBinaryExpressionArguments_OK_simple_withLength() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { 1 + 2; } @@ -2488,7 +2488,7 @@ main() { } test_importAddShow_BAD_hasShow() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:math' show PI; main() { PI; @@ -2498,21 +2498,21 @@ main() { } test_importAddShow_BAD_unresolvedUri() async { - resolveTestUnit(''' + await resolveTestUnit(''' import '/no/such/lib.dart'; '''); await assertNoAssistAt('import ', DartAssistKind.IMPORT_ADD_SHOW); } test_importAddShow_BAD_unused() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:math'; '''); await assertNoAssistAt('import ', DartAssistKind.IMPORT_ADD_SHOW); } test_importAddShow_OK_hasUnresolvedIdentifier() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:math'; main(x) { PI; @@ -2532,7 +2532,7 @@ main(x) { } test_importAddShow_OK_onDirective() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:math'; main() { PI; @@ -2554,7 +2554,7 @@ main() { } test_importAddShow_OK_onUri() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:math'; main() { PI; @@ -2576,7 +2576,7 @@ main() { } test_introduceLocalTestedType_BAD_notBlock() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { if (p is String) print('not a block'); @@ -2586,7 +2586,7 @@ main(p) { } test_introduceLocalTestedType_BAD_notIsExpression() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { if (p == null) { } @@ -2596,7 +2596,7 @@ main(p) { } test_introduceLocalTestedType_BAD_notStatement() async { - resolveTestUnit(''' + await resolveTestUnit(''' class C { bool b; C(v) : b = v is int; @@ -2605,7 +2605,7 @@ class C { } test_introduceLocalTestedType_OK_if_is() async { - resolveTestUnit(''' + await resolveTestUnit(''' class MyTypeName {} main(p) { if (p is MyTypeName) { @@ -2635,7 +2635,7 @@ main(p) { } test_introduceLocalTestedType_OK_if_isNot() async { - resolveTestUnit(''' + await resolveTestUnit(''' class MyTypeName {} main(p) { if (p is! MyTypeName) { @@ -2665,7 +2665,7 @@ main(p) { } test_introduceLocalTestedType_OK_while() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { while (p is String) { } @@ -2687,14 +2687,14 @@ main(p) { } test_invalidSelection() async { - resolveTestUnit(''); + await resolveTestUnit(''); List assists = await computeAssists(plugin, context, resolutionMap.elementDeclaredByCompilationUnit(testUnit).source, -1, 0); expect(assists, isEmpty); } test_invertIfStatement_blocks() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (true) { 0; @@ -2718,7 +2718,7 @@ main() { } test_invertIfStatement_statements() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (true) 0; @@ -2740,7 +2740,7 @@ main() { } test_joinIfStatementInner_BAD_innerNotIf() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { print(0); @@ -2751,7 +2751,7 @@ main() { } test_joinIfStatementInner_BAD_innerWithElse() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) { @@ -2766,7 +2766,7 @@ main() { } test_joinIfStatementInner_BAD_statementAfterInner() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) { @@ -2780,7 +2780,7 @@ main() { } test_joinIfStatementInner_BAD_statementBeforeInner() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { print(1); @@ -2794,7 +2794,7 @@ main() { } test_joinIfStatementInner_BAD_targetNotIf() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { print(0); } @@ -2803,7 +2803,7 @@ main() { } test_joinIfStatementInner_BAD_targetWithElse() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) { @@ -2818,7 +2818,7 @@ main() { } test_joinIfStatementInner_OK_conditionAndOr() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2 || 3 == 3) { @@ -2840,7 +2840,7 @@ main() { } test_joinIfStatementInner_OK_conditionInvocation() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (isCheck()) { if (2 == 2) { @@ -2864,7 +2864,7 @@ bool isCheck() => false; } test_joinIfStatementInner_OK_conditionOrAnd() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1 || 2 == 2) { if (3 == 3) { @@ -2886,7 +2886,7 @@ main() { } test_joinIfStatementInner_OK_onCondition() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) { @@ -2908,7 +2908,7 @@ main() { } test_joinIfStatementInner_OK_simpleConditions_block_block() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) { @@ -2930,7 +2930,7 @@ main() { } test_joinIfStatementInner_OK_simpleConditions_block_single() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) @@ -2951,7 +2951,7 @@ main() { } test_joinIfStatementInner_OK_simpleConditions_single_blockMulti() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) { @@ -2977,7 +2977,7 @@ main() { } test_joinIfStatementInner_OK_simpleConditions_single_blockOne() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) if (2 == 2) { @@ -2998,7 +2998,7 @@ main() { } test_joinIfStatementOuter_BAD_outerNotIf() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { print(0); @@ -3009,7 +3009,7 @@ main() { } test_joinIfStatementOuter_BAD_outerWithElse() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) { @@ -3024,7 +3024,7 @@ main() { } test_joinIfStatementOuter_BAD_statementAfterInner() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) { @@ -3038,7 +3038,7 @@ main() { } test_joinIfStatementOuter_BAD_statementBeforeInner() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { print(1); @@ -3052,7 +3052,7 @@ main() { } test_joinIfStatementOuter_BAD_targetNotIf() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { print(0); } @@ -3061,7 +3061,7 @@ main() { } test_joinIfStatementOuter_BAD_targetWithElse() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) { @@ -3076,7 +3076,7 @@ main() { } test_joinIfStatementOuter_OK_conditionAndOr() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2 || 3 == 3) { @@ -3098,7 +3098,7 @@ main() { } test_joinIfStatementOuter_OK_conditionInvocation() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (isCheck()) { @@ -3122,7 +3122,7 @@ bool isCheck() => false; } test_joinIfStatementOuter_OK_conditionOrAnd() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1 || 2 == 2) { if (3 == 3) { @@ -3144,7 +3144,7 @@ main() { } test_joinIfStatementOuter_OK_onCondition() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) { @@ -3166,7 +3166,7 @@ main() { } test_joinIfStatementOuter_OK_simpleConditions_block_block() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) { @@ -3188,7 +3188,7 @@ main() { } test_joinIfStatementOuter_OK_simpleConditions_block_single() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) @@ -3209,7 +3209,7 @@ main() { } test_joinIfStatementOuter_OK_simpleConditions_single_blockMulti() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) { if (2 == 2) { @@ -3235,7 +3235,7 @@ main() { } test_joinIfStatementOuter_OK_simpleConditions_single_blockOne() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1) if (2 == 2) { @@ -3256,7 +3256,7 @@ main() { } test_joinVariableDeclaration_onAssignment_BAD_hasInitializer() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v = 1; v = 2; @@ -3266,7 +3266,7 @@ main() { } test_joinVariableDeclaration_onAssignment_BAD_notAdjacent() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v; var bar; @@ -3277,7 +3277,7 @@ main() { } test_joinVariableDeclaration_onAssignment_BAD_notAssignment() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v; v += 1; @@ -3287,7 +3287,7 @@ main() { } test_joinVariableDeclaration_onAssignment_BAD_notDeclaration() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(var v) { v = 1; } @@ -3296,7 +3296,7 @@ main(var v) { } test_joinVariableDeclaration_onAssignment_BAD_notLeftArgument() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v; 1 + v; // marker @@ -3307,7 +3307,7 @@ main() { } test_joinVariableDeclaration_onAssignment_BAD_notOneVariable() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v, v2; v = 1; @@ -3318,7 +3318,7 @@ main() { test_joinVariableDeclaration_onAssignment_BAD_notResolved() async { verifyNoTestUnitErrors = false; - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v; x = 1; @@ -3328,7 +3328,7 @@ main() { } test_joinVariableDeclaration_onAssignment_BAD_notSameBlock() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v; { @@ -3340,7 +3340,7 @@ main() { } test_joinVariableDeclaration_onAssignment_OK() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v; v = 1; @@ -3357,7 +3357,7 @@ main() { } test_joinVariableDeclaration_onDeclaration_BAD_hasInitializer() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v = 1; v = 2; @@ -3367,7 +3367,7 @@ main() { } test_joinVariableDeclaration_onDeclaration_BAD_lastStatement() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (true) var v; @@ -3377,7 +3377,7 @@ main() { } test_joinVariableDeclaration_onDeclaration_BAD_nextNotAssignmentExpression() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v; 42; @@ -3387,7 +3387,7 @@ main() { } test_joinVariableDeclaration_onDeclaration_BAD_nextNotExpressionStatement() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v; if (true) return; @@ -3397,7 +3397,7 @@ main() { } test_joinVariableDeclaration_onDeclaration_BAD_nextNotPureAssignment() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v; v += 1; @@ -3407,7 +3407,7 @@ main() { } test_joinVariableDeclaration_onDeclaration_BAD_notOneVariable() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v, v2; v = 1; @@ -3417,7 +3417,7 @@ main() { } test_joinVariableDeclaration_onDeclaration_OK_onName() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v; v = 1; @@ -3434,7 +3434,7 @@ main() { } test_joinVariableDeclaration_onDeclaration_OK_onType() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { int v; v = 1; @@ -3451,7 +3451,7 @@ main() { } test_joinVariableDeclaration_onDeclaration_OK_onVar() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v; v = 1; @@ -3468,7 +3468,7 @@ main() { } test_removeTypeAnnotation_classField_OK() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int v = 1; } @@ -3484,7 +3484,7 @@ class A { } test_removeTypeAnnotation_classField_OK_final() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { final int v = 1; } @@ -3500,7 +3500,7 @@ class A { } test_removeTypeAnnotation_localVariable_BAD_onInitializer() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { final int v = 1; } @@ -3509,7 +3509,7 @@ main() { } test_removeTypeAnnotation_localVariable_OK() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { int a = 1, b = 2; } @@ -3525,7 +3525,7 @@ main() { } test_removeTypeAnnotation_localVariable_OK_const() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { const int v = 1; } @@ -3541,7 +3541,7 @@ main() { } test_removeTypeAnnotation_localVariable_OK_final() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { final int v = 1; } @@ -3558,14 +3558,14 @@ main() { test_removeTypeAnnotation_topLevelVariable_BAD_syntheticName() async { verifyNoTestUnitErrors = false; - resolveTestUnit(''' + await resolveTestUnit(''' MyType '''); await assertNoAssistAt('MyType', DartAssistKind.REMOVE_TYPE_ANNOTATION); } test_removeTypeAnnotation_topLevelVariable_OK() async { - resolveTestUnit(''' + await resolveTestUnit(''' int V = 1; '''); await assertHasAssistAt( @@ -3577,7 +3577,7 @@ var V = 1; } test_removeTypeAnnotation_topLevelVariable_OK_final() async { - resolveTestUnit(''' + await resolveTestUnit(''' final int V = 1; '''); await assertHasAssistAt( @@ -3589,7 +3589,7 @@ final V = 1; } test_replaceConditionalWithIfElse_BAD_noEnclosingStatement() async { - resolveTestUnit(''' + await resolveTestUnit(''' var v = true ? 111 : 222; '''); await assertNoAssistAt( @@ -3597,7 +3597,7 @@ var v = true ? 111 : 222; } test_replaceConditionalWithIfElse_BAD_notConditional() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v = 42; } @@ -3607,7 +3607,7 @@ main() { } test_replaceConditionalWithIfElse_OK_assignment() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v; v = true ? 111 : 222; @@ -3644,7 +3644,7 @@ main() { } test_replaceConditionalWithIfElse_OK_return() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { return true ? 111 : 222; } @@ -3664,7 +3664,7 @@ main() { } test_replaceConditionalWithIfElse_OK_variableDeclaration() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { int a = 1, vvv = true ? 111 : 222, b = 2; } @@ -3685,7 +3685,7 @@ main() { } test_replaceIfElseWithConditional_BAD_expressionVsReturn() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (true) { print(42); @@ -3699,7 +3699,7 @@ main() { } test_replaceIfElseWithConditional_BAD_notIfStatement() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { print(0); } @@ -3709,7 +3709,7 @@ main() { } test_replaceIfElseWithConditional_BAD_notSingleStatement() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { int vvv; if (true) { @@ -3726,7 +3726,7 @@ main() { } test_replaceIfElseWithConditional_OK_assignment() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { int vvv; if (true) { @@ -3748,7 +3748,7 @@ main() { } test_replaceIfElseWithConditional_OK_return() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (true) { return 111; @@ -3768,7 +3768,7 @@ main() { } test_splitAndCondition_BAD_hasElse() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1 && 2 == 2) { print(1); @@ -3781,7 +3781,7 @@ main() { } test_splitAndCondition_BAD_notAnd() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1 || 2 == 2) { print(0); @@ -3792,7 +3792,7 @@ main() { } test_splitAndCondition_BAD_notPartOfIf() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { print(1 == 1 && 2 == 2); } @@ -3801,7 +3801,7 @@ main() { } test_splitAndCondition_BAD_notTopLevelAnd() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (true || (1 == 1 && 2 == 2)) { print(0); @@ -3816,7 +3816,7 @@ main() { } test_splitAndCondition_OK_innerAndExpression() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1 && 2 == 2 && 3 == 3) { print(0); @@ -3838,7 +3838,7 @@ main() { } test_splitAndCondition_OK_thenBlock() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (true && false) { print(0); @@ -3866,7 +3866,7 @@ main() { } test_splitAndCondition_OK_thenStatement() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (true && false) print(0); @@ -3885,7 +3885,7 @@ main() { } test_splitAndCondition_wrong() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (1 == 1 && 2 == 2) { print(0); @@ -3903,7 +3903,7 @@ main() { } test_splitVariableDeclaration_BAD_notOneVariable() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v = 1, v2; } @@ -3912,7 +3912,7 @@ main() { } test_splitVariableDeclaration_OK_onName() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v = 1; } @@ -3929,7 +3929,7 @@ main() { } test_splitVariableDeclaration_OK_onType() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { int v = 1; } @@ -3946,7 +3946,7 @@ main() { } test_splitVariableDeclaration_OK_onVar() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var v = 1; } @@ -3963,7 +3963,7 @@ main() { } test_surroundWith_block() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { // start print(0); @@ -3987,7 +3987,7 @@ main() { } test_surroundWith_doWhile() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { // start print(0); @@ -4011,7 +4011,7 @@ main() { } test_surroundWith_for() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { // start print(0); @@ -4035,7 +4035,7 @@ main() { } test_surroundWith_forIn() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { // start print(0); @@ -4059,7 +4059,7 @@ main() { } test_surroundWith_if() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { // start print(0); @@ -4083,7 +4083,7 @@ main() { } test_surroundWith_tryCatch() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { // start print(0); @@ -4109,7 +4109,7 @@ main() { } test_surroundWith_tryFinally() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { // start print(0); @@ -4135,7 +4135,7 @@ main() { } test_surroundWith_while() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { // start print(0); diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart index f3f10f4920a..3d5ebd532f3 100644 --- a/pkg/analysis_server/test/services/correction/fix_test.dart +++ b/pkg/analysis_server/test/services/correction/fix_test.dart @@ -52,7 +52,7 @@ class BaseFixProcessorTest extends AbstractSingleUnitTest { String resultCode; assert_undefinedFunction_create_returnType_bool(String lineWithTest) async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { bool b = true; $lineWithTest @@ -198,7 +198,7 @@ bool test() { @reflectiveTest class FixProcessorTest extends BaseFixProcessorTest { test_addFieldFormalParameters_hasRequiredParameter() async { - resolveTestUnit(''' + await resolveTestUnit(''' class Test { final int a; final int b; @@ -219,7 +219,7 @@ class Test { } test_addFieldFormalParameters_noParameters() async { - resolveTestUnit(''' + await resolveTestUnit(''' class Test { final int a; final int b; @@ -240,7 +240,7 @@ class Test { } test_addFieldFormalParameters_noRequiredParameter() async { - resolveTestUnit(''' + await resolveTestUnit(''' class Test { final int a; final int b; @@ -261,7 +261,7 @@ class Test { } test_addMissingParameter_function_positional_hasNamed() async { - resolveTestUnit(''' + await resolveTestUnit(''' test({int a}) {} main() { test(1); @@ -271,7 +271,7 @@ main() { } test_addMissingParameter_function_positional_hasZero() async { - resolveTestUnit(''' + await resolveTestUnit(''' test() {} main() { test(1); @@ -288,7 +288,7 @@ main() { } test_addMissingParameter_function_required_hasNamed() async { - resolveTestUnit(''' + await resolveTestUnit(''' test({int a}) {} main() { test(1); @@ -305,7 +305,7 @@ main() { } test_addMissingParameter_function_required_hasOne() async { - resolveTestUnit(''' + await resolveTestUnit(''' test(int a) {} main() { test(1, 2.0); @@ -322,7 +322,7 @@ main() { } test_addMissingParameter_function_required_hasZero() async { - resolveTestUnit(''' + await resolveTestUnit(''' test() {} main() { test(1); @@ -339,7 +339,7 @@ main() { } test_addMissingParameter_method_positional_hasOne() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { test(int a) {} main() { @@ -360,7 +360,7 @@ class A { } test_addMissingParameter_method_required_hasOne() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { test(int a) {} main() { @@ -381,7 +381,7 @@ class A { } test_addMissingParameter_method_required_hasZero() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { test() {} main() { @@ -409,7 +409,7 @@ class A { class A {} '''; addSource('/part.dart', partCode); - resolveTestUnit(''' + await resolveTestUnit(''' library my.lib; part 'part.dart'; '''); @@ -435,7 +435,7 @@ class A {} } test_addSync_asyncFor() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:async'; void main(Stream names) { await for (String name in names) { @@ -456,14 +456,14 @@ Future main(Stream names) async { } test_addSync_BAD_nullFunctionBody() async { - resolveTestUnit(''' + await resolveTestUnit(''' var F = await; '''); await assertNoFix(DartFixKind.ADD_ASYNC); } test_addSync_blockFunctionBody() async { - resolveTestUnit(''' + await resolveTestUnit(''' foo() {} main() { await foo(); @@ -508,7 +508,7 @@ main() async { errorFilter = (AnalysisError error) { return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT; }; - resolveTestUnit(''' + await resolveTestUnit(''' foo() {} main() => await foo(); '''); @@ -524,7 +524,7 @@ main() async => await foo(); errorFilter = (AnalysisError error) { return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT; }; - resolveTestUnit(''' + await resolveTestUnit(''' foo() {} int main() { await foo(); @@ -548,7 +548,7 @@ Future main() async { errorFilter = (AnalysisError error) { return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT; }; - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:async'; foo() {} Future main() { @@ -572,7 +572,7 @@ Future main() async { errorFilter = (AnalysisError error) { return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT; }; - resolveTestUnit(''' + await resolveTestUnit(''' foo() {} dynamic main() { await foo(); @@ -594,7 +594,7 @@ dynamic main() async { errorFilter = (AnalysisError error) { return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT; }; - resolveTestUnit(''' + await resolveTestUnit(''' foo() {} main() { await foo(); @@ -613,7 +613,7 @@ main() async { } test_boolean() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { boolean v; } @@ -628,7 +628,7 @@ main() { } test_canBeNullAfterNullAware_chain() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(x) { x?.a.b.c; } @@ -643,7 +643,7 @@ main(x) { } test_canBeNullAfterNullAware_methodInvocation() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(x) { x?.a.b(); } @@ -658,7 +658,7 @@ main(x) { } test_canBeNullAfterNullAware_propertyAccess() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(x) { x?.a().b; } @@ -673,7 +673,7 @@ main(x) { } test_changeToStaticAccess_method() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { static foo() {} } @@ -709,7 +709,7 @@ library libB; import 'libA.dart'; class B extends A {} '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'libB.dart'; main(B b) { b.foo(); @@ -727,7 +727,7 @@ main(B b) { } test_changeToStaticAccess_method_prefixLibrary() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:async' as pref; main(pref.Future f) { f.wait([]); @@ -744,7 +744,7 @@ main(pref.Future f) { } test_changeToStaticAccess_property() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { static get foo => 42; } @@ -780,7 +780,7 @@ library libB; import 'libA.dart'; class B extends A {} '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'libB.dart'; main(B b) { b.foo; @@ -798,7 +798,7 @@ main(B b) { } test_changeTypeAnnotation_BAD_multipleVariables() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { String a, b = 42; } @@ -807,7 +807,7 @@ main() { } test_changeTypeAnnotation_BAD_notVariableDeclaration() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { String v; v = 42; @@ -817,7 +817,7 @@ main() { } test_changeTypeAnnotation_OK_generic() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { String v = []; } @@ -832,7 +832,7 @@ main() { } test_changeTypeAnnotation_OK_simple() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { String v = 'abc'.length; } @@ -847,7 +847,7 @@ main() { } test_createClass() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { Test v = null; } @@ -866,7 +866,7 @@ class Test { } test_createClass_BAD_hasUnresolvedPrefix() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { prefix.Test v = null; } @@ -881,7 +881,7 @@ library my.lib; class A {} '''; addSource('/lib.dart', libCode); - resolveTestUnit(''' + await resolveTestUnit(''' import 'lib.dart' as lib; main() { @@ -911,7 +911,7 @@ class Test { } test_createClass_innerLocalFunction() async { - resolveTestUnit(''' + await resolveTestUnit(''' f() { g() { Test v = null; @@ -934,7 +934,7 @@ class Test { } test_createClass_itemOfList() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var a = [Test]; } @@ -956,7 +956,7 @@ class Test { errorFilter = (AnalysisError error) { return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER; }; - resolveTestUnit(''' + await resolveTestUnit(''' class MyAnnotation { const MyAnnotation(a, b); } @@ -982,7 +982,7 @@ class Test { errorFilter = (AnalysisError error) { return error.message.contains("'a'"); }; - resolveTestUnit(''' + await resolveTestUnit(''' class Test { final int a; final int b = 2; @@ -1003,7 +1003,7 @@ class Test { } test_createConstructor_insteadOfSyntheticDefault() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int field; @@ -1030,7 +1030,7 @@ main() { } test_createConstructor_named() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { method() {} } @@ -1054,7 +1054,7 @@ main() { } test_createConstructor_named_emptyClassBody() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A {} main() { new A.named(1); @@ -1074,7 +1074,7 @@ main() { } test_createConstructorForFinalFields_inTopLevelMethod() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { final int v; } @@ -1083,14 +1083,14 @@ main() { } test_createConstructorForFinalFields_topLevelField() async { - resolveTestUnit(''' + await resolveTestUnit(''' final int v; '''); await assertNoFix(DartFixKind.CREATE_CONSTRUCTOR_FOR_FINAL_FIELDS); } test_createConstructorSuperExplicit() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { A(bool p1, int p2, double p3, String p4, {p5}); } @@ -1111,7 +1111,7 @@ class B extends A { } test_createConstructorSuperExplicit_hasInitializers() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { A(int p); } @@ -1134,7 +1134,7 @@ class B extends A { } test_createConstructorSuperExplicit_named() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { A.named(int p); } @@ -1155,7 +1155,7 @@ class B extends A { } test_createConstructorSuperExplicit_named_private() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { A._named(int p); } @@ -1167,7 +1167,7 @@ class B extends A { } test_createConstructorSuperExplicit_typeArgument() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { A(T p); } @@ -1188,7 +1188,7 @@ class B extends A { } test_createConstructorSuperImplicit() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { A(p1, int p2, List p3, [int p4]); } @@ -1215,7 +1215,7 @@ class B extends A { } test_createConstructorSuperImplicit_fieldInitializer() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int _field; A(this._field); @@ -1259,7 +1259,7 @@ class B { B(A a); } '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'libB.dart'; class C extends B { } @@ -1276,7 +1276,7 @@ class C extends B { } test_createConstructorSuperImplicit_named() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { A.named(p1, int p2); } @@ -1303,7 +1303,7 @@ class B extends A { } test_createConstructorSuperImplicit_private() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { A._named(p); } @@ -1314,7 +1314,7 @@ class B extends A { } test_createConstructorSuperImplicit_typeArgument() async { - resolveTestUnit(''' + await resolveTestUnit(''' class C { final T x; C(this.x); @@ -1334,7 +1334,7 @@ class D extends C { } test_createField_BAD_inEnum() async { - resolveTestUnit(''' + await resolveTestUnit(''' enum MyEnum { AAA, BBB } @@ -1346,7 +1346,7 @@ main() { } test_createField_BAD_inSDK() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List p) { p.foo = 1; } @@ -1355,7 +1355,7 @@ main(List p) { } test_createField_getter_multiLevel() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { } class B { @@ -1387,7 +1387,7 @@ main(C c) { } test_createField_getter_qualified_instance() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { } main(A a) { @@ -1407,7 +1407,7 @@ main(A a) { } test_createField_getter_qualified_instance_dynamicType() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { B b; void f(Object p) { @@ -1433,7 +1433,7 @@ class B { } test_createField_getter_qualified_propagatedType() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { A get self => this; } @@ -1458,7 +1458,7 @@ main() { } test_createField_getter_unqualified_instance_asInvocationArgument() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { f(test); @@ -1481,7 +1481,7 @@ f(String s) {} } test_createField_getter_unqualified_instance_assignmentRhs() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { int v = test; @@ -1502,7 +1502,7 @@ class A { } test_createField_getter_unqualified_instance_asStatement() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { test; @@ -1523,7 +1523,7 @@ class A { } test_createField_hint() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { } main(A a) { @@ -1545,7 +1545,7 @@ main(A a) { } test_createField_hint_setter() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { } main(A a) { @@ -1580,7 +1580,7 @@ library libB; import 'libA.dart'; A getA() => null; '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'libB.dart'; class C { } @@ -1603,7 +1603,7 @@ main(C c) { } test_createField_setter_generic_BAD() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { } class B { @@ -1629,7 +1629,7 @@ class B { } test_createField_setter_generic_OK_local() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { List items; @@ -1654,7 +1654,7 @@ class A { } test_createField_setter_qualified_instance_hasField() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int aaa; int zzz; @@ -1683,7 +1683,7 @@ main(A a) { } test_createField_setter_qualified_instance_hasMethod() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { existingMethod() {} } @@ -1706,7 +1706,7 @@ main(A a) { } test_createField_setter_qualified_static() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { } main() { @@ -1726,7 +1726,7 @@ main() { } test_createField_setter_unqualified_instance() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { test = 5; @@ -1747,7 +1747,7 @@ class A { } test_createField_setter_unqualified_static() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { static main() { test = 5; @@ -1769,7 +1769,7 @@ class A { test_createFile_forImport() async { testFile = '/my/project/bin/test.dart'; - resolveTestUnit(''' + await resolveTestUnit(''' import 'my_file.dart'; '''); AnalysisError error = _findErrorToFix(); @@ -1788,7 +1788,7 @@ import 'my_file.dart'; test_createFile_forImport_BAD_inPackage_lib_justLib() async { provider.newFile('/projects/my_package/pubspec.yaml', 'name: my_package'); testFile = '/projects/my_package/test.dart'; - resolveTestUnit(''' + await resolveTestUnit(''' import 'lib'; '''); await assertNoFix(DartFixKind.CREATE_FILE); @@ -1796,7 +1796,7 @@ import 'lib'; test_createFile_forImport_BAD_notDart() async { testFile = '/my/project/bin/test.dart'; - resolveTestUnit(''' + await resolveTestUnit(''' import 'my_file.txt'; '''); await assertNoFix(DartFixKind.CREATE_FILE); @@ -1806,7 +1806,7 @@ import 'my_file.txt'; provider.newFile('/projects/my_package/pubspec.yaml', 'name: my_package'); testFile = '/projects/my_package/lib/test.dart'; provider.newFolder('/projects/my_package/lib'); - resolveTestUnit(''' + await resolveTestUnit(''' import 'a/bb/c_cc/my_lib.dart'; '''); AnalysisError error = _findErrorToFix(); @@ -1826,7 +1826,7 @@ import 'a/bb/c_cc/my_lib.dart'; test_createFile_forImport_inPackage_test() async { provider.newFile('/projects/my_package/pubspec.yaml', 'name: my_package'); testFile = '/projects/my_package/test/misc/test_all.dart'; - resolveTestUnit(''' + await resolveTestUnit(''' import 'a/bb/my_lib.dart'; '''); AnalysisError error = _findErrorToFix(); @@ -1845,7 +1845,7 @@ import 'a/bb/my_lib.dart'; test_createFile_forPart() async { testFile = '/my/project/bin/test.dart'; - resolveTestUnit(''' + await resolveTestUnit(''' library my.lib; part 'my_part.dart'; '''); @@ -1882,7 +1882,7 @@ part 'my_part.dart'; context.sourceFactory = new SourceFactory( [AbstractContextTest.SDK_RESOLVER, pkgResolver, resourceResolver]); // prepare fix - testUnit = resolveLibraryUnit(testSource); + testUnit = await resolveLibraryUnit(testSource); AnalysisError error = _findErrorToFix(); fix = await _assertHasFix(DartFixKind.CREATE_FILE, error); change = fix.change; @@ -1897,7 +1897,7 @@ part 'my_part.dart'; } test_createGetter_BAD_inSDK() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(List p) { int v = p.foo; } @@ -1906,7 +1906,7 @@ main(List p) { } test_createGetter_hint_getter() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { } main(A a) { @@ -1928,7 +1928,7 @@ main(A a) { } test_createGetter_location_afterLastGetter() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int existingField; @@ -1959,7 +1959,7 @@ main(A a) { } test_createGetter_multiLevel() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { } class B { @@ -1991,7 +1991,7 @@ main(C c) { } test_createGetter_qualified_instance() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { } main(A a) { @@ -2011,7 +2011,7 @@ main(A a) { } test_createGetter_qualified_instance_dynamicType() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { B b; void f(Object p) { @@ -2037,7 +2037,7 @@ class B { } test_createGetter_qualified_propagatedType() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { A get self => this; } @@ -2062,7 +2062,7 @@ main() { } test_createGetter_setterContext() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { } main(A a) { @@ -2073,7 +2073,7 @@ main(A a) { } test_createGetter_unqualified_instance_asInvocationArgument() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { f(test); @@ -2096,7 +2096,7 @@ f(String s) {} } test_createGetter_unqualified_instance_assignmentLhs() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { test = 42; @@ -2107,7 +2107,7 @@ class A { } test_createGetter_unqualified_instance_assignmentRhs() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { int v = test; @@ -2128,7 +2128,7 @@ class A { } test_createGetter_unqualified_instance_asStatement() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { test; @@ -2149,7 +2149,7 @@ class A { } test_createLocalVariable_functionType_named() async { - resolveTestUnit(''' + await resolveTestUnit(''' typedef MY_FUNCTION(int p); foo(MY_FUNCTION f) {} main() { @@ -2169,7 +2169,7 @@ main() { } test_createLocalVariable_functionType_synthetic() async { - resolveTestUnit(''' + await resolveTestUnit(''' foo(f(int p)) {} main() { foo(bar); @@ -2179,7 +2179,7 @@ main() { } test_createLocalVariable_read_typeAssignment() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { int a = test; } @@ -2195,7 +2195,7 @@ main() { } test_createLocalVariable_read_typeCondition() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { if (!test) { print(42); @@ -2215,7 +2215,7 @@ main() { } test_createLocalVariable_read_typeInvocationArgument() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { f(test); } @@ -2235,7 +2235,7 @@ f(String p) {} } test_createLocalVariable_read_typeInvocationTarget() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { test.add('hello'); } @@ -2252,7 +2252,7 @@ main() { } test_createLocalVariable_write_assignment() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { test = 42; } @@ -2267,7 +2267,7 @@ main() { } test_createLocalVariable_write_assignment_compound() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { test += 42; } @@ -2283,7 +2283,7 @@ main() { } test_createMissingMethodCall() async { - resolveTestUnit(''' + await resolveTestUnit(''' class C implements Function { } '''); @@ -2299,7 +2299,7 @@ class C implements Function { } test_createMissingOverrides_field_untyped() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { var f; } @@ -2322,7 +2322,7 @@ class B implements A { } test_createMissingOverrides_functionTypeAlias() async { - resolveTestUnit(''' + await resolveTestUnit(''' typedef int Binary(int left, int right); abstract class Emulator { @@ -2351,7 +2351,7 @@ class MyEmulator extends Emulator { } test_createMissingOverrides_functionTypedParameter() async { - resolveTestUnit(''' + await resolveTestUnit(''' abstract class A { forEach(int f(double p1, String p2)); } @@ -2376,7 +2376,7 @@ class B extends A { } test_createMissingOverrides_generics_typeArguments() async { - resolveTestUnit(''' + await resolveTestUnit(''' class Iterator { } @@ -2406,7 +2406,7 @@ class Test extends IterableMixin { } test_createMissingOverrides_generics_typeParameters() async { - resolveTestUnit(''' + await resolveTestUnit(''' abstract class ItemProvider { List getItems(); } @@ -2431,7 +2431,7 @@ class Test extends ItemProvider { } test_createMissingOverrides_getter() async { - resolveTestUnit(''' + await resolveTestUnit(''' abstract class A { get g1; int get g2; @@ -2461,7 +2461,7 @@ class B extends A { } test_createMissingOverrides_importPrefix() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:async' as aaa; abstract class A { Map> g(aaa.Future p); @@ -2488,7 +2488,7 @@ class B extends A { } test_createMissingOverrides_mergeToField_getterSetter() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int ma; void mb() {} @@ -2523,7 +2523,7 @@ class B implements A { } test_createMissingOverrides_method() async { - resolveTestUnit(''' + await resolveTestUnit(''' abstract class A { m1(); int m2(); @@ -2596,7 +2596,7 @@ class B extends A { } test_createMissingOverrides_method_emptyClassBody() async { - resolveTestUnit(''' + await resolveTestUnit(''' abstract class A { void foo(); } @@ -2620,7 +2620,7 @@ class B extends A { } test_createMissingOverrides_method_generic() async { - resolveTestUnit(''' + await resolveTestUnit(''' class C {} class V {} @@ -2651,7 +2651,7 @@ class B implements A { } test_createMissingOverrides_operator() async { - resolveTestUnit(''' + await resolveTestUnit(''' abstract class A { int operator [](int index); void operator []=(int index, String value); @@ -2683,7 +2683,7 @@ class B extends A { } test_createMissingOverrides_setter() async { - resolveTestUnit(''' + await resolveTestUnit(''' abstract class A { set s1(x); set s2(int x); @@ -2722,7 +2722,7 @@ class B extends A { } test_createNoSuchMethod() async { - resolveTestUnit(''' + await resolveTestUnit(''' abstract class A { m1(); int m2(); @@ -2749,7 +2749,7 @@ class B extends A { } test_creationFunction_forFunctionType_cascadeSecond() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { B ma() => null; } @@ -2783,7 +2783,7 @@ int test(double a, String b) { } test_creationFunction_forFunctionType_coreFunction() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { useFunction(g: test); } @@ -2803,7 +2803,7 @@ test() { } test_creationFunction_forFunctionType_dynamicArgument() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { useFunction(test); } @@ -2823,7 +2823,7 @@ int test(a, b) { } test_creationFunction_forFunctionType_function() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { useFunction(test); } @@ -2843,7 +2843,7 @@ int test(double a, String b) { } test_creationFunction_forFunctionType_function_namedArgument() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { useFunction(g: test); } @@ -2876,7 +2876,7 @@ library libB; import 'libA.dart'; useFunction(int g(A a)) {} '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'libB.dart'; main() { useFunction(test); @@ -2897,7 +2897,7 @@ int test(A a) { } test_creationFunction_forFunctionType_method_enclosingClass_static() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { static foo() { useFunction(test); @@ -2921,7 +2921,7 @@ useFunction(int g(double a, String b)) {} } test_creationFunction_forFunctionType_method_enclosingClass_static2() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { var f; A() : f = useFunction(test); @@ -2943,7 +2943,7 @@ useFunction(int g(double a, String b)) {} } test_creationFunction_forFunctionType_method_targetClass() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(A a) { useFunction(a.test); } @@ -2966,7 +2966,7 @@ useFunction(int g(double a, String b)) {} } test_creationFunction_forFunctionType_method_targetClass_hasOtherMember() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(A a) { useFunction(a.test); } @@ -2992,7 +2992,7 @@ useFunction(int g(double a, String b)) {} } test_creationFunction_forFunctionType_notFunctionType() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(A a) { useFunction(a.test); } @@ -3004,7 +3004,7 @@ useFunction(g) {} } test_creationFunction_forFunctionType_unknownTarget() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(A a) { useFunction(a.test); } @@ -3016,7 +3016,7 @@ useFunction(g) {} } test_expectedToken_semicolon() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { print(0) } @@ -3034,7 +3034,7 @@ main() { errorFilter = (AnalysisError error) { return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE; }; - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:async'; var v;int main() async => 0; '''); @@ -3050,7 +3050,7 @@ var v;Future main() async => 0; errorFilter = (AnalysisError error) { return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE; }; - resolveTestUnit(''' + await resolveTestUnit(''' library main; int main() async { } @@ -3070,7 +3070,7 @@ Future main() async { errorFilter = (AnalysisError error) { return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE; }; - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:async' as al; int main() async { } @@ -3088,7 +3088,7 @@ al.Future main() async { errorFilter = (AnalysisError error) { return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE; }; - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:async'; List main() async { } @@ -3106,7 +3106,7 @@ Future> main() async { errorFilter = (AnalysisError error) { return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE; }; - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:async'; void main() async { } @@ -3122,7 +3122,7 @@ Future main() async { test_importLibraryPackage_preferDirectOverExport() async { _configureMyPkg({'b.dart': 'class Test {}', 'a.dart': "export 'b.dart';"}); - resolveTestUnit(''' + await resolveTestUnit(''' main() { Test test = null; } @@ -3151,7 +3151,7 @@ main() { test_importLibraryPackage_preferDirectOverExport_src() async { myPkgLibPath = '/my/src/packages/my_pkg/lib'; _configureMyPkg({'b.dart': 'class Test {}', 'a.dart': "export 'b.dart';"}); - resolveTestUnit(''' + await resolveTestUnit(''' main() { Test test = null; } @@ -3180,7 +3180,7 @@ main() { test_importLibraryPackage_preferPublicOverPrivate() async { _configureMyPkg( {'src/a.dart': 'class Test {}', 'b.dart': "export 'src/a.dart';"}); - resolveTestUnit(''' + await resolveTestUnit(''' main() { Test test = null; } @@ -3215,7 +3215,7 @@ class Test { const Test(int p); } '''); - resolveTestUnit(''' + await resolveTestUnit(''' @Test(0) main() { } @@ -3240,7 +3240,7 @@ class Test { const Test(); } '''); - resolveTestUnit(''' + await resolveTestUnit(''' main() { const Test(); } @@ -3272,7 +3272,7 @@ library b; class One {} class Two {} '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'b.dart' show Two; main () { new Two(); @@ -3300,7 +3300,7 @@ main () { library lib; class Test {} '''); - resolveTestUnit(''' + await resolveTestUnit(''' main() { Test t = null; } @@ -3325,7 +3325,7 @@ main() { library lib; class Test {} '''); - resolveTestUnit(''' + await resolveTestUnit(''' main() { Test t = null; } @@ -3350,7 +3350,7 @@ main() { library lib; class Test {} '''); - resolveTestUnit(''' + await resolveTestUnit(''' main() { Test t = null; } @@ -3374,7 +3374,7 @@ main() { library lib; myFunction() {} '''); - resolveTestUnit(''' + await resolveTestUnit(''' main() { myFunction(); } @@ -3398,7 +3398,7 @@ main() { library lib; myFunction() {} '''); - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { myFunction(); @@ -3427,7 +3427,7 @@ class A { library lib; typedef MyFunction(); '''); - resolveTestUnit(''' + await resolveTestUnit(''' main() { MyFunction t = null; } @@ -3451,7 +3451,7 @@ main() { library lib; int MY_VAR = 42; '''); - resolveTestUnit(''' + await resolveTestUnit(''' main() { print(MY_VAR); } @@ -3469,7 +3469,7 @@ main() { } test_importLibrarySdk_withClass_AsExpression() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { p as Future; } @@ -3486,7 +3486,7 @@ main(p) { } test_importLibrarySdk_withClass_invocationTarget() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { Future.wait(null); } @@ -3503,7 +3503,7 @@ main() { } test_importLibrarySdk_withClass_IsExpression() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { p is Future; } @@ -3520,7 +3520,7 @@ main(p) { } test_importLibrarySdk_withClass_itemOfList() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var a = [Future]; } @@ -3541,7 +3541,7 @@ main() { errorFilter = (AnalysisError error) { return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER; }; - resolveTestUnit(''' + await resolveTestUnit(''' class MyAnnotation { const MyAnnotation(a, b); } @@ -3562,7 +3562,7 @@ main() {} } test_importLibrarySdk_withClass_typeAnnotation() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { Future f = null; } @@ -3579,7 +3579,7 @@ main() { } test_importLibrarySdk_withClass_typeAnnotation_PrefixedIdentifier() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { Future.wait; } @@ -3596,7 +3596,7 @@ main() { } test_importLibrarySdk_withClass_typeArgument() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { List futures = []; } @@ -3613,7 +3613,7 @@ main() { } test_importLibrarySdk_withTopLevelVariable() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { print(PI); } @@ -3631,7 +3631,7 @@ main() { } test_importLibrarySdk_withTopLevelVariable_annotation() async { - resolveTestUnit(''' + await resolveTestUnit(''' @PI main() { } @@ -3656,7 +3656,7 @@ main() { class A {} class B {} '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'lib.dart' show A; main() { A a; @@ -3677,7 +3677,7 @@ main() { } test_importLibraryShow_sdk() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:async' show Stream; main() { Stream s = null; @@ -3697,7 +3697,7 @@ main() { } test_isNotNull() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { p is! Null; } @@ -3712,7 +3712,7 @@ main(p) { } test_isNull() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { p is Null; } @@ -3727,7 +3727,7 @@ main(p) { } test_makeEnclosingClassAbstract_declaresAbstractMethod() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { m(); } @@ -3742,7 +3742,7 @@ abstract class A { } test_makeEnclosingClassAbstract_inheritsAbstractMethod() async { - resolveTestUnit(''' + await resolveTestUnit(''' abstract class A { m(); } @@ -3761,7 +3761,7 @@ abstract class B extends A { } test_makeFieldNotFinal_hasType() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { final int fff = 1; main() { @@ -3782,7 +3782,7 @@ class A { } test_makeFieldNotFinal_noType() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { final fff = 1; main() { @@ -3803,7 +3803,7 @@ class A { } test_noException_1() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(p) { p i s Null; }'''); @@ -3814,7 +3814,7 @@ main(p) { } test_nonBoolCondition_addNotNull() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(String p) { if (p) { print(p); @@ -3833,7 +3833,7 @@ main(String p) { } test_removeDeadCode_condition() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(int p) { if (true || p > 5) { print(1); @@ -3852,7 +3852,7 @@ main(int p) { } test_removeDeadCode_statements_one() async { - resolveTestUnit(''' + await resolveTestUnit(''' int main() { print(0); return 42; @@ -3870,7 +3870,7 @@ int main() { } test_removeDeadCode_statements_two() async { - resolveTestUnit(''' + await resolveTestUnit(''' int main() { print(0); return 42; @@ -3889,7 +3889,7 @@ int main() { } test_removeParentheses_inGetterDeclaration() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int get foo() => 0; } @@ -3904,7 +3904,7 @@ class A { } test_removeParentheses_inGetterInvocation() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int get foo => 0; } @@ -3925,7 +3925,7 @@ main(A a) { } test_removeUnnecessaryCast_assignment() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(Object p) { if (p is String) { String v = ((p as String)); @@ -3945,7 +3945,7 @@ main(Object p) { test_removeUnusedCatchClause() async { errorFilter = (AnalysisError error) => true; - resolveTestUnit(''' + await resolveTestUnit(''' main() { try { throw 42; @@ -3967,7 +3967,7 @@ main() { test_removeUnusedCatchStack() async { errorFilter = (AnalysisError error) => true; - resolveTestUnit(''' + await resolveTestUnit(''' main() { try { throw 42; @@ -3988,7 +3988,7 @@ main() { } test_removeUnusedImport() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:math'; main() { } @@ -4002,7 +4002,7 @@ main() { } test_removeUnusedImport_anotherImportOnLine() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:math'; import 'dart:async'; main() { @@ -4021,7 +4021,7 @@ main() { } test_removeUnusedImport_severalLines() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:math'; main() { @@ -4038,7 +4038,7 @@ main() { test_replaceImportUri_inProject() async { testFile = '/project/bin/test.dart'; addSource('/project/foo/bar/lib.dart', ''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'no/matter/lib.dart'; '''); performAllAnalysisTasks(); @@ -4051,7 +4051,7 @@ import '../foo/bar/lib.dart'; test_replaceImportUri_package() async { _configureMyPkg({'my_lib.dart': ''}); - resolveTestUnit(''' + await resolveTestUnit(''' import 'no/matter/my_lib.dart'; '''); performAllAnalysisTasks(); @@ -4066,7 +4066,7 @@ import 'package:my_pkg/my_lib.dart'; errorFilter = (AnalysisError error) { return error.errorCode == ParserErrorCode.VAR_AS_TYPE_NAME; }; - resolveTestUnit(''' + await resolveTestUnit(''' class A { Map m; } @@ -4081,7 +4081,7 @@ class A { } test_replaceWithConstInstanceCreation() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { const A(); } @@ -4098,7 +4098,7 @@ const a = const A(); } test_undefinedClass_useSimilar_BAD_prefixed() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:async' as c; main() { c.Fture v = null; @@ -4115,7 +4115,7 @@ main() { } test_undefinedClass_useSimilar_fromImport() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { Stirng s = 'abc'; } @@ -4130,7 +4130,7 @@ main() { } test_undefinedClass_useSimilar_fromThisLibrary() async { - resolveTestUnit(''' + await resolveTestUnit(''' class MyClass {} main() { MyCalss v = null; @@ -4147,7 +4147,7 @@ main() { } test_undefinedFunction_create_duplicateArgumentNames() async { - resolveTestUnit(''' + await resolveTestUnit(''' class C { int x; } @@ -4173,7 +4173,7 @@ void bar(int x, int x2) { } test_undefinedFunction_create_dynamicArgument() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { dynamic v; test(v); @@ -4193,7 +4193,7 @@ void test(v) { } test_undefinedFunction_create_dynamicReturnType() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { dynamic v = test(); } @@ -4211,7 +4211,7 @@ test() { } test_undefinedFunction_create_fromFunction() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { int v = myUndefinedFunction(1, 2.0, '3'); } @@ -4229,7 +4229,7 @@ int myUndefinedFunction(int i, double d, String s) { } test_undefinedFunction_create_fromMethod() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { int v = myUndefinedFunction(1, 2.0, '3'); @@ -4251,7 +4251,7 @@ int myUndefinedFunction(int i, double d, String s) { } test_undefinedFunction_create_generic_BAD() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { Map items; main() { @@ -4275,7 +4275,7 @@ void process(Map items) { } test_undefinedFunction_create_generic_OK() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { List items; main() { @@ -4315,7 +4315,7 @@ library lib; import 'dart:async'; Future getFuture() => null; '''); - resolveTestUnit(''' + await resolveTestUnit(''' import 'lib.dart'; main() { test(getFuture()); @@ -4336,7 +4336,7 @@ void test(Future future) { } test_undefinedFunction_create_nullArgument() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { test(null); } @@ -4371,7 +4371,7 @@ void test(arg0) { } test_undefinedFunction_create_returnType_fromAssignment_eq() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { int v; v = myUndefinedFunction(); @@ -4391,7 +4391,7 @@ int myUndefinedFunction() { } test_undefinedFunction_create_returnType_fromAssignment_plusEq() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { int v; v += myUndefinedFunction(); @@ -4411,7 +4411,7 @@ num myUndefinedFunction() { } test_undefinedFunction_create_returnType_fromBinary_right() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { 0 + myUndefinedFunction(); } @@ -4429,7 +4429,7 @@ num myUndefinedFunction() { } test_undefinedFunction_create_returnType_fromInitializer() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { int v = myUndefinedFunction(); } @@ -4447,7 +4447,7 @@ int myUndefinedFunction() { } test_undefinedFunction_create_returnType_fromInvocationArgument() async { - resolveTestUnit(''' + await resolveTestUnit(''' foo(int p) {} main() { foo( myUndefinedFunction() ); @@ -4467,7 +4467,7 @@ int myUndefinedFunction() { } test_undefinedFunction_create_returnType_fromReturn() async { - resolveTestUnit(''' + await resolveTestUnit(''' int main() { return myUndefinedFunction(); } @@ -4485,7 +4485,7 @@ int myUndefinedFunction() { } test_undefinedFunction_create_returnType_void() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { myUndefinedFunction(); } @@ -4503,7 +4503,7 @@ void myUndefinedFunction() { } test_undefinedFunction_useSimilar_fromImport() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { pritn(0); } @@ -4518,7 +4518,7 @@ main() { } test_undefinedFunction_useSimilar_prefixed_fromImport() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:core' as c; main() { c.prnt(42); @@ -4535,7 +4535,7 @@ main() { } test_undefinedFunction_useSimilar_prefixed_ignoreLocal() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:async' as c; main() { c.main(); @@ -4545,7 +4545,7 @@ main() { } test_undefinedFunction_useSimilar_thisLibrary() async { - resolveTestUnit(''' + await resolveTestUnit(''' myFunction() {} main() { myFuntcion(); @@ -4562,7 +4562,7 @@ main() { } test_undefinedGetter_useSimilar_hint() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int myField; } @@ -4585,7 +4585,7 @@ main(A a) { } test_undefinedGetter_useSimilar_qualified() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int myField; } @@ -4606,7 +4606,7 @@ main(A a) { } test_undefinedGetter_useSimilar_qualified_static() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { static int MY_NAME = 1; } @@ -4627,7 +4627,7 @@ main() { } test_undefinedGetter_useSimilar_unqualified() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int myField; main() { @@ -4648,7 +4648,7 @@ class A { } test_undefinedMethod_create_BAD_inSDK() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { List.foo(); } @@ -4657,7 +4657,7 @@ main() { } test_undefinedMethod_create_BAD_targetIsEnum() async { - resolveTestUnit(''' + await resolveTestUnit(''' enum MyEnum {A, B} main() { MyEnum.foo(); @@ -4667,7 +4667,7 @@ main() { } test_undefinedMethod_create_generic_BAD_argumentType() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { B b; Map items; @@ -4697,7 +4697,7 @@ class B { } test_undefinedMethod_create_generic_BAD_returnType() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { T t = new B().compute(); @@ -4723,7 +4723,7 @@ class B { } test_undefinedMethod_create_generic_OK_literal() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { B b; List items; @@ -4752,7 +4752,7 @@ class B { } test_undefinedMethod_create_generic_OK_local() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { List items; main() { @@ -4775,7 +4775,7 @@ class A { } test_undefinedMethod_createQualified_emptyClassBody() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A {} main() { A.myUndefinedMethod(); @@ -4794,7 +4794,7 @@ main() { } test_undefinedMethod_createQualified_fromClass() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { } main() { @@ -4814,7 +4814,7 @@ main() { } test_undefinedMethod_createQualified_fromClass_hasOtherMember() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { foo() {} } @@ -4837,7 +4837,7 @@ main() { } test_undefinedMethod_createQualified_fromInstance() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { } main(A a) { @@ -4857,7 +4857,7 @@ main(A a) { } test_undefinedMethod_createQualified_targetIsFunctionType() async { - resolveTestUnit(''' + await resolveTestUnit(''' typedef A(); main() { A.myUndefinedMethod(); @@ -4867,7 +4867,7 @@ main() { } test_undefinedMethod_createQualified_targetIsUnresolved() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { NoSuchClass.myUndefinedMethod(); } @@ -4876,7 +4876,7 @@ main() { } test_undefinedMethod_createUnqualified_duplicateArgumentNames() async { - resolveTestUnit(''' + await resolveTestUnit(''' class C { int x; } @@ -4903,7 +4903,7 @@ class D { } test_undefinedMethod_createUnqualified_parameters() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { myUndefinedMethod(0, 1.0, '3'); @@ -4948,7 +4948,7 @@ class A { } test_undefinedMethod_createUnqualified_parameters_named() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { myUndefinedMethod(0, bbb: 1.0, ccc: '2'); @@ -4991,7 +4991,7 @@ class A { } test_undefinedMethod_createUnqualified_returnType() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { main() { int v = myUndefinedMethod(); @@ -5016,7 +5016,7 @@ class A { } test_undefinedMethod_createUnqualified_staticFromField() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { static var f = myUndefinedMethod(); } @@ -5033,7 +5033,7 @@ class A { } test_undefinedMethod_createUnqualified_staticFromMethod() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { static main() { myUndefinedMethod(); @@ -5054,7 +5054,7 @@ class A { } test_undefinedMethod_hint_createQualified_fromInstance() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { } main() { @@ -5090,7 +5090,7 @@ class D { library test3; class E {} '''); - resolveTestUnit(''' + await resolveTestUnit(''' library test; import 'test2.dart' as aaa; main(aaa.D d, aaa.E e) { @@ -5125,7 +5125,7 @@ class D { class E {} '''; addSource('/test2.dart', code2); - resolveTestUnit(''' + await resolveTestUnit(''' library test; import 'test2.dart' as test2; main(test2.D d, test2.E e) { @@ -5152,7 +5152,7 @@ class E {} } test_undefinedMethod_useSimilar_ignoreOperators() async { - resolveTestUnit(''' + await resolveTestUnit(''' main(Object object) { object.then(); } @@ -5161,7 +5161,7 @@ main(Object object) { } test_undefinedMethod_useSimilar_qualified() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { myMethod() {} } @@ -5184,7 +5184,7 @@ main() { } test_undefinedMethod_useSimilar_unqualified_superClass() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { myMethod() {} } @@ -5209,7 +5209,7 @@ class B extends A { } test_undefinedMethod_useSimilar_unqualified_thisClass() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { myMethod() {} main() { @@ -5230,7 +5230,7 @@ class A { } test_undefinedSetter_useSimilar_hint() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int myField; } @@ -5253,7 +5253,7 @@ main(A a) { } test_undefinedSetter_useSimilar_qualified() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int myField; } @@ -5274,7 +5274,7 @@ main(A a) { } test_undefinedSetter_useSimilar_unqualified() async { - resolveTestUnit(''' + await resolveTestUnit(''' class A { int myField; main() { @@ -5295,7 +5295,7 @@ class A { } test_useEffectiveIntegerDivision() async { - resolveTestUnit(''' + await resolveTestUnit(''' main() { var a = 5; var b = 2; @@ -5314,7 +5314,7 @@ main() { } test_useImportPrefix_withClass() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:async' as pref; main() { pref.Stream s = null; @@ -5333,7 +5333,7 @@ main() { } test_useImportPrefix_withTopLevelVariable() async { - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:math' as pref; main() { print(pref.E); @@ -5365,9 +5365,9 @@ class LintFixTest extends BaseFixProcessorTest { resultCode = SourceEdit.applySequence(testCode, change.edits[0].edits); } - void findLint(String src, String lintCode, {int length: 1}) { + Future findLint(String src, String lintCode, {int length: 1}) async { int errorOffset = src.indexOf('/*LINT*/'); - resolveTestUnit(src.replaceAll('/*LINT*/', '')); + await resolveTestUnit(src.replaceAll('/*LINT*/', '')); error = new AnalysisError( resolutionMap.elementDeclaredByCompilationUnit(testUnit).source, errorOffset, @@ -5384,7 +5384,7 @@ class Sub extends Test { int /*LINT*/t = 42; } '''; - findLint(src, LintNames.annotate_overrides); + await findLint(src, LintNames.annotate_overrides); await applyFix(DartFixKind.LINT_ADD_OVERRIDE); @@ -5408,7 +5408,7 @@ class Sub extends Test { int get /*LINT*/t => null; } '''; - findLint(src, LintNames.annotate_overrides); + await findLint(src, LintNames.annotate_overrides); await applyFix(DartFixKind.LINT_ADD_OVERRIDE); @@ -5432,7 +5432,7 @@ class Sub extends Test { void /*LINT*/t() { } } '''; - findLint(src, LintNames.annotate_overrides); + await findLint(src, LintNames.annotate_overrides); await applyFix(DartFixKind.LINT_ADD_OVERRIDE); @@ -5457,7 +5457,7 @@ class Sub extends Test { void /*LINT*/t() { } } '''; - findLint(src, LintNames.annotate_overrides); + await findLint(src, LintNames.annotate_overrides); await applyFix(DartFixKind.LINT_ADD_OVERRIDE); @@ -5485,7 +5485,7 @@ class Sub extends Test { void /*LINT*/t() { } } '''; - findLint(src, LintNames.annotate_overrides); + await findLint(src, LintNames.annotate_overrides); await applyFix(DartFixKind.LINT_ADD_OVERRIDE); @@ -5514,7 +5514,7 @@ class Sub extends Test { void /*LINT*/t() { } } '''; - findLint(src, LintNames.annotate_overrides); + await findLint(src, LintNames.annotate_overrides); await applyFix(DartFixKind.LINT_ADD_OVERRIDE); @@ -5541,7 +5541,7 @@ class Sub extends Test { void /*LINT*/t() { } } '''; - findLint(src, LintNames.annotate_overrides); + await findLint(src, LintNames.annotate_overrides); await applyFix(DartFixKind.LINT_ADD_OVERRIDE); @@ -5564,7 +5564,8 @@ main() { print('v: /*LINT*/${ v}'); } '''; - findLint(src, LintNames.unnecessary_brace_in_string_interp, length: 4); + await findLint(src, LintNames.unnecessary_brace_in_string_interp, + length: 4); await applyFix(DartFixKind.LINT_REMOVE_INTERPOLATION_BRACES); verifyResult(r''' main() { diff --git a/pkg/analysis_server/test/services/correction/name_suggestion_test.dart b/pkg/analysis_server/test/services/correction/name_suggestion_test.dart index fdd914e2138..c33dc66aef7 100644 --- a/pkg/analysis_server/test/services/correction/name_suggestion_test.dart +++ b/pkg/analysis_server/test/services/correction/name_suggestion_test.dart @@ -21,8 +21,8 @@ main() { @reflectiveTest class VariableNameSuggestionTest extends AbstractSingleUnitTest { - void test_forExpression_cast() { - resolveTestUnit(''' + test_forExpression_cast() async { + await resolveTestUnit(''' main() { var sortedNodes; var res = sortedNodes as String; @@ -34,8 +34,8 @@ main() { unorderedEquals(['sortedNodes', 'nodes'])); } - void test_forExpression_expectedType() { - resolveTestUnit(''' + test_forExpression_expectedType() async { + await resolveTestUnit(''' class TreeNode {} main() { TreeNode node = null; @@ -50,8 +50,8 @@ main() { expect(suggestions, unorderedEquals(['treeNode', 'node'])); } - void test_forExpression_expectedType_double() { - resolveTestUnit(''' + test_forExpression_expectedType_double() async { + await resolveTestUnit(''' main() { double res = 0.0; } @@ -70,8 +70,8 @@ main() { unorderedEquals(['f'])); } - void test_forExpression_expectedType_int() { - resolveTestUnit(''' + test_forExpression_expectedType_int() async { + await resolveTestUnit(''' main() { int res = 0; } @@ -90,8 +90,8 @@ main() { unorderedEquals(['k'])); } - void test_forExpression_expectedType_String() { - resolveTestUnit(''' + test_forExpression_expectedType_String() async { + await resolveTestUnit(''' main() { String res = 'abc'; } @@ -105,9 +105,9 @@ main() { unorderedEquals(['s'])); } - void test_forExpression_instanceCreation() { + test_forExpression_instanceCreation() async { verifyNoTestUnitErrors = false; - resolveTestUnit(''' + await resolveTestUnit(''' import 'dart:math' as p; main(p) { new NoSuchClass(); @@ -134,8 +134,8 @@ main(p) { // unorderedEquals(['noSuchClass', 'suchClass', 'class'])); } - void test_forExpression_invocationArgument_named() { - resolveTestUnit(''' + test_forExpression_invocationArgument_named() async { + await resolveTestUnit(''' foo({a, b, c}) {} main() { foo(a: 111, c: 333, b: 222); @@ -159,8 +159,8 @@ main() { } } - void test_forExpression_invocationArgument_optional() { - resolveTestUnit(''' + test_forExpression_invocationArgument_optional() async { + await resolveTestUnit(''' foo(a, [b = 2, c = 3]) {} main() { foo(111, 222, 333); @@ -184,8 +184,8 @@ main() { } } - void test_forExpression_invocationArgument_positional() { - resolveTestUnit(''' + test_forExpression_invocationArgument_positional() async { + await resolveTestUnit(''' foo(a, b) {} main() { foo(111, 222); @@ -204,8 +204,8 @@ main() { } } - void test_forExpression_methodInvocation() { - resolveTestUnit(''' + test_forExpression_methodInvocation() async { + await resolveTestUnit(''' main(p) { var res = p.getSortedNodes(); } @@ -216,8 +216,8 @@ main(p) { unorderedEquals(['sortedNodes', 'nodes'])); } - void test_forExpression_methodInvocation_noPrefix() { - resolveTestUnit(''' + test_forExpression_methodInvocation_noPrefix() async { + await resolveTestUnit(''' main(p) { var res = p.sortedNodes(); } @@ -228,8 +228,8 @@ main(p) { unorderedEquals(['sortedNodes', 'nodes'])); } - void test_forExpression_name_get() { - resolveTestUnit(''' + test_forExpression_name_get() async { + await resolveTestUnit(''' main(p) { var res = p.get(); } @@ -240,8 +240,8 @@ main(p) { unorderedEquals([])); } - void test_forExpression_prefixedIdentifier() { - resolveTestUnit(''' + test_forExpression_prefixedIdentifier() async { + await resolveTestUnit(''' main(p) { var res = p.sortedNodes; } @@ -255,8 +255,8 @@ main(p) { unorderedEquals(['sortedNodes', 'nodes'])); } - void test_forExpression_privateName() { - resolveTestUnit(''' + test_forExpression_privateName() async { + await resolveTestUnit(''' main(p) { p._name; p._computeSuffix(); @@ -277,8 +277,8 @@ main(p) { unorderedEquals(['computeSuffix', 'suffix'])); } - void test_forExpression_propertyAccess() { - resolveTestUnit(''' + test_forExpression_propertyAccess() async { + await resolveTestUnit(''' main(p) { var res = p.q.sortedNodes; } @@ -290,8 +290,8 @@ main(p) { unorderedEquals(['sortedNodes', 'nodes'])); } - void test_forExpression_simpleName() { - resolveTestUnit(''' + test_forExpression_simpleName() async { + await resolveTestUnit(''' main(p) { var sortedNodes = null; var res = sortedNodes; @@ -303,8 +303,8 @@ main(p) { unorderedEquals(['sortedNodes', 'nodes'])); } - void test_forExpression_unqualifiedInvocation() { - resolveTestUnit(''' + test_forExpression_unqualifiedInvocation() async { + await resolveTestUnit(''' getSortedNodes() => []; main(p) { var res = getSortedNodes(); diff --git a/pkg/analysis_server/test/services/correction/source_range_test.dart b/pkg/analysis_server/test/services/correction/source_range_test.dart index 28779ac31e1..86ca72ddef9 100644 --- a/pkg/analysis_server/test/services/correction/source_range_test.dart +++ b/pkg/analysis_server/test/services/correction/source_range_test.dart @@ -23,22 +23,22 @@ main() { @reflectiveTest class SourceRangesTest extends AbstractSingleUnitTest { - void test_rangeElementName() { - resolveTestUnit('class ABC {}'); + test_rangeElementName() async { + await resolveTestUnit('class ABC {}'); Element element = findElement('ABC'); expect(rangeElementName(element), new SourceRange(6, 3)); } - void test_rangeEndEnd_nodeNode() { - resolveTestUnit('main() {}'); + test_rangeEndEnd_nodeNode() async { + await resolveTestUnit('main() {}'); FunctionDeclaration mainFunction = testUnit.declarations[0]; SimpleIdentifier mainName = mainFunction.name; FunctionBody mainBody = mainFunction.functionExpression.body; expect(rangeEndEnd(mainName, mainBody), new SourceRange(4, 5)); } - void test_rangeEndStart_nodeNode() { - resolveTestUnit('main() {}'); + test_rangeEndStart_nodeNode() async { + await resolveTestUnit('main() {}'); FunctionDeclaration mainFunction = testUnit.declarations[0]; SimpleIdentifier mainName = mainFunction.name; FunctionBody mainBody = mainFunction.functionExpression.body; @@ -51,23 +51,23 @@ class SourceRangesTest extends AbstractSingleUnitTest { expect(rangeError(error), new SourceRange(10, 5)); } - void test_rangeNode() { - resolveTestUnit('main() {}'); + test_rangeNode() async { + await resolveTestUnit('main() {}'); FunctionDeclaration mainFunction = testUnit.declarations[0]; SimpleIdentifier mainName = mainFunction.name; expect(rangeNode(mainName), new SourceRange(0, 4)); } - void test_rangeNodes() { - resolveTestUnit(' main() {}'); + test_rangeNodes() async { + await resolveTestUnit(' main() {}'); FunctionDeclaration mainFunction = testUnit.declarations[0]; SimpleIdentifier mainName = mainFunction.name; FunctionBody mainBody = mainFunction.functionExpression.body; expect(rangeNodes([mainName, mainBody]), new SourceRange(1, 9)); } - void test_rangeNodes_empty() { - resolveTestUnit('main() {}'); + test_rangeNodes_empty() async { + await resolveTestUnit('main() {}'); expect(rangeNodes([]), new SourceRange(0, 0)); } @@ -75,8 +75,8 @@ class SourceRangesTest extends AbstractSingleUnitTest { expect(rangeStartEnd(10, 25), new SourceRange(10, 15)); } - void test_rangeStartEnd_nodeNode() { - resolveTestUnit(' main() {}'); + test_rangeStartEnd_nodeNode() async { + await resolveTestUnit(' main() {}'); FunctionDeclaration mainFunction = testUnit.declarations[0]; SimpleIdentifier mainName = mainFunction.name; FunctionBody mainBody = mainFunction.functionExpression.body; @@ -87,8 +87,8 @@ class SourceRangesTest extends AbstractSingleUnitTest { expect(rangeStartLength(5, 10), new SourceRange(5, 10)); } - void test_rangeStartLength_node() { - resolveTestUnit(' main() {}'); + test_rangeStartLength_node() async { + await resolveTestUnit(' main() {}'); FunctionDeclaration mainFunction = testUnit.declarations[0]; SimpleIdentifier mainName = mainFunction.name; expect(rangeStartLength(mainName, 10), new SourceRange(1, 10)); @@ -98,16 +98,16 @@ class SourceRangesTest extends AbstractSingleUnitTest { expect(rangeStartStart(10, 25), new SourceRange(10, 15)); } - void test_rangeStartStart_nodeNode() { - resolveTestUnit('main() {}'); + test_rangeStartStart_nodeNode() async { + await resolveTestUnit('main() {}'); FunctionDeclaration mainFunction = testUnit.declarations[0]; SimpleIdentifier mainName = mainFunction.name; FunctionBody mainBody = mainFunction.functionExpression.body; expect(rangeStartStart(mainName, mainBody), new SourceRange(0, 7)); } - void test_rangeToken() { - resolveTestUnit(' main() {}'); + test_rangeToken() async { + await resolveTestUnit(' main() {}'); FunctionDeclaration mainFunction = testUnit.declarations[0]; SimpleIdentifier mainName = mainFunction.name; expect(rangeToken(mainName.beginToken), new SourceRange(1, 4)); diff --git a/pkg/analysis_server/test/services/correction/status_test.dart b/pkg/analysis_server/test/services/correction/status_test.dart index 9c9169e2637..17759878d5e 100644 --- a/pkg/analysis_server/test/services/correction/status_test.dart +++ b/pkg/analysis_server/test/services/correction/status_test.dart @@ -26,8 +26,8 @@ main() { @reflectiveTest class RefactoringLocationTest extends AbstractSingleUnitTest { - void test_createLocation_forElement() { - resolveTestUnit('class MyClass {}'); + test_createLocation_forElement() async { + await resolveTestUnit('class MyClass {}'); Element element = findElement('MyClass'); // check Location location = newLocation_fromElement(element); @@ -38,8 +38,8 @@ class RefactoringLocationTest extends AbstractSingleUnitTest { expect(location.startColumn, 7); } - void test_createLocation_forMatch() { - resolveTestUnit('class MyClass {}'); + test_createLocation_forMatch() async { + await resolveTestUnit('class MyClass {}'); Element element = findElement('MyClass'); SourceRange range = rangeElementName(element); SearchMatch match = new SearchMatchImpl( @@ -57,8 +57,8 @@ class RefactoringLocationTest extends AbstractSingleUnitTest { expect(location.length, range.length); } - void test_createLocation_forNode() { - resolveTestUnit(''' + test_createLocation_forNode() async { + await resolveTestUnit(''' main() { } '''); @@ -70,8 +70,8 @@ main() { expect(location.length, node.length); } - void test_createLocation_forUnit() { - resolveTestUnit(''); + test_createLocation_forUnit() async { + await resolveTestUnit(''); SourceRange range = rangeStartLength(10, 20); // check Location location = newLocation_fromUnit(testUnit, range); diff --git a/pkg/analysis_server/test/services/correction/util_test.dart b/pkg/analysis_server/test/services/correction/util_test.dart index ee3089e004a..8639a6b281e 100644 --- a/pkg/analysis_server/test/services/correction/util_test.dart +++ b/pkg/analysis_server/test/services/correction/util_test.dart @@ -21,8 +21,8 @@ main() { @reflectiveTest class UtilTest extends AbstractSingleUnitTest { - test_addLibraryImports_dart_hasImports_between() { - resolveTestUnit(''' + test_addLibraryImports_dart_hasImports_between() async { + await resolveTestUnit(''' import 'dart:async'; import 'dart:math'; '''); @@ -36,8 +36,8 @@ import 'dart:math'; '''); } - test_addLibraryImports_dart_hasImports_first() { - resolveTestUnit(''' + test_addLibraryImports_dart_hasImports_first() async { + await resolveTestUnit(''' import 'dart:collection'; import 'dart:math'; '''); @@ -51,8 +51,8 @@ import 'dart:math'; '''); } - test_addLibraryImports_dart_hasImports_last() { - resolveTestUnit(''' + test_addLibraryImports_dart_hasImports_last() async { + await resolveTestUnit(''' import 'dart:async'; import 'dart:collection'; '''); @@ -66,8 +66,8 @@ import 'dart:math'; '''); } - test_addLibraryImports_dart_hasImports_multiple() { - resolveTestUnit(''' + test_addLibraryImports_dart_hasImports_multiple() async { + await resolveTestUnit(''' import 'dart:collection'; import 'dart:math'; '''); @@ -83,8 +83,8 @@ import 'dart:math'; '''); } - test_addLibraryImports_dart_hasImports_multiple_first() { - resolveTestUnit(''' + test_addLibraryImports_dart_hasImports_multiple_first() async { + await resolveTestUnit(''' import 'dart:html'; import 'dart:math'; '''); @@ -100,8 +100,8 @@ import 'dart:math'; '''); } - test_addLibraryImports_dart_hasImports_multiple_last() { - resolveTestUnit(''' + test_addLibraryImports_dart_hasImports_multiple_last() async { + await resolveTestUnit(''' import 'dart:async'; import 'dart:collection'; '''); @@ -117,8 +117,8 @@ import 'dart:math'; '''); } - test_addLibraryImports_dart_hasLibraryDirective() { - resolveTestUnit(''' + test_addLibraryImports_dart_hasLibraryDirective() async { + await resolveTestUnit(''' library test; class A {} @@ -137,8 +137,8 @@ class A {} '''); } - test_addLibraryImports_dart_noDirectives_hasComment() { - resolveTestUnit(''' + test_addLibraryImports_dart_noDirectives_hasComment() async { + await resolveTestUnit(''' /// Comment. class A {} @@ -157,8 +157,8 @@ class A {} '''); } - test_addLibraryImports_dart_noDirectives_hasShebang() { - resolveTestUnit(''' + test_addLibraryImports_dart_noDirectives_hasShebang() async { + await resolveTestUnit(''' #!/bin/dart class A {} @@ -177,8 +177,8 @@ class A {} '''); } - test_addLibraryImports_dart_noDirectives_noShebang() { - resolveTestUnit(''' + test_addLibraryImports_dart_noDirectives_noShebang() async { + await resolveTestUnit(''' class A {} '''); Source newLibrary1 = _getDartSource('dart:math'); @@ -193,8 +193,8 @@ class A {} '''); } - test_addLibraryImports_package_hasDart_hasPackages_insertAfter() { - resolveTestUnit(''' + test_addLibraryImports_package_hasDart_hasPackages_insertAfter() async { + await resolveTestUnit(''' import 'dart:async'; import 'package:aaa/aaa.dart'; @@ -210,8 +210,8 @@ import 'package:bbb/bbb.dart'; '''); } - test_addLibraryImports_package_hasDart_hasPackages_insertBefore() { - resolveTestUnit(''' + test_addLibraryImports_package_hasDart_hasPackages_insertBefore() async { + await resolveTestUnit(''' import 'dart:async'; import 'package:bbb/bbb.dart'; @@ -227,8 +227,8 @@ import 'package:bbb/bbb.dart'; '''); } - test_addLibraryImports_package_hasImports_between() { - resolveTestUnit(''' + test_addLibraryImports_package_hasImports_between() async { + await resolveTestUnit(''' import 'package:aaa/aaa.dart'; import 'package:ddd/ddd.dart'; '''); diff --git a/pkg/analysis_server/test/services/dependencies/reachable_source_collector_test.dart b/pkg/analysis_server/test/services/dependencies/reachable_source_collector_test.dart index 94874f958ee..0b2be14a5fd 100644 --- a/pkg/analysis_server/test/services/dependencies/reachable_source_collector_test.dart +++ b/pkg/analysis_server/test/services/dependencies/reachable_source_collector_test.dart @@ -5,7 +5,6 @@ library test.services.dependencies.import_collector; import 'package:analysis_server/src/services/dependencies/reachable_source_collector.dart'; -import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/src/generated/source.dart'; import 'package:test/test.dart'; import 'package:test_reflective_loader/test_reflective_loader.dart'; @@ -20,9 +19,6 @@ main() { @reflectiveTest class ReachableSourceCollectorTest extends AbstractContextTest { - CompilationUnit addLibrary(String path, String contents) => - resolveLibraryUnit(addSource(path, contents)); - Map> importsFor(Source source) => new ReachableSourceCollector(source, context).collectSources(); diff --git a/pkg/analysis_server/test/services/index/index_test.dart b/pkg/analysis_server/test/services/index/index_test.dart index 2d78865bb40..14aae6d0081 100644 --- a/pkg/analysis_server/test/services/index/index_test.dart +++ b/pkg/analysis_server/test/services/index/index_test.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:async'; + import 'package:analysis_server/src/services/index/index.dart'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/element/element.dart'; @@ -79,7 +81,7 @@ class IndexTest extends AbstractSingleUnitTest { } test_getDefinedNames_classMember() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { test() {} } @@ -100,7 +102,7 @@ class B { } test_getDefinedNames_topLevel() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A {} // A class B = Object with A; typedef C(); @@ -124,7 +126,7 @@ class NoMatchABCDE {} } test_getDefinedNames_topLevel2() async { - _indexTestUnit( + await _indexTestUnit( ''' class A {} // A class B = Object with A; @@ -141,11 +143,11 @@ class NoMatchABCDE {} } test_getRelations_isExtendedBy() async { - _indexTestUnit(r''' + await _indexTestUnit(r''' class A {} class B extends A {} // B '''); - Source source2 = _indexUnit( + Source source2 = await _indexUnit( '/test2.dart', r''' import 'test.dart'; @@ -159,7 +161,7 @@ class C extends A {} // C } test_getRelations_isReferencedBy() async { - _indexTestUnit(r''' + await _indexTestUnit(r''' main(int a, int b) { } '''); @@ -171,7 +173,7 @@ main(int a, int b) { } test_getUnresolvedMemberReferences_qualified_resolved() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { var test; // A } @@ -188,7 +190,7 @@ main(A a) { } test_getUnresolvedMemberReferences_qualified_unresolved() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { var test; // A } @@ -210,7 +212,7 @@ main(p) { } test_getUnresolvedMemberReferences_unqualified_resolved() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { var test; m() { @@ -228,7 +230,7 @@ class A { test_getUnresolvedMemberReferences_unqualified_unresolved() async { verifyNoTestUnitErrors = false; - _indexTestUnit(''' + await _indexTestUnit(''' class A { m() { print(test); @@ -249,7 +251,7 @@ class A { } test_indexDeclarations_afterIndexUnit() async { - resolveTestUnit(''' + await resolveTestUnit(''' var a = 0; var b = a + 1; '''); @@ -275,13 +277,13 @@ var b = a + 1; } test_indexDeclarations_nullUnitElement() async { - resolveTestUnit(''); + await resolveTestUnit(''); testUnit.element = null; index.indexDeclarations(testUnit); } test_indexUnit_nullLibraryElement() async { - resolveTestUnit(''); + await resolveTestUnit(''); CompilationUnitElement unitElement = new _CompilationUnitElementMock(); expect(unitElement.library, isNull); testUnit.element = unitElement; @@ -293,13 +295,13 @@ var b = a + 1; } test_indexUnit_nullUnitElement() async { - resolveTestUnit(''); + await resolveTestUnit(''); testUnit.element = null; index.indexUnit(testUnit); } test_removeContext() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A {} '''); RegExp regExp = new RegExp(r'^A$'); @@ -315,8 +317,8 @@ class A {} RegExp regExp = new RegExp(r'^[AB]$'); Source sourceA = addSource('/a.dart', 'class A {}'); Source sourceB = addSource('/b.dart', 'class B {}'); - CompilationUnit unitA = resolveLibraryUnit(sourceA); - CompilationUnit unitB = resolveLibraryUnit(sourceB); + CompilationUnit unitA = await resolveLibraryUnit(sourceA); + CompilationUnit unitB = await resolveLibraryUnit(sourceB); index.indexUnit(unitA); index.indexUnit(unitB); { @@ -356,8 +358,8 @@ class A {} '${locations.join('\n')}'); } - void _indexTestUnit(String code, {bool declOnly: false}) { - resolveTestUnit(code); + Future _indexTestUnit(String code, {bool declOnly: false}) async { + await resolveTestUnit(code); if (declOnly) { index.indexDeclarations(testUnit); } else { @@ -365,9 +367,9 @@ class A {} } } - Source _indexUnit(String path, String code) { + Future _indexUnit(String path, String code) async { Source source = addSource(path, code); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); index.indexUnit(unit); return source; } diff --git a/pkg/analysis_server/test/services/index/index_unit_test.dart b/pkg/analysis_server/test/services/index/index_unit_test.dart index 046bdfaf647..c2254116f67 100644 --- a/pkg/analysis_server/test/services/index/index_unit_test.dart +++ b/pkg/analysis_server/test/services/index/index_unit_test.dart @@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:async'; import 'dart:convert'; import 'package:analysis_server/src/services/index/index_unit.dart'; @@ -55,99 +56,99 @@ class PackageIndexAssemblerTest extends AbstractSingleUnitTest { return imports[index].importedLibrary.definingCompilationUnit; } - void test_definedName_classMember_field() { - _indexTestUnit(''' + test_definedName_classMember_field() async { + await _indexTestUnit(''' class A { int f; }'''); _assertDefinedName('f', IndexNameKind.classMember, 'f;'); } - void test_definedName_classMember_getter() { - _indexTestUnit(''' + test_definedName_classMember_getter() async { + await _indexTestUnit(''' class A { int get g => 0; }'''); _assertDefinedName('g', IndexNameKind.classMember, 'g => 0;'); } - void test_definedName_classMember_method() { - _indexTestUnit(''' + test_definedName_classMember_method() async { + await _indexTestUnit(''' class A { m() {} }'''); _assertDefinedName('m', IndexNameKind.classMember, 'm() {}'); } - void test_definedName_classMember_operator() { - _indexTestUnit(''' + test_definedName_classMember_operator() async { + await _indexTestUnit(''' class A { operator +(o) {} }'''); _assertDefinedName('+', IndexNameKind.classMember, '+(o) {}'); } - void test_definedName_classMember_setter() { - _indexTestUnit(''' + test_definedName_classMember_setter() async { + await _indexTestUnit(''' class A { int set s (_) {} }'''); _assertDefinedName('s', IndexNameKind.classMember, 's (_) {}'); } - void test_definedName_topLevel_class() { - _indexTestUnit('class A {}'); + test_definedName_topLevel_class() async { + await _indexTestUnit('class A {}'); _assertDefinedName('A', IndexNameKind.topLevel, 'A {}'); } - void test_definedName_topLevel_class2() { - _indexTestUnit('class A {}', declOnly: true); + test_definedName_topLevel_class2() async { + await _indexTestUnit('class A {}', declOnly: true); _assertDefinedName('A', IndexNameKind.topLevel, 'A {}'); } - void test_definedName_topLevel_classAlias() { - _indexTestUnit(''' + test_definedName_topLevel_classAlias() async { + await _indexTestUnit(''' class M {} class C = Object with M;'''); _assertDefinedName('C', IndexNameKind.topLevel, 'C ='); } - void test_definedName_topLevel_enum() { - _indexTestUnit('enum E {a, b, c}'); + test_definedName_topLevel_enum() async { + await _indexTestUnit('enum E {a, b, c}'); _assertDefinedName('E', IndexNameKind.topLevel, 'E {'); } - void test_definedName_topLevel_function() { - _indexTestUnit('foo() {}'); + test_definedName_topLevel_function() async { + await _indexTestUnit('foo() {}'); _assertDefinedName('foo', IndexNameKind.topLevel, 'foo() {}'); } - void test_definedName_topLevel_functionTypeAlias() { - _indexTestUnit('typedef F(int p);'); + test_definedName_topLevel_functionTypeAlias() async { + await _indexTestUnit('typedef F(int p);'); _assertDefinedName('F', IndexNameKind.topLevel, 'F(int p);'); } - void test_definedName_topLevel_getter() { - _indexTestUnit(''' + test_definedName_topLevel_getter() async { + await _indexTestUnit(''' int get g => 0; '''); _assertDefinedName('g', IndexNameKind.topLevel, 'g => 0;'); } - void test_definedName_topLevel_setter() { - _indexTestUnit(''' + test_definedName_topLevel_setter() async { + await _indexTestUnit(''' int set s (_) {} '''); _assertDefinedName('s', IndexNameKind.topLevel, 's (_) {}'); } - void test_definedName_topLevel_topLevelVariable() { - _indexTestUnit('var V = 42;'); + test_definedName_topLevel_topLevelVariable() async { + await _indexTestUnit('var V = 42;'); _assertDefinedName('V', IndexNameKind.topLevel, 'V = 42;'); } - void test_hasAncestor_ClassDeclaration() { - _indexTestUnit(''' + test_hasAncestor_ClassDeclaration() async { + await _indexTestUnit(''' class A {} class B1 extends A {} class B2 implements A {} @@ -168,8 +169,8 @@ class M extends Object with A {} ..isAncestorOf('M extends Object with A'); } - void test_hasAncestor_ClassTypeAlias() { - _indexTestUnit(''' + test_hasAncestor_ClassTypeAlias() async { + await _indexTestUnit(''' class A {} class B extends A {} class C1 = Object with A; @@ -183,8 +184,8 @@ class C2 = Object with B; assertThat(classElementB)..isAncestorOf('C2 = Object with B'); } - void test_isExtendedBy_ClassDeclaration() { - _indexTestUnit(''' + test_isExtendedBy_ClassDeclaration() async { + await _indexTestUnit(''' class A {} // 1 class B extends A {} // 2 '''); @@ -194,13 +195,13 @@ class B extends A {} // 2 ..isReferencedAt('A {} // 2', false); } - void test_isExtendedBy_ClassDeclaration_isQualified() { + test_isExtendedBy_ClassDeclaration_isQualified() async { addSource( '/lib.dart', ''' class A {} '''); - _indexTestUnit(''' + await _indexTestUnit(''' import 'lib.dart' as p; class B extends p.A {} // 2 '''); @@ -208,8 +209,8 @@ class B extends p.A {} // 2 assertThat(elementA).isExtendedAt('A {} // 2', true); } - void test_isExtendedBy_ClassDeclaration_Object() { - _indexTestUnit(''' + test_isExtendedBy_ClassDeclaration_Object() async { + await _indexTestUnit(''' class A {} '''); ClassElement elementA = findElement('A'); @@ -217,8 +218,8 @@ class A {} assertThat(elementObject).isExtendedAt('A {}', true, length: 0); } - void test_isExtendedBy_ClassTypeAlias() { - _indexTestUnit(''' + test_isExtendedBy_ClassTypeAlias() async { + await _indexTestUnit(''' class A {} class B {} class C = A with B; @@ -229,13 +230,13 @@ class C = A with B; ..isReferencedAt('A with', false); } - void test_isExtendedBy_ClassTypeAlias_isQualified() { + test_isExtendedBy_ClassTypeAlias_isQualified() async { addSource( '/lib.dart', ''' class A {} '''); - _indexTestUnit(''' + await _indexTestUnit(''' import 'lib.dart' as p; class B {} class C = p.A with B; @@ -246,8 +247,8 @@ class C = p.A with B; ..isReferencedAt('A with', true); } - void test_isImplementedBy_ClassDeclaration() { - _indexTestUnit(''' + test_isImplementedBy_ClassDeclaration() async { + await _indexTestUnit(''' class A {} // 1 class B implements A {} // 2 '''); @@ -257,13 +258,13 @@ class B implements A {} // 2 ..isReferencedAt('A {} // 2', false); } - void test_isImplementedBy_ClassDeclaration_isQualified() { + test_isImplementedBy_ClassDeclaration_isQualified() async { addSource( '/lib.dart', ''' class A {} '''); - _indexTestUnit(''' + await _indexTestUnit(''' import 'lib.dart' as p; class B implements p.A {} // 2 '''); @@ -273,8 +274,8 @@ class B implements p.A {} // 2 ..isReferencedAt('A {} // 2', true); } - void test_isImplementedBy_ClassTypeAlias() { - _indexTestUnit(''' + test_isImplementedBy_ClassTypeAlias() async { + await _indexTestUnit(''' class A {} // 1 class B {} // 2 class C = Object with A implements B; // 3 @@ -285,8 +286,8 @@ class C = Object with A implements B; // 3 ..isReferencedAt('B; // 3', false); } - void test_isInvokedBy_FieldElement() { - _indexTestUnit(''' + test_isInvokedBy_FieldElement() async { + await _indexTestUnit(''' class A { var field; main() { @@ -300,14 +301,14 @@ class A { ..isInvokedAt('field(); // nq', false); } - void test_isInvokedBy_FunctionElement() { + test_isInvokedBy_FunctionElement() async { addSource( '/lib.dart', ''' library lib; foo() {} '''); - _indexTestUnit(''' + await _indexTestUnit(''' import 'lib.dart'; import 'lib.dart' as pref; main() { @@ -320,9 +321,9 @@ main() { ..isInvokedAt('foo(); // nq', false); } - void test_isInvokedBy_FunctionElement_synthetic_loadLibrary() { + test_isInvokedBy_FunctionElement_synthetic_loadLibrary() async { verifyNoTestUnitErrors = false; - _indexTestUnit(''' + await _indexTestUnit(''' import 'dart:math' deferred as math; main() { math.loadLibrary(); // 1 @@ -335,8 +336,8 @@ main() { assertThat(element).isInvokedAt('loadLibrary(); // 2', true); } - void test_isInvokedBy_MethodElement() { - _indexTestUnit(''' + test_isInvokedBy_MethodElement() async { + await _indexTestUnit(''' class A { foo() {} main() { @@ -350,8 +351,8 @@ class A { ..isInvokedAt('foo(); // nq', false); } - void test_isInvokedBy_MethodElement_propagatedType() { - _indexTestUnit(''' + test_isInvokedBy_MethodElement_propagatedType() async { + await _indexTestUnit(''' class A { foo() {} } @@ -364,8 +365,8 @@ main() { assertThat(element).isInvokedAt('foo();', true); } - void test_isInvokedBy_operator_binary() { - _indexTestUnit(''' + test_isInvokedBy_operator_binary() async { + await _indexTestUnit(''' class A { operator +(other) => this; } @@ -384,8 +385,8 @@ main(A a) { ..isInvokedAt('++;', true, length: 2); } - void test_isInvokedBy_operator_index() { - _indexTestUnit(''' + test_isInvokedBy_operator_index() async { + await _indexTestUnit(''' class A { operator [](i) => null; operator []=(i, v) {} @@ -401,8 +402,8 @@ main(A a) { assertThat(writeElement).isInvokedAt('[1]', true, length: 1); } - void test_isInvokedBy_operator_prefix() { - _indexTestUnit(''' + test_isInvokedBy_operator_prefix() async { + await _indexTestUnit(''' class A { A operator ~() => this; } @@ -414,8 +415,8 @@ main(A a) { assertThat(element).isInvokedAt('~a', true, length: 1); } - void test_isInvokedBy_PropertyAccessorElement_getter() { - _indexTestUnit(''' + test_isInvokedBy_PropertyAccessorElement_getter() async { + await _indexTestUnit(''' class A { get ggg => null; main() { @@ -429,8 +430,8 @@ class A { ..isInvokedAt('ggg(); // nq', false); } - void test_isMixedInBy_ClassDeclaration() { - _indexTestUnit(''' + test_isMixedInBy_ClassDeclaration() async { + await _indexTestUnit(''' class A {} // 1 class B extends Object with A {} // 2 '''); @@ -440,13 +441,13 @@ class B extends Object with A {} // 2 ..isReferencedAt('A {} // 2', false); } - void test_isMixedInBy_ClassDeclaration_isQualified() { + test_isMixedInBy_ClassDeclaration_isQualified() async { addSource( '/lib.dart', ''' class A {} '''); - _indexTestUnit(''' + await _indexTestUnit(''' import 'lib.dart' as p; class B extends Object with p.A {} // 2 '''); @@ -454,8 +455,8 @@ class B extends Object with p.A {} // 2 assertThat(elementA).isMixedInAt('A {} // 2', true); } - void test_isMixedInBy_ClassTypeAlias() { - _indexTestUnit(''' + test_isMixedInBy_ClassTypeAlias() async { + await _indexTestUnit(''' class A {} // 1 class B = Object with A; // 2 '''); @@ -463,8 +464,8 @@ class B = Object with A; // 2 assertThat(elementA).isMixedInAt('A; // 2', false); } - void test_isReferencedBy_ClassElement() { - _indexTestUnit(''' + test_isReferencedBy_ClassElement() async { + await _indexTestUnit(''' class A { static var field; } @@ -484,9 +485,9 @@ main(A p) { ..isReferencedAt('A.field); // 3', false); } - void test_isReferencedBy_ClassElement_invocation() { + test_isReferencedBy_ClassElement_invocation() async { verifyNoTestUnitErrors = false; - _indexTestUnit(''' + await _indexTestUnit(''' class A {} main() { A(); // invalid code, but still a reference @@ -495,14 +496,14 @@ main() { assertThat(element).isReferencedAt('A();', false); } - void test_isReferencedBy_ClassElement_invocation_isQualified() { + test_isReferencedBy_ClassElement_invocation_isQualified() async { verifyNoTestUnitErrors = false; addSource( '/lib.dart', ''' class A {} '''); - _indexTestUnit(''' + await _indexTestUnit(''' import 'lib.dart' as p; main() { p.A(); // invalid code, but still a reference @@ -511,8 +512,8 @@ main() { assertThat(element).isReferencedAt('A();', true); } - void test_isReferencedBy_ClassTypeAlias() { - _indexTestUnit(''' + test_isReferencedBy_ClassTypeAlias() async { + await _indexTestUnit(''' class A {} class B = Object with A; main(B p) { @@ -525,35 +526,35 @@ main(B p) { ..isReferencedAt('B v;', false); } - void test_isReferencedBy_CompilationUnitElement_export() { + test_isReferencedBy_CompilationUnitElement_export() async { addSource( '/lib.dart', ''' library lib; '''); - _indexTestUnit(''' + await _indexTestUnit(''' export 'lib.dart'; '''); LibraryElement element = testLibraryElement.exports[0].exportedLibrary; assertThat(element)..isReferencedAt("'lib.dart'", true, length: 10); } - void test_isReferencedBy_CompilationUnitElement_import() { + test_isReferencedBy_CompilationUnitElement_import() async { addSource( '/lib.dart', ''' library lib; '''); - _indexTestUnit(''' + await _indexTestUnit(''' import 'lib.dart'; '''); LibraryElement element = testLibraryElement.imports[0].importedLibrary; assertThat(element)..isReferencedAt("'lib.dart'", true, length: 10); } - void test_isReferencedBy_CompilationUnitElement_part() { + test_isReferencedBy_CompilationUnitElement_part() async { addSource('/my_unit.dart', 'part of my_lib;'); - _indexTestUnit(''' + await _indexTestUnit(''' library my_lib; part 'my_unit.dart'; '''); @@ -561,8 +562,8 @@ part 'my_unit.dart'; assertThat(element)..isReferencedAt("'my_unit.dart';", true, length: 14); } - void test_isReferencedBy_ConstructorElement() { - _indexTestUnit(''' + test_isReferencedBy_ConstructorElement() async { + await _indexTestUnit(''' class A implements B { A() {} A.foo() {} @@ -593,8 +594,8 @@ main() { ..isReferencedAt('.foo(); // 5', true, length: 4); } - void test_isReferencedBy_ConstructorElement_classTypeAlias() { - _indexTestUnit(''' + test_isReferencedBy_ConstructorElement_classTypeAlias() async { + await _indexTestUnit(''' class M {} class A implements B { A() {} @@ -620,8 +621,8 @@ main() { ..isReferencedAt('.named(); // C2', true, length: 6); } - void test_isReferencedBy_ConstructorElement_classTypeAlias_cycle() { - _indexTestUnit(''' + test_isReferencedBy_ConstructorElement_classTypeAlias_cycle() async { + await _indexTestUnit(''' class M {} class A = B with M; class B = A with M; @@ -633,8 +634,8 @@ main() { // No additional validation, but it should not fail with stack overflow. } - void test_isReferencedBy_ConstructorElement_namedOnlyWithDot() { - _indexTestUnit(''' + test_isReferencedBy_ConstructorElement_namedOnlyWithDot() async { + await _indexTestUnit(''' class A { A.named() {} } @@ -649,8 +650,8 @@ main() { expect(unitIndex.usedElementOffsets, contains(offsetWithDot)); } - void test_isReferencedBy_ConstructorElement_redirection() { - _indexTestUnit(''' + test_isReferencedBy_ConstructorElement_redirection() async { + await _indexTestUnit(''' class A { A() : this.bar(); // 1 A.foo() : this(); // 2 @@ -664,8 +665,8 @@ class A { assertThat(constA_bar).isReferencedAt('.bar(); // 1', true, length: 4); } - void test_isReferencedBy_ConstructorElement_synthetic() { - _indexTestUnit(''' + test_isReferencedBy_ConstructorElement_synthetic() async { + await _indexTestUnit(''' class A {} main() { new A(); // 1 @@ -677,15 +678,15 @@ main() { assertThat(constA)..isReferencedAt('(); // 1', true, length: 0); } - void test_isReferencedBy_DynamicElement() { - _indexTestUnit(''' + test_isReferencedBy_DynamicElement() async { + await _indexTestUnit(''' dynamic f() { }'''); expect(unitIndex.usedElementOffsets, isEmpty); } - void test_isReferencedBy_FieldElement() { - _indexTestUnit(''' + test_isReferencedBy_FieldElement() async { + await _indexTestUnit(''' class A { var field; A({this.field}); @@ -714,8 +715,8 @@ main(A a) { assertThat(field)..isReferencedAt('field: 4', true); } - void test_isReferencedBy_FieldElement_multiple() { - _indexTestUnit(''' + test_isReferencedBy_FieldElement_multiple() async { + await _indexTestUnit(''' class A { var aaa; var bbb; @@ -748,9 +749,9 @@ class A { } } - void test_isReferencedBy_FieldElement_ofEnum() { + test_isReferencedBy_FieldElement_ofEnum() async { verifyNoTestUnitErrors = false; - _indexTestUnit(''' + await _indexTestUnit(''' enum MyEnum { A, B, C } @@ -769,9 +770,9 @@ main() { assertThat(enumElement.getGetter('B'))..isReferencedAt('B);', true); } - void test_isReferencedBy_FieldElement_synthetic_hasGetter() { + test_isReferencedBy_FieldElement_synthetic_hasGetter() async { verifyNoTestUnitErrors = false; - _indexTestUnit(''' + await _indexTestUnit(''' class A { A() : f = 42; int get f => 0; @@ -781,9 +782,9 @@ class A { assertThat(element2.getField('f')).isWrittenAt('f = 42', true); } - void test_isReferencedBy_FieldElement_synthetic_hasGetterSetter() { + test_isReferencedBy_FieldElement_synthetic_hasGetterSetter() async { verifyNoTestUnitErrors = false; - _indexTestUnit(''' + await _indexTestUnit(''' class A { A() : f = 42; int get f => 0; @@ -794,9 +795,9 @@ class A { assertThat(element2.getField('f')).isWrittenAt('f = 42', true); } - void test_isReferencedBy_FieldElement_synthetic_hasSetter() { + test_isReferencedBy_FieldElement_synthetic_hasSetter() async { verifyNoTestUnitErrors = false; - _indexTestUnit(''' + await _indexTestUnit(''' class A { A() : f = 42; set f(_) {} @@ -806,8 +807,8 @@ class A { assertThat(element2.getField('f')).isWrittenAt('f = 42', true); } - void test_isReferencedBy_FunctionElement() { - _indexTestUnit(''' + test_isReferencedBy_FunctionElement() async { + await _indexTestUnit(''' foo() {} main() { print(foo); @@ -820,13 +821,13 @@ main() { ..isInvokedAt('foo());', false); } - void test_isReferencedBy_FunctionElement_with_LibraryElement() { + test_isReferencedBy_FunctionElement_with_LibraryElement() async { addSource( '/foo.dart', r''' bar() {} '''); - _indexTestUnit(''' + await _indexTestUnit(''' import "foo.dart"; main() { bar(); @@ -840,8 +841,8 @@ main() { } } - void test_isReferencedBy_FunctionTypeAliasElement() { - _indexTestUnit(''' + test_isReferencedBy_FunctionTypeAliasElement() async { + await _indexTestUnit(''' typedef A(); main(A p) { } @@ -857,8 +858,8 @@ main(A p) { * This caused duplicate indexing. * Here we test that the problem is fixed one way or another. */ - void test_isReferencedBy_identifierInComment() { - _indexTestUnit(''' + test_isReferencedBy_identifierInComment() async { + await _indexTestUnit(''' class A {} /// [A] text var myVariable = null; @@ -867,8 +868,8 @@ var myVariable = null; assertThat(element)..isReferencedAt('A] text', false); } - void test_isReferencedBy_MethodElement() { - _indexTestUnit(''' + test_isReferencedBy_MethodElement() async { + await _indexTestUnit(''' class A { method() {} main() { @@ -882,8 +883,8 @@ class A { ..isReferencedAt('method); // nq', false); } - void test_isReferencedBy_ParameterElement() { - _indexTestUnit(''' + test_isReferencedBy_ParameterElement() async { + await _indexTestUnit(''' foo({var p}) {} main() { foo(p: 1); @@ -893,14 +894,14 @@ main() { assertThat(element)..isReferencedAt('p: 1', true); } - void test_isReferencedBy_TopLevelVariableElement() { + test_isReferencedBy_TopLevelVariableElement() async { addSource( '/lib.dart', ''' library lib; var V; '''); - _indexTestUnit(''' + await _indexTestUnit(''' import 'lib.dart' show V; // imp import 'lib.dart' as pref; main() { @@ -919,7 +920,7 @@ main() { ..isReferencedAt('V = 5; // nq', false); } - void test_isReferencedBy_TopLevelVariableElement_synthetic_hasGetterSetter() { + test_isReferencedBy_TopLevelVariableElement_synthetic_hasGetterSetter() async { verifyNoTestUnitErrors = false; addSource( '/lib.dart', @@ -927,29 +928,29 @@ main() { int get V => 0; void set V(_) {} '''); - _indexTestUnit(''' + await _indexTestUnit(''' import 'lib.dart' show V; '''); TopLevelVariableElement element = importedUnit().topLevelVariables[0]; assertThat(element).isReferencedAt('V;', true); } - void test_isReferencedBy_TopLevelVariableElement_synthetic_hasSetter() { + test_isReferencedBy_TopLevelVariableElement_synthetic_hasSetter() async { verifyNoTestUnitErrors = false; addSource( '/lib.dart', ''' void set V(_) {} '''); - _indexTestUnit(''' + await _indexTestUnit(''' import 'lib.dart' show V; '''); TopLevelVariableElement element = importedUnit().topLevelVariables[0]; assertThat(element).isReferencedAt('V;', true); } - void test_isReferencedBy_typeInVariableList() { - _indexTestUnit(''' + test_isReferencedBy_typeInVariableList() async { + await _indexTestUnit(''' class A {} A myVariable = null; '''); @@ -957,8 +958,8 @@ A myVariable = null; assertThat(element).isReferencedAt('A myVariable', false); } - void test_isWrittenBy_FieldElement() { - _indexTestUnit(''' + test_isWrittenBy_FieldElement() async { + await _indexTestUnit(''' class A { int field; A.foo({this.field}); @@ -971,9 +972,9 @@ class A { ..isWrittenAt('field = 5', true); } - void test_usedName_inLibraryIdentifier() { + test_usedName_inLibraryIdentifier() async { verifyNoTestUnitErrors = false; - _indexTestUnit(''' + await _indexTestUnit(''' library aaa.bbb.ccc; class C { var bbb; @@ -987,9 +988,9 @@ main(p) { ..isUsedQ('bbb = 1;', IndexRelationKind.IS_WRITTEN_BY); } - void test_usedName_qualified_resolved() { + test_usedName_qualified_resolved() async { verifyNoTestUnitErrors = false; - _indexTestUnit(''' + await _indexTestUnit(''' class C { var x; } @@ -1007,9 +1008,9 @@ main(C c) { ..isNotUsedQ('x();', IndexRelationKind.IS_INVOKED_BY); } - void test_usedName_qualified_unresolved() { + test_usedName_qualified_unresolved() async { verifyNoTestUnitErrors = false; - _indexTestUnit(''' + await _indexTestUnit(''' main(p) { p.x; p.x = 1; @@ -1024,9 +1025,9 @@ main(p) { ..isUsedQ('x();', IndexRelationKind.IS_INVOKED_BY); } - void test_usedName_unqualified_resolved() { + test_usedName_unqualified_resolved() async { verifyNoTestUnitErrors = false; - _indexTestUnit(''' + await _indexTestUnit(''' class C { var x; m() { @@ -1044,9 +1045,9 @@ class C { ..isNotUsedQ('x();', IndexRelationKind.IS_INVOKED_BY); } - void test_usedName_unqualified_unresolved() { + test_usedName_unqualified_unresolved() async { verifyNoTestUnitErrors = false; - _indexTestUnit(''' + await _indexTestUnit(''' main() { x; x = 1; @@ -1217,8 +1218,8 @@ main() { return _getStringId(str); } - void _indexTestUnit(String code, {bool declOnly: false}) { - resolveTestUnit(code); + Future _indexTestUnit(String code, {bool declOnly: false}) async { + await resolveTestUnit(code); PackageIndexAssembler assembler = new PackageIndexAssembler(); if (declOnly) { assembler.indexDeclarations(testUnit); diff --git a/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart b/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart index 793a1ec5dd4..026c29f7219 100644 --- a/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart +++ b/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart @@ -160,14 +160,14 @@ abstract class RefactoringTest extends AbstractSingleUnitTest { .resolveCompilationUnit(element.source, element.library); } - void indexTestUnit(String code) { - resolveTestUnit(code); + Future indexTestUnit(String code) async { + await resolveTestUnit(code); index.indexUnit(testUnit); } - void indexUnit(String file, String code) { + Future indexUnit(String file, String code) async { Source source = addSource(file, code); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); index.indexUnit(unit); } diff --git a/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart b/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart index 9b74f44ac93..859f1eba4d4 100644 --- a/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart +++ b/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart @@ -24,8 +24,8 @@ main() { class ConvertGetterToMethodTest extends RefactoringTest { ConvertGetterToMethodRefactoring refactoring; - test_change_function() { - indexTestUnit(''' + test_change_function() async { + await indexTestUnit(''' int get test => 42; main() { var a = test; @@ -43,8 +43,8 @@ main() { '''); } - test_change_method() { - indexTestUnit(''' + test_change_method() async { + await indexTestUnit(''' class A { int get test => 1; } @@ -88,15 +88,15 @@ main(A a, B b, C c, D d) { '''); } - test_change_multipleFiles() { - indexUnit( + test_change_multipleFiles() async { + await indexUnit( '/other.dart', r''' class A { int get test => 1; } '''); - indexTestUnit(''' + await indexTestUnit(''' import 'other.dart'; class B extends A { int get test => 2; @@ -120,8 +120,8 @@ main(A a, B b) { '''); } - test_checkInitialConditions_syntheticGetter() { - indexTestUnit(''' + test_checkInitialConditions_syntheticGetter() async { + await indexTestUnit(''' int test = 42; main() { } diff --git a/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart b/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart index 30bbb5b5296..4bc00e4d6d3 100644 --- a/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart +++ b/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart @@ -25,8 +25,8 @@ main() { class ConvertMethodToGetterTest extends RefactoringTest { ConvertMethodToGetterRefactoring refactoring; - test_change_function() { - indexTestUnit(''' + test_change_function() async { + await indexTestUnit(''' int test() => 42; main() { var a = test(); @@ -44,8 +44,8 @@ main() { '''); } - test_change_method() { - indexTestUnit(''' + test_change_method() async { + await indexTestUnit(''' class A { int test() => 1; } @@ -89,15 +89,15 @@ main(A a, B b, C c, D d) { '''); } - test_change_multipleFiles() { - indexUnit( + test_change_multipleFiles() async { + await indexUnit( '/other.dart', r''' class A { int test() => 1; } '''); - indexTestUnit(''' + await indexTestUnit(''' import 'other.dart'; class B extends A { int test() => 2; @@ -121,8 +121,8 @@ main(A a, B b) { '''); } - test_checkInitialConditions_alreadyGetter() { - indexTestUnit(''' + test_checkInitialConditions_alreadyGetter() async { + await indexTestUnit(''' int get test => 42; main() { var a = test; @@ -136,8 +136,8 @@ main() { 'Only class methods or top-level functions can be converted to getters.'); } - test_checkInitialConditions_hasParameters() { - indexTestUnit(''' + test_checkInitialConditions_hasParameters() async { + await indexTestUnit(''' int test(x) => x * 2; main() { var v = test(1); @@ -149,8 +149,8 @@ main() { 'Only methods without parameters can be converted to getters.'); } - test_checkInitialConditions_localFunction() { - indexTestUnit(''' + test_checkInitialConditions_localFunction() async { + await indexTestUnit(''' main() { test() {} var v = test(); @@ -162,8 +162,8 @@ main() { 'Only top-level functions can be converted to getters.'); } - test_checkInitialConditions_notFunctionOrMethod() { - indexTestUnit(''' + test_checkInitialConditions_notFunctionOrMethod() async { + await indexTestUnit(''' class A { A.test(); } @@ -174,8 +174,8 @@ class A { 'Only class methods or top-level functions can be converted to getters.'); } - test_checkInitialConditions_returnTypeVoid() { - indexTestUnit(''' + test_checkInitialConditions_returnTypeVoid() async { + await indexTestUnit(''' void test() {} '''); _createRefactoring('test'); diff --git a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart index 976e77d6cd9..2e38bf6a718 100644 --- a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart +++ b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart @@ -27,7 +27,7 @@ class ExtractLocalTest extends RefactoringTest { ExtractLocalRefactoringImpl refactoring; test_checkFinalConditions_sameVariable_after() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int a = 1 + 2; var res; @@ -41,7 +41,7 @@ main() { } test_checkFinalConditions_sameVariable_before() async { - indexTestUnit(''' + await indexTestUnit(''' main() { var res; int a = 1 + 2; @@ -55,7 +55,7 @@ main() { } test_checkInitialConditions_assignmentLeftHandSize() async { - indexTestUnit(''' + await indexTestUnit(''' main() { var v = 0; v = 1; @@ -69,7 +69,7 @@ main() { } test_checkInitialConditions_namePartOfDeclaration_function() async { - indexTestUnit(''' + await indexTestUnit(''' main() { } '''); @@ -81,7 +81,7 @@ main() { } test_checkInitialConditions_namePartOfDeclaration_variable() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int vvv = 0; } @@ -94,7 +94,7 @@ main() { } test_checkInitialConditions_noExpression() async { - indexTestUnit(''' + await indexTestUnit(''' main() { // abc } @@ -105,7 +105,7 @@ main() { } test_checkInitialConditions_notPartOfFunction() async { - indexTestUnit(''' + await indexTestUnit(''' int a = 1 + 2; '''); _createRefactoringForString('1 + 2'); @@ -117,7 +117,7 @@ int a = 1 + 2; } test_checkInitialConditions_stringSelection_leadingQuote() async { - indexTestUnit(''' + await indexTestUnit(''' main() { var vvv = 'abc'; } @@ -133,7 +133,7 @@ main() { } test_checkInitialConditions_stringSelection_trailingQuote() async { - indexTestUnit(''' + await indexTestUnit(''' main() { var vvv = 'abc'; } @@ -149,7 +149,7 @@ main() { } test_checkInitialConditions_voidExpression() async { - indexTestUnit(''' + await indexTestUnit(''' main() { print(42); } @@ -161,8 +161,8 @@ main() { expectedMessage: 'Cannot extract the void expression.'); } - test_checkName() { - indexTestUnit(''' + test_checkName() async { + await indexTestUnit(''' main() { int a = 1 + 2; } @@ -185,7 +185,7 @@ main() { } test_checkName_conflict_withInvokedFunction() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int a = 1 + 2; res(); @@ -202,7 +202,7 @@ void res() {} } test_checkName_conflict_withOtherLocal() async { - indexTestUnit(''' + await indexTestUnit(''' main() { var res; int a = 1 + 2; @@ -217,7 +217,7 @@ main() { } test_checkName_conflict_withTypeName() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int a = 1 + 2; Res b = null; @@ -233,8 +233,8 @@ class Res {} expectedMessage: "The name 'Res' is already used in the scope."); } - test_completeStatementExpression() { - indexTestUnit(''' + test_completeStatementExpression() async { + await indexTestUnit(''' main(p) { p.toString(); } @@ -248,8 +248,8 @@ main(p) { '''); } - test_const_argument_inConstInstanceCreation() { - indexTestUnit(''' + test_const_argument_inConstInstanceCreation() async { + await indexTestUnit(''' class A { const A(int a, int b); } @@ -270,8 +270,8 @@ main() { '''); } - test_const_inList() { - indexTestUnit(''' + test_const_inList() async { + await indexTestUnit(''' main() { const [1, 2]; } @@ -286,8 +286,8 @@ main() { '''); } - test_const_inList_inBinaryExpression() { - indexTestUnit(''' + test_const_inList_inBinaryExpression() async { + await indexTestUnit(''' main() { const [1 + 2, 3]; } @@ -302,8 +302,8 @@ main() { '''); } - test_const_inList_inConditionalExpression() { - indexTestUnit(''' + test_const_inList_inConditionalExpression() async { + await indexTestUnit(''' main() { const [true ? 1 : 2, 3]; } @@ -318,8 +318,8 @@ main() { '''); } - test_const_inList_inParenthesis() { - indexTestUnit(''' + test_const_inList_inParenthesis() async { + await indexTestUnit(''' main() { const [(1), 2]; } @@ -334,8 +334,8 @@ main() { '''); } - test_const_inList_inPrefixExpression() { - indexTestUnit(''' + test_const_inList_inPrefixExpression() async { + await indexTestUnit(''' main() { const [!true, 2]; } @@ -350,8 +350,8 @@ main() { '''); } - test_const_inMap_key() { - indexTestUnit(''' + test_const_inMap_key() async { + await indexTestUnit(''' main() { const {1: 2}; } @@ -366,8 +366,8 @@ main() { '''); } - test_const_inMap_value() { - indexTestUnit(''' + test_const_inMap_value() async { + await indexTestUnit(''' main() { const {1: 2}; } @@ -383,7 +383,7 @@ main() { } test_coveringExpressions() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int aaa = 1; int bbb = 2; @@ -399,7 +399,7 @@ main() { } test_coveringExpressions_inArgumentList() async { - indexTestUnit(''' + await indexTestUnit(''' main() { foo(111 + 222); } @@ -413,7 +413,7 @@ int foo(int x) => x; } test_coveringExpressions_inInvocationOfVoidFunction() async { - indexTestUnit(''' + await indexTestUnit(''' main() { foo(111 + 222); } @@ -427,7 +427,7 @@ void foo(int x) {} } test_coveringExpressions_namedExpression_value() async { - indexTestUnit(''' + await indexTestUnit(''' main() { foo(ppp: 42); } @@ -441,7 +441,7 @@ int foo({int ppp: 0}) => ppp + 1; } test_coveringExpressions_skip_assignment() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int v; foo(v = 111 + 222); @@ -456,7 +456,7 @@ int foo(x) => 42; } test_coveringExpressions_skip_constructorName() async { - indexTestUnit(''' + await indexTestUnit(''' class AAA { AAA.name() {} } @@ -472,7 +472,7 @@ main() { } test_coveringExpressions_skip_constructorName_name() async { - indexTestUnit(''' + await indexTestUnit(''' class A { A.name() {} } @@ -488,7 +488,7 @@ main() { } test_coveringExpressions_skip_constructorName_type() async { - indexTestUnit(''' + await indexTestUnit(''' class A {} main() { int v = new A(); @@ -502,7 +502,7 @@ main() { } test_coveringExpressions_skip_constructorName_typeArgument() async { - indexTestUnit(''' + await indexTestUnit(''' class A {} main() { int v = new A(); @@ -516,7 +516,7 @@ main() { } test_coveringExpressions_skip_namedExpression() async { - indexTestUnit(''' + await indexTestUnit(''' main() { foo(ppp: 42); } @@ -529,8 +529,8 @@ int foo({int ppp: 0}) => ppp + 1; expect(subExpressions, ['foo(ppp: 42)']); } - test_fragmentExpression() { - indexTestUnit(''' + test_fragmentExpression() async { + await indexTestUnit(''' main() { int a = 1 + 2 + 3 + 4; } @@ -545,8 +545,8 @@ main() { '''); } - test_fragmentExpression_leadingNotWhitespace() { - indexTestUnit(''' + test_fragmentExpression_leadingNotWhitespace() async { + await indexTestUnit(''' main() { int a = 1 + 2 + 3 + 4; } @@ -561,8 +561,8 @@ main() { '''); } - test_fragmentExpression_leadingPartialSelection() { - indexTestUnit(''' + test_fragmentExpression_leadingPartialSelection() async { + await indexTestUnit(''' main() { int a = 111 + 2 + 3 + 4; } @@ -577,8 +577,8 @@ main() { '''); } - test_fragmentExpression_leadingWhitespace() { - indexTestUnit(''' + test_fragmentExpression_leadingWhitespace() async { + await indexTestUnit(''' main() { int a = 1 + 2 + 3 + 4; } @@ -593,8 +593,8 @@ main() { '''); } - test_fragmentExpression_notAssociativeOperator() { - indexTestUnit(''' + test_fragmentExpression_notAssociativeOperator() async { + await indexTestUnit(''' main() { int a = 1 - 2 - 3 - 4; } @@ -609,8 +609,8 @@ main() { '''); } - test_fragmentExpression_trailingNotWhitespace() { - indexTestUnit(''' + test_fragmentExpression_trailingNotWhitespace() async { + await indexTestUnit(''' main() { int a = 1 + 2 + 3 + 4; } @@ -625,8 +625,8 @@ main() { '''); } - test_fragmentExpression_trailingPartialSelection() { - indexTestUnit(''' + test_fragmentExpression_trailingPartialSelection() async { + await indexTestUnit(''' main() { int a = 1 + 2 + 333 + 4; } @@ -641,8 +641,8 @@ main() { '''); } - test_fragmentExpression_trailingWhitespace() { - indexTestUnit(''' + test_fragmentExpression_trailingWhitespace() async { + await indexTestUnit(''' main() { int a = 1 + 2 + 3 + 4; } @@ -658,7 +658,7 @@ main() { } test_guessNames_fragmentExpression() async { - indexTestUnit(''' + await indexTestUnit(''' main() { var a = 111 + 222 + 333 + 444; } @@ -670,7 +670,7 @@ main() { } test_guessNames_singleExpression() async { - indexTestUnit(''' + await indexTestUnit(''' class TreeItem {} TreeItem getSelectedItem() => null; process(my) {} @@ -686,7 +686,7 @@ main() { } test_guessNames_stringPart() async { - indexTestUnit(''' + await indexTestUnit(''' main() { var s = 'Hello Bob... welcome to Dart!'; } @@ -698,7 +698,7 @@ main() { } test_occurrences_differentVariable() async { - indexTestUnit(''' + await indexTestUnit(''' main() { { int v = 1; @@ -731,8 +731,8 @@ main() { length: 3, offsets: [36, 59, 85], names: ['object', 'i']); } - test_occurrences_disableOccurrences() { - indexTestUnit(''' + test_occurrences_disableOccurrences() async { + await indexTestUnit(''' int foo() => 42; main() { int a = 1 + foo(); @@ -752,8 +752,8 @@ main() { '''); } - test_occurrences_ignore_assignmentLeftHandSize() { - indexTestUnit(''' + test_occurrences_ignore_assignmentLeftHandSize() async { + await indexTestUnit(''' main() { int v = 1; v = 2; @@ -776,8 +776,8 @@ main() { '''); } - test_occurrences_ignore_nameOfVariableDeclaration() { - indexTestUnit(''' + test_occurrences_ignore_nameOfVariableDeclaration() async { + await indexTestUnit(''' main() { int v = 1; print(v); // marker @@ -794,8 +794,8 @@ main() { '''); } - test_occurrences_singleExpression() { - indexTestUnit(''' + test_occurrences_singleExpression() async { + await indexTestUnit(''' int foo() => 42; main() { int a = 1 + foo(); @@ -814,8 +814,8 @@ main() { '''); } - test_occurrences_useDominator() { - indexTestUnit(''' + test_occurrences_useDominator() async { + await indexTestUnit(''' main() { if (true) { print(42); @@ -838,8 +838,8 @@ main() { '''); } - test_occurrences_whenComment() { - indexTestUnit(''' + test_occurrences_whenComment() async { + await indexTestUnit(''' int foo() => 42; main() { /*int a = 1 + foo();*/ @@ -858,8 +858,8 @@ main() { '''); } - test_occurrences_withSpace() { - indexTestUnit(''' + test_occurrences_withSpace() async { + await indexTestUnit(''' int foo(String s) => 42; main() { int a = 1 + foo('has space'); @@ -879,7 +879,7 @@ main() { } test_offsets_lengths() async { - indexTestUnit(''' + await indexTestUnit(''' int foo() => 42; main() { int a = 1 + foo(); // marker @@ -894,8 +894,8 @@ main() { expect(refactoring.lengths, unorderedEquals([5, 6])); } - test_singleExpression() { - indexTestUnit(''' + test_singleExpression() async { + await indexTestUnit(''' main() { int a = 1 + 2; } @@ -910,8 +910,8 @@ main() { '''); } - test_singleExpression_getter() { - indexTestUnit(''' + test_singleExpression_getter() async { + await indexTestUnit(''' class A { int get foo => 42; } @@ -934,9 +934,9 @@ main() { '''); } - test_singleExpression_hasParseError_expectedSemicolon() { + test_singleExpression_hasParseError_expectedSemicolon() async { verifyNoTestUnitErrors = false; - indexTestUnit(''' + await indexTestUnit(''' main(p) { foo p.bar.baz; @@ -954,7 +954,7 @@ main(p) { } test_singleExpression_inExpressionBody_ofClosure() async { - indexTestUnit(''' + await indexTestUnit(''' main() { print((x) => x.y * x.y + 1); } @@ -974,7 +974,7 @@ main() { } test_singleExpression_inExpressionBody_ofFunction() async { - indexTestUnit(''' + await indexTestUnit(''' foo(Point p) => p.x * p.x + p.y * p.y; class Point {int x; int y;} '''); @@ -992,7 +992,7 @@ class Point {int x; int y;} } test_singleExpression_inExpressionBody_ofMethod() async { - indexTestUnit(''' + await indexTestUnit(''' class A { foo(Point p) => p.x * p.x + p.y * p.y; } @@ -1013,8 +1013,8 @@ class Point {int x; int y;} length: 3, offsets: [35, 57, 63], names: ['x', 'i']); } - test_singleExpression_inIfElseIf() { - indexTestUnit(''' + test_singleExpression_inIfElseIf() async { + await indexTestUnit(''' main(int p) { if (p == 1) { print(1); @@ -1037,8 +1037,8 @@ main(int p) { '''); } - test_singleExpression_inMethod() { - indexTestUnit(''' + test_singleExpression_inMethod() async { + await indexTestUnit(''' class A { main() { print(1 + 2); @@ -1057,8 +1057,8 @@ class A { '''); } - test_singleExpression_leadingNotWhitespace() { - indexTestUnit(''' + test_singleExpression_leadingNotWhitespace() async { + await indexTestUnit(''' main() { int a = 12 + 345; } @@ -1073,8 +1073,8 @@ main() { '''); } - test_singleExpression_leadingWhitespace() { - indexTestUnit(''' + test_singleExpression_leadingWhitespace() async { + await indexTestUnit(''' main() { int a = 1 /*abc*/ + 2 + 345; } @@ -1090,7 +1090,7 @@ main() { } test_singleExpression_methodName_reference() async { - indexTestUnit(''' + await indexTestUnit(''' main() { var v = foo().length; } @@ -1108,7 +1108,7 @@ String foo() => ''; } test_singleExpression_nameOfProperty_prefixedIdentifier() async { - indexTestUnit(''' + await indexTestUnit(''' main(p) { var v = p.value; // marker } @@ -1124,7 +1124,7 @@ main(p) { } test_singleExpression_nameOfProperty_propertyAccess() async { - indexTestUnit(''' + await indexTestUnit(''' main() { var v = foo().length; // marker } @@ -1146,8 +1146,8 @@ String foo() => ''; * `1 + 2` will be a separate and complete binary expression, so it can be * handled as a single expression. */ - test_singleExpression_partOfBinaryExpression() { - indexTestUnit(''' + test_singleExpression_partOfBinaryExpression() async { + await indexTestUnit(''' main() { int a = 1 + 2 + 3 + 4; } @@ -1162,8 +1162,8 @@ main() { '''); } - test_singleExpression_string() { - indexTestUnit(''' + test_singleExpression_string() async { + await indexTestUnit(''' void main() { print("1234"); } @@ -1178,8 +1178,8 @@ void main() { '''); } - test_singleExpression_trailingNotWhitespace() { - indexTestUnit(''' + test_singleExpression_trailingNotWhitespace() async { + await indexTestUnit(''' main() { int a = 12 + 345; } @@ -1194,8 +1194,8 @@ main() { '''); } - test_singleExpression_trailingWhitespace() { - indexTestUnit(''' + test_singleExpression_trailingWhitespace() async { + await indexTestUnit(''' main() { int a = 1 + 2 ; } @@ -1211,7 +1211,7 @@ main() { } test_stringLiteral_part() async { - indexTestUnit(''' + await indexTestUnit(''' main() { print('abcdefgh'); } @@ -1228,7 +1228,7 @@ main() { } test_stringLiteral_whole() async { - indexTestUnit(''' + await indexTestUnit(''' main() { print('abc'); } @@ -1246,7 +1246,7 @@ main() { } test_stringLiteralPart() async { - indexTestUnit(r''' + await indexTestUnit(r''' main() { int x = 1; int y = 2; 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 61541708288..98819135291 100644 --- a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart +++ b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart @@ -25,8 +25,8 @@ main() { class ExtractMethodTest extends RefactoringTest { ExtractMethodRefactoringImpl refactoring; - test_bad_assignmentLeftHandSide() { - indexTestUnit(''' + test_bad_assignmentLeftHandSide() async { + await indexTestUnit(''' main() { int aaa; aaa = 0; @@ -37,8 +37,8 @@ main() { 'Cannot extract the left-hand side of an assignment.'); } - test_bad_comment_selectionEndsInside() { - indexTestUnit(''' + test_bad_comment_selectionEndsInside() async { + await indexTestUnit(''' main() { // start print(0); @@ -51,8 +51,8 @@ main() { return _assertConditionsFatal('Selection ends inside a comment.'); } - test_bad_comment_selectionStartsInside() { - indexTestUnit(''' + test_bad_comment_selectionStartsInside() async { + await indexTestUnit(''' main() { /* // start @@ -65,8 +65,8 @@ main() { return _assertConditionsFatal('Selection begins inside a comment.'); } - test_bad_conflict_method_alreadyDeclaresMethod() { - indexTestUnit(''' + test_bad_conflict_method_alreadyDeclaresMethod() async { + await indexTestUnit(''' class A { void res() {} main() { @@ -81,8 +81,8 @@ class A { "Class 'A' already declares method with name 'res'."); } - test_bad_conflict_method_shadowsSuperDeclaration() { - indexTestUnit(''' + test_bad_conflict_method_shadowsSuperDeclaration() async { + await indexTestUnit(''' class A { void res() {} // marker } @@ -99,8 +99,8 @@ class B extends A { return _assertConditionsError("Created method will shadow method 'A.res'."); } - test_bad_conflict_topLevel_alreadyDeclaresFunction() { - indexTestUnit(''' + test_bad_conflict_topLevel_alreadyDeclaresFunction() async { + await indexTestUnit(''' library my.lib; void res() {} @@ -115,8 +115,8 @@ main() { "Library already declares function with name 'res'."); } - test_bad_conflict_topLevel_willHideInheritedMemberUsage() { - indexTestUnit(''' + test_bad_conflict_topLevel_willHideInheritedMemberUsage() async { + await indexTestUnit(''' class A { void res() {} } @@ -136,8 +136,8 @@ main() { "Created function will shadow method 'A.res'."); } - test_bad_constructor_initializer() { - indexTestUnit(''' + test_bad_constructor_initializer() async { + await indexTestUnit(''' class A { int f; A() : f = 0 {} @@ -148,8 +148,8 @@ class A { 'Cannot extract a constructor initializer. Select expression part of initializer.'); } - test_bad_constructor_redirectingConstructor() { - indexTestUnit(''' + test_bad_constructor_redirectingConstructor() async { + await indexTestUnit(''' class A { A() : this.named(); A.named() {} @@ -160,8 +160,8 @@ class A { 'Cannot extract a constructor initializer. Select expression part of initializer.'); } - test_bad_constructor_superConstructor() { - indexTestUnit(''' + test_bad_constructor_superConstructor() async { + await indexTestUnit(''' class A {} class B extends A { B() : super(); @@ -172,8 +172,8 @@ class B extends A { 'Cannot extract a constructor initializer. Select expression part of initializer.'); } - test_bad_doWhile_body() { - indexTestUnit(''' + test_bad_doWhile_body() async { + await indexTestUnit(''' main() { do // start @@ -188,8 +188,8 @@ main() { "Operation not applicable to a 'do' statement's body and expression."); } - test_bad_emptySelection() { - indexTestUnit(''' + test_bad_emptySelection() async { + await indexTestUnit(''' main() { // start // end @@ -201,8 +201,8 @@ main() { "Can only extract a single expression or a set of statements."); } - test_bad_forLoop_conditionAndUpdaters() { - indexTestUnit(''' + test_bad_forLoop_conditionAndUpdaters() async { + await indexTestUnit(''' main() { for ( int i = 0; @@ -218,8 +218,8 @@ main() { "Operation not applicable to a 'for' statement's condition and updaters."); } - test_bad_forLoop_init() { - indexTestUnit(''' + test_bad_forLoop_init() async { + await indexTestUnit(''' main() { for ( // start @@ -235,8 +235,8 @@ main() { "Cannot extract initialization part of a 'for' statement."); } - test_bad_forLoop_initAndCondition() { - indexTestUnit(''' + test_bad_forLoop_initAndCondition() async { + await indexTestUnit(''' main() { for ( // start @@ -252,8 +252,8 @@ main() { "Operation not applicable to a 'for' statement's initializer and condition."); } - test_bad_forLoop_updaters() { - indexTestUnit(''' + test_bad_forLoop_updaters() async { + await indexTestUnit(''' main() { for ( int i = 0; @@ -269,8 +269,8 @@ main() { "Cannot extract increment part of a 'for' statement."); } - test_bad_forLoop_updatersAndBody() { - indexTestUnit(''' + test_bad_forLoop_updatersAndBody() async { + await indexTestUnit(''' main() { for ( int i = 0; @@ -286,8 +286,8 @@ main() { "Operation not applicable to a 'for' statement's updaters and body."); } - test_bad_methodName_reference() { - indexTestUnit(''' + test_bad_methodName_reference() async { + await indexTestUnit(''' main() { main(); } @@ -296,8 +296,8 @@ main() { return _assertConditionsFatal("Cannot extract a single method name."); } - test_bad_namePartOfDeclaration_function() { - indexTestUnit(''' + test_bad_namePartOfDeclaration_function() async { + await indexTestUnit(''' main() { } '''); @@ -306,8 +306,8 @@ main() { "Cannot extract the name part of a declaration."); } - test_bad_namePartOfDeclaration_variable() { - indexTestUnit(''' + test_bad_namePartOfDeclaration_variable() async { + await indexTestUnit(''' main() { int vvv = 0; } @@ -317,8 +317,8 @@ main() { "Cannot extract the name part of a declaration."); } - test_bad_namePartOfQualified() { - indexTestUnit(''' + test_bad_namePartOfQualified() async { + await indexTestUnit(''' class A { var fff; } @@ -332,8 +332,8 @@ main() { "Can not extract name part of a property access."); } - test_bad_newMethodName_notIdentifier() { - indexTestUnit(''' + test_bad_newMethodName_notIdentifier() async { + await indexTestUnit(''' main() { // start print(0); @@ -346,8 +346,8 @@ main() { return _assertConditionsFatal("Method name must not contain '-'."); } - test_bad_notSameParent() { - indexTestUnit(''' + test_bad_notSameParent() async { + await indexTestUnit(''' main() { while (false) // start @@ -363,7 +363,7 @@ main() { } test_bad_parameterName_duplicate() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int v1 = 1; int v2 = 2; @@ -386,7 +386,7 @@ main() { } test_bad_parameterName_inUse_function() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int v1 = 1; int v2 = 2; @@ -410,7 +410,7 @@ f(a, b) {} } test_bad_parameterName_inUse_localVariable() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int v1 = 1; int v2 = 2; @@ -433,7 +433,7 @@ main() { } test_bad_parameterName_inUse_method() async { - indexTestUnit(''' + await indexTestUnit(''' class A { main() { int v1 = 1; @@ -458,8 +458,8 @@ class A { "'m' is already used as a name in the selected code"); } - test_bad_selectionEndsInSomeNode() { - indexTestUnit(''' + test_bad_selectionEndsInSomeNode() async { + await indexTestUnit(''' main() { // start print(0); @@ -473,8 +473,8 @@ main() { "Extend selection to a valid range."); } - test_bad_statements_exit_notAllExecutionFlows() { - indexTestUnit(''' + test_bad_statements_exit_notAllExecutionFlows() async { + await indexTestUnit(''' main(int p) { // start if (p == 0) { @@ -488,8 +488,8 @@ main(int p) { return _assertConditionsError(ExtractMethodRefactoringImpl.ERROR_EXITS); } - test_bad_statements_return_andAssignsVariable() { - indexTestUnit(''' + test_bad_statements_return_andAssignsVariable() async { + await indexTestUnit(''' main() { // start var v = 0; @@ -504,8 +504,8 @@ main() { "local variables and return statement."); } - test_bad_switchCase() { - indexTestUnit(''' + test_bad_switchCase() async { + await indexTestUnit(''' main() { switch (1) { // start @@ -520,8 +520,8 @@ main() { "or parts of a single case block."); } - test_bad_tokensBetweenLastNodeAndSelectionEnd() { - indexTestUnit(''' + test_bad_tokensBetweenLastNodeAndSelectionEnd() async { + await indexTestUnit(''' main() { // start print(0); @@ -534,8 +534,8 @@ main() { "The end of the selection contains characters that do not belong to a statement."); } - test_bad_tokensBetweenSelectionStartAndFirstNode() { - indexTestUnit(''' + test_bad_tokensBetweenSelectionStartAndFirstNode() async { + await indexTestUnit(''' main() { // start print(0); // marker @@ -548,8 +548,8 @@ main() { "The beginning of the selection contains characters that do not belong to a statement."); } - test_bad_try_catchBlock_block() { - indexTestUnit(''' + test_bad_try_catchBlock_block() async { + await indexTestUnit(''' main() { try {} @@ -565,8 +565,8 @@ main() { "parts of try, catch, or finally block."); } - test_bad_try_catchBlock_complete() { - indexTestUnit(''' + test_bad_try_catchBlock_complete() async { + await indexTestUnit(''' main() { try {} @@ -582,8 +582,8 @@ main() { "parts of try, catch, or finally block."); } - test_bad_try_catchBlock_exception() { - indexTestUnit(''' + test_bad_try_catchBlock_exception() async { + await indexTestUnit(''' main() { try { } catch ( @@ -599,8 +599,8 @@ main() { 'Cannot extract the name part of a declaration.'); } - test_bad_try_finallyBlock() { - indexTestUnit(''' + test_bad_try_finallyBlock() async { + await indexTestUnit(''' main() { try {} @@ -616,8 +616,8 @@ main() { "parts of try, catch, or finally block."); } - test_bad_try_tryBlock() { - indexTestUnit(''' + test_bad_try_tryBlock() async { + await indexTestUnit(''' main() { try // start @@ -633,8 +633,8 @@ main() { "parts of try, catch, or finally block."); } - test_bad_typeReference() { - indexTestUnit(''' + test_bad_typeReference() async { + await indexTestUnit(''' main() { int a = 0; } @@ -643,8 +643,8 @@ main() { return _assertConditionsFatal("Cannot extract a single type reference."); } - test_bad_variableDeclarationFragment() { - indexTestUnit(''' + test_bad_variableDeclarationFragment() async { + await indexTestUnit(''' main() { int // start @@ -658,8 +658,8 @@ main() { "Cannot extract a variable declaration fragment. Select whole declaration statement."); } - test_bad_while_conditionAndBody() { - indexTestUnit(''' + test_bad_while_conditionAndBody() async { + await indexTestUnit(''' main() { while // start @@ -675,7 +675,7 @@ main() { } test_canExtractGetter_false_closure() async { - indexTestUnit(''' + await indexTestUnit(''' main() { useFunction((_) => true); } @@ -689,7 +689,7 @@ useFunction(filter(String p)) {} } test_canExtractGetter_false_fieldAssignment() async { - indexTestUnit(''' + await indexTestUnit(''' class A { var f; main() { @@ -707,7 +707,7 @@ class A { } test_canExtractGetter_false_hasParameters() async { - indexTestUnit(''' + await indexTestUnit(''' main(int p) { int a = p + 1; } @@ -720,7 +720,7 @@ main(int p) { } test_canExtractGetter_false_returnNotUsed_assignment() async { - indexTestUnit(''' + await indexTestUnit(''' var topVar = 0; f(int p) { topVar = 5; @@ -734,7 +734,7 @@ f(int p) { } test_canExtractGetter_false_returnNotUsed_noReturn() async { - indexTestUnit(''' + await indexTestUnit(''' var topVar = 0; main() { // start @@ -752,7 +752,7 @@ main() { } test_canExtractGetter_true() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int a = 1 + 2; } @@ -764,8 +764,8 @@ main() { expect(refactoring.createGetter, true); } - test_checkName() { - indexTestUnit(''' + test_checkName() async { + await indexTestUnit(''' main() { int a = 1 + 2; } @@ -786,8 +786,8 @@ main() { assertRefactoringStatusOK(refactoring.checkName()); } - test_closure_asFunction_singleExpression() { - indexTestUnit(''' + test_closure_asFunction_singleExpression() async { + await indexTestUnit(''' process(f(x)) {} main() { process((x) => x * 2); @@ -805,8 +805,8 @@ res(x) => x * 2; '''); } - test_closure_asFunction_statements() { - indexTestUnit(''' + test_closure_asFunction_statements() async { + await indexTestUnit(''' process(f(x)) {} main() { process((x) { @@ -830,8 +830,8 @@ res(x) { '''); } - test_closure_asMethod_statements() { - indexTestUnit(''' + test_closure_asMethod_statements() async { + await indexTestUnit(''' process(f(x)) {} class A { int k = 2; @@ -862,7 +862,7 @@ class A { } test_closure_bad_referencesLocalVariable() async { - indexTestUnit(''' + await indexTestUnit(''' process(f(x)) {} main() { int k = 2; @@ -878,7 +878,7 @@ main() { } test_closure_bad_referencesParameter() async { - indexTestUnit(''' + await indexTestUnit(''' process(f(x)) {} main(int k) { process((x) => x * k); @@ -892,8 +892,8 @@ main(int k) { 'Cannot extract closure as method, it references 1 external variable(s).'); } - test_fromTopLevelVariableInitializerClosure() { - indexTestUnit(''' + test_fromTopLevelVariableInitializerClosure() async { + await indexTestUnit(''' var X = 1; var Y = () { @@ -914,7 +914,7 @@ num res() => 1 + X; } test_getExtractGetter_expression_true_binaryExpression() async { - indexTestUnit(''' + await indexTestUnit(''' main() { print(1 + 2); } @@ -926,7 +926,7 @@ main() { } test_getExtractGetter_expression_true_literal() async { - indexTestUnit(''' + await indexTestUnit(''' main() { print(42); } @@ -938,7 +938,7 @@ main() { } test_getExtractGetter_expression_true_prefixedExpression() async { - indexTestUnit(''' + await indexTestUnit(''' main() { print(!true); } @@ -950,7 +950,7 @@ main() { } test_getExtractGetter_expression_true_prefixedIdentifier() async { - indexTestUnit(''' + await indexTestUnit(''' main() { print(myValue.isEven); } @@ -963,7 +963,7 @@ int get myValue => 42; } test_getExtractGetter_expression_true_propertyAccess() async { - indexTestUnit(''' + await indexTestUnit(''' main() { print(1.isEven); } @@ -975,7 +975,7 @@ main() { } test_getExtractGetter_statements() async { - indexTestUnit(''' + await indexTestUnit(''' main() { // start int v = 0; @@ -989,8 +989,8 @@ main() { expect(refactoring.createGetter, false); } - test_getRefactoringName_function() { - indexTestUnit(''' + test_getRefactoringName_function() async { + await indexTestUnit(''' main() { print(1 + 2); } @@ -999,8 +999,8 @@ main() { expect(refactoring.refactoringName, 'Extract Function'); } - test_getRefactoringName_method() { - indexTestUnit(''' + test_getRefactoringName_method() async { + await indexTestUnit(''' class A { main() { print(1 + 2); @@ -1012,7 +1012,7 @@ class A { } test_names_singleExpression() async { - indexTestUnit(''' + await indexTestUnit(''' class TreeItem {} TreeItem getSelectedItem() => null; process(my) {} @@ -1029,7 +1029,7 @@ main() { } test_offsets_lengths() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int a = 1 + 2; int b = 1 + 2; @@ -1044,7 +1044,7 @@ main() { } test_returnType_closure() async { - indexTestUnit(''' + await indexTestUnit(''' process(f(x)) {} main() { process((x) => x * 2); @@ -1057,7 +1057,7 @@ main() { } test_returnType_expression() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int a = 1 + 2; } @@ -1069,7 +1069,7 @@ main() { } test_returnType_mixInterfaceFunction() async { - indexTestUnit(''' + await indexTestUnit(''' main() { // start if (true) { @@ -1087,7 +1087,7 @@ main() { } test_returnType_statements() async { - indexTestUnit(''' + await indexTestUnit(''' main() { // start double v = 5.0; @@ -1102,7 +1102,7 @@ main() { } test_returnType_statements_nullMix() async { - indexTestUnit(''' + await indexTestUnit(''' main(bool p) { // start if (p) { @@ -1119,7 +1119,7 @@ main(bool p) { } test_returnType_statements_void() async { - indexTestUnit(''' + await indexTestUnit(''' main() { // start print(42); @@ -1133,7 +1133,7 @@ main() { } test_setExtractGetter() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int a = 1 + 2; } @@ -1153,8 +1153,8 @@ int get res => 1 + 2; '''); } - test_singleExpression() { - indexTestUnit(''' + test_singleExpression() async { + await indexTestUnit(''' main() { int a = 1 + 2; } @@ -1170,8 +1170,8 @@ int res() => 1 + 2; '''); } - test_singleExpression_cascade() { - indexTestUnit(''' + test_singleExpression_cascade() async { + await indexTestUnit(''' main() { String s = ''; var v = s..length; @@ -1189,8 +1189,8 @@ String res(String s) => s..length; '''); } - test_singleExpression_dynamic() { - indexTestUnit(''' + test_singleExpression_dynamic() async { + await indexTestUnit(''' dynaFunction() {} main() { var v = dynaFunction(); // marker @@ -1208,8 +1208,8 @@ res() => dynaFunction(); '''); } - test_singleExpression_hasAwait() { - indexTestUnit(''' + test_singleExpression_hasAwait() async { + await indexTestUnit(''' import 'dart:async'; Future getValue() => 42; main() async { @@ -1231,8 +1231,8 @@ Future res() async => await getValue(); '''); } - test_singleExpression_ignore_assignmentLeftHandSize() { - indexTestUnit(''' + test_singleExpression_ignore_assignmentLeftHandSize() async { + await indexTestUnit(''' main() { getButton().text = 'txt'; print(getButton().text); // marker @@ -1252,8 +1252,8 @@ getButton() {} '''); } - test_singleExpression_occurrences() { - indexTestUnit(''' + test_singleExpression_occurrences() async { + await indexTestUnit(''' main() { int v1 = 1; int v2 = 2; @@ -1289,8 +1289,8 @@ int res(int v1, int v2) => v1 + v2; '''); } - test_singleExpression_occurrences_disabled() { - indexTestUnit(''' + test_singleExpression_occurrences_disabled() async { + await indexTestUnit(''' main() { int v1 = 1; int v2 = 2; @@ -1315,8 +1315,8 @@ int res(int v1, int v2) => v1 + v2; '''); } - test_singleExpression_occurrences_inClassOnly() { - indexTestUnit(''' + test_singleExpression_occurrences_inClassOnly() async { + await indexTestUnit(''' class A { myMethod() { int v1 = 1; @@ -1350,8 +1350,8 @@ main() { '''); } - test_singleExpression_occurrences_incompatibleTypes() { - indexTestUnit(''' + test_singleExpression_occurrences_incompatibleTypes() async { + await indexTestUnit(''' main() { int x = 1; String y = 'foo'; @@ -1373,8 +1373,8 @@ String res(int x) => x.toString(); '''); } - test_singleExpression_occurrences_inWholeUnit() { - indexTestUnit(''' + test_singleExpression_occurrences_inWholeUnit() async { + await indexTestUnit(''' main() { int v1 = 1; int v2 = 2; @@ -1408,8 +1408,8 @@ class A { '''); } - test_singleExpression_parameter_functionTypeAlias() { - indexTestUnit(''' + test_singleExpression_parameter_functionTypeAlias() async { + await indexTestUnit(''' typedef R Foo(S s); void main(Foo foo, String s) { int a = foo(s); @@ -1429,7 +1429,7 @@ int res(Foo foo, String s) => foo(s); test_singleExpression_returnType_importLibrary() async { _addLibraryReturningAsync(); - indexTestUnit(''' + await indexTestUnit(''' import 'asyncLib.dart'; main() { var a = newFuture(); @@ -1448,8 +1448,8 @@ Future res() => newFuture(); '''); } - test_singleExpression_returnTypeGeneric() { - indexTestUnit(''' + test_singleExpression_returnTypeGeneric() async { + await indexTestUnit(''' main() { var v = new List(); } @@ -1465,8 +1465,8 @@ List res() => new List(); '''); } - test_singleExpression_returnTypePrefix() { - indexTestUnit(''' + test_singleExpression_returnTypePrefix() async { + await indexTestUnit(''' import 'dart:math' as pref; main() { var v = new pref.Random(); @@ -1484,8 +1484,8 @@ pref.Random res() => new pref.Random(); '''); } - test_singleExpression_staticContext_extractFromInitializer() { - indexTestUnit(''' + test_singleExpression_staticContext_extractFromInitializer() async { + await indexTestUnit(''' class A { A(int v) {} } @@ -1507,8 +1507,8 @@ class B extends A { '''); } - test_singleExpression_staticContext_extractFromInstance() { - indexTestUnit(''' + test_singleExpression_staticContext_extractFromInstance() async { + await indexTestUnit(''' class A { instanceMethodA() { int v1 = 1; @@ -1552,8 +1552,8 @@ class A { '''); } - test_singleExpression_staticContext_extractFromStatic() { - indexTestUnit(''' + test_singleExpression_staticContext_extractFromStatic() async { + await indexTestUnit(''' class A { static staticMethodA() { int v1 = 1; @@ -1597,8 +1597,8 @@ class A { '''); } - test_singleExpression_staticContext_hasInInitializer() { - indexTestUnit(''' + test_singleExpression_staticContext_hasInInitializer() async { + await indexTestUnit(''' class A { A(int v) {} } @@ -1626,8 +1626,8 @@ class B extends A { '''); } - test_singleExpression_usesParameter() { - indexTestUnit(''' + test_singleExpression_usesParameter() async { + await indexTestUnit(''' fooA(int a1) { int a2 = 2; int a = a1 + a2; @@ -1653,8 +1653,8 @@ fooB(int b1) { '''); } - test_singleExpression_withVariables() { - indexTestUnit(''' + test_singleExpression_withVariables() async { + await indexTestUnit(''' main() { int v1 = 1; int v2 = 2; @@ -1675,7 +1675,7 @@ int res(int v1, int v2) => v1 + v2 + v1; } test_singleExpression_withVariables_doRename() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int v1 = 1; int v2 = 2; @@ -1712,7 +1712,7 @@ int res(int par1, int param2) => par1 + param2 + par1; } test_singleExpression_withVariables_doReorder() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int v1 = 1; int v2 = 2; @@ -1748,8 +1748,8 @@ int res(int v2, int v1) => v1 + v2; '''); } - test_singleExpression_withVariables_namedExpression() { - indexTestUnit(''' + test_singleExpression_withVariables_namedExpression() async { + await indexTestUnit(''' main() { int v1 = 1; int v2 = 2; @@ -1772,7 +1772,7 @@ process({arg}) {} } test_singleExpression_withVariables_newType() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int v1 = 1; int v2 = 2; @@ -1808,8 +1808,8 @@ int res(num v1, v2, v3) => v1 + v2 + v3; '''); } - test_singleExpression_withVariables_useBestType() { - indexTestUnit(''' + test_singleExpression_withVariables_useBestType() async { + await indexTestUnit(''' main() { var v1 = 1; var v2 = 2; @@ -1829,8 +1829,8 @@ int res(int v1, int v2) => v1 + v2 + v1; '''); } - test_statements_assignment() { - indexTestUnit(''' + test_statements_assignment() async { + await indexTestUnit(''' main() { int v; // start @@ -1857,8 +1857,8 @@ int res(int v) { '''); } - test_statements_changeIndentation() { - indexTestUnit(''' + test_statements_changeIndentation() async { + await indexTestUnit(''' main() { { // start @@ -1888,8 +1888,8 @@ void res() { '''); } - test_statements_changeIndentation_multilineString() { - indexTestUnit(''' + test_statements_changeIndentation_multilineString() async { + await indexTestUnit(''' main() { { // start @@ -1921,8 +1921,8 @@ second line '''); } - test_statements_definesVariable_notUsedOutside() { - indexTestUnit(''' + test_statements_definesVariable_notUsedOutside() async { + await indexTestUnit(''' main() { int a = 1; int b = 1; @@ -1950,8 +1950,8 @@ void res(int a, int b) { '''); } - test_statements_definesVariable_oneUsedOutside_assignment() { - indexTestUnit(''' + test_statements_definesVariable_oneUsedOutside_assignment() async { + await indexTestUnit(''' myFunctionA() { int a = 1; // start @@ -1988,8 +1988,8 @@ myFunctionB() { '''); } - test_statements_definesVariable_oneUsedOutside_declaration() { - indexTestUnit(''' + test_statements_definesVariable_oneUsedOutside_declaration() async { + await indexTestUnit(''' myFunctionA() { int a = 1; int b = 2; @@ -2031,7 +2031,7 @@ myFunctionB() { } test_statements_definesVariable_twoUsedOutside() async { - indexTestUnit(''' + await indexTestUnit(''' main() { // start int varA = 1; @@ -2046,8 +2046,8 @@ main() { assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL); } - test_statements_duplicate_absolutelySame() { - indexTestUnit(''' + test_statements_duplicate_absolutelySame() async { + await indexTestUnit(''' myFunctionA() { print(0); print(1); @@ -2078,8 +2078,8 @@ void res() { '''); } - test_statements_duplicate_declaresDifferentlyNamedVariable() { - indexTestUnit(''' + test_statements_duplicate_declaresDifferentlyNamedVariable() async { + await indexTestUnit(''' myFunctionA() { int varA = 1; print(varA); @@ -2110,8 +2110,8 @@ void res() { '''); } - test_statements_dynamic() { - indexTestUnit(''' + test_statements_dynamic() async { + await indexTestUnit(''' dynaFunction(p) => 0; main() { // start @@ -2143,8 +2143,8 @@ res() { /** * We should always add ";" when invoke method with extracted statements. */ - test_statements_endsWithBlock() { - indexTestUnit(''' + test_statements_endsWithBlock() async { + await indexTestUnit(''' main() { // start if (true) { @@ -2171,7 +2171,7 @@ void res() { } test_statements_exit_throws() async { - indexTestUnit(''' + await indexTestUnit(''' main(int p) { // start if (p == 0) { @@ -2185,8 +2185,8 @@ main(int p) { await assertRefactoringConditionsOK(); } - test_statements_hasAwait_dynamicReturnType() { - indexTestUnit(''' + test_statements_hasAwait_dynamicReturnType() async { + await indexTestUnit(''' import 'dart:async'; Future getValue() => 42; main() async { @@ -2215,8 +2215,8 @@ Future res() async { '''); } - test_statements_hasAwait_expression() { - indexTestUnit(''' + test_statements_hasAwait_expression() async { + await indexTestUnit(''' import 'dart:async'; Future getValue() => 42; main() async { @@ -2247,8 +2247,8 @@ Future res() async { '''); } - test_statements_hasAwait_forEach() { - indexTestUnit(''' + test_statements_hasAwait_forEach() async { + await indexTestUnit(''' import 'dart:async'; Stream getValueStream() => null; main() async { @@ -2283,8 +2283,8 @@ Future res() async { '''); } - test_statements_hasAwait_voidReturnType() { - indexTestUnit(''' + test_statements_hasAwait_voidReturnType() async { + await indexTestUnit(''' import 'dart:async'; Future getValue() => 42; main() async { @@ -2312,8 +2312,8 @@ Future res() async { '''); } - test_statements_inSwitchMember() { - indexTestUnit(''' + test_statements_inSwitchMember() async { + await indexTestUnit(''' class A { foo(int p) { switch (p) { @@ -2351,8 +2351,8 @@ class A { '''); } - test_statements_method() { - indexTestUnit(''' + test_statements_method() async { + await indexTestUnit(''' class A { foo() { // start @@ -2378,8 +2378,8 @@ class A { '''); } - test_statements_noDuplicates() { - indexTestUnit(''' + test_statements_noDuplicates() async { + await indexTestUnit(''' main() { int a = 1; int b = 1; @@ -2406,7 +2406,7 @@ void res(int a) { } test_statements_parameters_ignoreInnerPropagatedType() async { - indexTestUnit(''' + await indexTestUnit(''' main(Object x) { // start if (x is int) { @@ -2438,9 +2438,9 @@ void res(Object x) { '''); } - test_statements_parameters_importType() { + test_statements_parameters_importType() async { _addLibraryReturningAsync(); - indexTestUnit(''' + await indexTestUnit(''' import 'asyncLib.dart'; main() { var v = newFuture(); @@ -2467,9 +2467,9 @@ void res(Future v) { '''); } - test_statements_parameters_localFunction() { + test_statements_parameters_localFunction() async { _addLibraryReturningAsync(); - indexTestUnit(''' + await indexTestUnit(''' class C { int f(int a) { int callback(int x, int y) => x + a; @@ -2503,7 +2503,7 @@ class C { } test_statements_parameters_noLocalVariableConflict() async { - indexTestUnit(''' + await indexTestUnit(''' int f(int x) { int y = x + 1; // start @@ -2520,8 +2520,8 @@ int f(int x) { await assertRefactoringConditionsOK(); } - test_statements_return_last() { - indexTestUnit(''' + test_statements_return_last() async { + await indexTestUnit(''' main() { // start int v = 5; @@ -2545,8 +2545,8 @@ int res() { '''); } - test_statements_return_multiple_ifElse() { - indexTestUnit(''' + test_statements_return_multiple_ifElse() async { + await indexTestUnit(''' num main(bool b) { // start if (b) { @@ -2576,8 +2576,8 @@ num res(bool b) { '''); } - test_statements_return_multiple_ifThen() { - indexTestUnit(''' + test_statements_return_multiple_ifThen() async { + await indexTestUnit(''' num main(bool b) { // start if (b) { @@ -2605,8 +2605,8 @@ num res(bool b) { '''); } - test_statements_return_multiple_ignoreInFunction() { - indexTestUnit(''' + test_statements_return_multiple_ignoreInFunction() async { + await indexTestUnit(''' int main() { // start localFunction() { @@ -2634,8 +2634,8 @@ int res() { '''); } - test_statements_return_multiple_interfaceFunction() { - indexTestUnit(''' + test_statements_return_multiple_interfaceFunction() async { + await indexTestUnit(''' main(bool b) { // start if (b) { @@ -2663,8 +2663,8 @@ Object res(bool b) { '''); } - test_statements_return_multiple_sameElementDifferentTypeArgs() { - indexTestUnit(''' + test_statements_return_multiple_sameElementDifferentTypeArgs() async { + await indexTestUnit(''' main(bool b) { // start if (b) { @@ -2698,8 +2698,8 @@ List res(bool b) { '''); } - test_statements_return_single() { - indexTestUnit(''' + test_statements_return_single() async { + await indexTestUnit(''' main() { // start return 42; @@ -2725,8 +2725,8 @@ int res() { * We have 3 identical statements, but select only 2. * This should not cause problems. */ - test_statements_twoOfThree() { - indexTestUnit(''' + test_statements_twoOfThree() async { + await indexTestUnit(''' main() { // start print(0); diff --git a/pkg/analysis_server/test/services/refactoring/inline_local_test.dart b/pkg/analysis_server/test/services/refactoring/inline_local_test.dart index e3ccaa146e3..47e3455ef36 100644 --- a/pkg/analysis_server/test/services/refactoring/inline_local_test.dart +++ b/pkg/analysis_server/test/services/refactoring/inline_local_test.dart @@ -24,7 +24,7 @@ class InlineLocalTest extends RefactoringTest { InlineLocalRefactoringImpl refactoring; test_access() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int test = 1 + 2; print(test); @@ -40,7 +40,7 @@ main() { } test_bad_selectionMethod() async { - indexTestUnit(r''' + await indexTestUnit(r''' main() { } '''); @@ -50,7 +50,7 @@ main() { } test_bad_selectionParameter() async { - indexTestUnit(r''' + await indexTestUnit(r''' main(int test) { } '''); @@ -60,7 +60,7 @@ main(int test) { } test_bad_selectionVariable_hasAssignments_1() async { - indexTestUnit(r''' + await indexTestUnit(r''' main() { int test = 0; test = 1; @@ -73,7 +73,7 @@ main() { } test_bad_selectionVariable_hasAssignments_2() async { - indexTestUnit(r''' + await indexTestUnit(r''' main() { int test = 0; test += 1; @@ -86,7 +86,7 @@ main() { } test_bad_selectionVariable_notInBlock() async { - indexTestUnit(r''' + await indexTestUnit(r''' main() { if (true) int test = 0; @@ -98,7 +98,7 @@ main() { } test_bad_selectionVariable_notInitialized() async { - indexTestUnit(r''' + await indexTestUnit(r''' main() { int test; } @@ -108,8 +108,8 @@ main() { assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL); } - test_OK_cascade_intoCascade() { - indexTestUnit(r''' + test_OK_cascade_intoCascade() async { + await indexTestUnit(r''' class A { foo() {} bar() {} @@ -132,8 +132,8 @@ main() { '''); } - test_OK_cascade_intoNotCascade() { - indexTestUnit(r''' + test_OK_cascade_intoNotCascade() async { + await indexTestUnit(r''' class A { foo() {} bar() {} @@ -156,8 +156,8 @@ main() { '''); } - test_OK_inSwitchCase() { - indexTestUnit(''' + test_OK_inSwitchCase() async { + await indexTestUnit(''' main(int p) { switch (p) { case 0: @@ -180,8 +180,8 @@ main(int p) { '''); } - test_OK_intoStringInterpolation_binaryExpression() { - indexTestUnit(r''' + test_OK_intoStringInterpolation_binaryExpression() async { + await indexTestUnit(r''' main() { int test = 1 + 2; print('test = $test'); @@ -202,8 +202,8 @@ process(x) {} '''); } - test_OK_intoStringInterpolation_simpleIdentifier() { - indexTestUnit(r''' + test_OK_intoStringInterpolation_simpleIdentifier() async { + await indexTestUnit(r''' main() { int foo = 1 + 2; int test = foo; @@ -226,8 +226,8 @@ process(x) {} '''); } - test_OK_intoStringInterpolation_string_differentQuotes() { - indexTestUnit(r''' + test_OK_intoStringInterpolation_string_differentQuotes() async { + await indexTestUnit(r''' main() { String a = "aaa"; String b = '$a bbb'; @@ -242,8 +242,8 @@ main() { '''); } - test_OK_intoStringInterpolation_string_doubleQuotes() { - indexTestUnit(r''' + test_OK_intoStringInterpolation_string_doubleQuotes() async { + await indexTestUnit(r''' main() { String a = "aaa"; String b = "$a bbb"; @@ -258,8 +258,8 @@ main() { '''); } - test_OK_intoStringInterpolation_string_multiLineIntoMulti_leadingSpaces() { - indexTestUnit(r""" + test_OK_intoStringInterpolation_string_multiLineIntoMulti_leadingSpaces() async { + await indexTestUnit(r""" main() { String a = '''\ \ a @@ -281,8 +281,8 @@ bbb'''; """); } - test_OK_intoStringInterpolation_string_multiLineIntoMulti_unixEOL() { - indexTestUnit(r""" + test_OK_intoStringInterpolation_string_multiLineIntoMulti_unixEOL() async { + await indexTestUnit(r""" main() { String a = ''' a @@ -306,8 +306,8 @@ bbb'''; """); } - test_OK_intoStringInterpolation_string_multiLineIntoMulti_windowsEOL() { - indexTestUnit(r""" + test_OK_intoStringInterpolation_string_multiLineIntoMulti_windowsEOL() async { + await indexTestUnit(r""" main() { String a = ''' a @@ -333,8 +333,8 @@ bbb'''; .replaceAll('\n', '\r\n')); } - test_OK_intoStringInterpolation_string_multiLineIntoSingle() { - indexTestUnit(r''' + test_OK_intoStringInterpolation_string_multiLineIntoSingle() async { + await indexTestUnit(r''' main() { String a = """aaa"""; String b = "$a bbb"; @@ -349,8 +349,8 @@ main() { '''); } - test_OK_intoStringInterpolation_string_raw() { - indexTestUnit(r''' + test_OK_intoStringInterpolation_string_raw() async { + await indexTestUnit(r''' main() { String a = r'an $ignored interpolation'; String b = '$a bbb'; @@ -365,8 +365,8 @@ main() { '''); } - test_OK_intoStringInterpolation_string_singleLineIntoMulti_doubleQuotes() { - indexTestUnit(r''' + test_OK_intoStringInterpolation_string_singleLineIntoMulti_doubleQuotes() async { + await indexTestUnit(r''' main() { String a = "aaa"; String b = """$a bbb"""; @@ -381,8 +381,8 @@ main() { '''); } - test_OK_intoStringInterpolation_string_singleLineIntoMulti_singleQuotes() { - indexTestUnit(r""" + test_OK_intoStringInterpolation_string_singleLineIntoMulti_singleQuotes() async { + await indexTestUnit(r""" main() { String a = 'aaa'; String b = '''$a bbb'''; @@ -397,8 +397,8 @@ main() { """); } - test_OK_intoStringInterpolation_string_singleQuotes() { - indexTestUnit(r''' + test_OK_intoStringInterpolation_string_singleQuotes() async { + await indexTestUnit(r''' main() { String a = 'aaa'; String b = '$a bbb'; @@ -413,8 +413,8 @@ main() { '''); } - test_OK_intoStringInterpolation_stringInterpolation() { - indexTestUnit(r''' + test_OK_intoStringInterpolation_stringInterpolation() async { + await indexTestUnit(r''' main() { String a = 'aaa'; String b = '$a bbb'; @@ -435,8 +435,8 @@ main() { *

* https://code.google.com/p/dart/issues/detail?id=18587 */ - test_OK_keepNextCommentedLine() { - indexTestUnit(''' + test_OK_keepNextCommentedLine() async { + await indexTestUnit(''' main() { int test = 1 + 2; // foo @@ -455,8 +455,8 @@ main() { '''); } - test_OK_noUsages_1() { - indexTestUnit(''' + test_OK_noUsages_1() async { + await indexTestUnit(''' main() { int test = 1 + 2; print(0); @@ -471,8 +471,8 @@ main() { '''); } - test_OK_noUsages_2() { - indexTestUnit(''' + test_OK_noUsages_2() async { + await indexTestUnit(''' main() { int test = 1 + 2; } @@ -485,8 +485,8 @@ main() { '''); } - test_OK_oneUsage() { - indexTestUnit(''' + test_OK_oneUsage() async { + await indexTestUnit(''' main() { int test = 1 + 2; print(test); @@ -501,8 +501,8 @@ main() { '''); } - test_OK_parenthesis_decrement_intoNegate() { - indexTestUnit(''' + test_OK_parenthesis_decrement_intoNegate() async { + await indexTestUnit(''' main() { var a = 1; var test = --a; @@ -519,8 +519,8 @@ main() { '''); } - test_OK_parenthesis_instanceCreation_intoList() { - indexTestUnit(''' + test_OK_parenthesis_instanceCreation_intoList() async { + await indexTestUnit(''' class A {} main() { var test = new A(); @@ -537,8 +537,8 @@ main() { '''); } - test_OK_parenthesis_intoIndexExpression_index() { - indexTestUnit(''' + test_OK_parenthesis_intoIndexExpression_index() async { + await indexTestUnit(''' main() { var items = []; var test = 1 + 2; @@ -555,8 +555,8 @@ main() { '''); } - test_OK_parenthesis_intoParenthesizedExpression() { - indexTestUnit(''' + test_OK_parenthesis_intoParenthesizedExpression() async { + await indexTestUnit(''' f(m, x, y) { int test = x as int; m[test] = y; @@ -573,8 +573,8 @@ f(m, x, y) { '''); } - test_OK_parenthesis_negate_intoNegate() { - indexTestUnit(''' + test_OK_parenthesis_negate_intoNegate() async { + await indexTestUnit(''' main() { var a = 1; var test = -a; @@ -591,8 +591,8 @@ main() { '''); } - test_OK_parenthesis_plus_intoMultiply() { - indexTestUnit(''' + test_OK_parenthesis_plus_intoMultiply() async { + await indexTestUnit(''' main() { var test = 1 + 2; print(test * 3); @@ -607,8 +607,8 @@ main() { '''); } - test_OK_twoUsages() { - indexTestUnit(''' + test_OK_twoUsages() async { + await indexTestUnit(''' main() { int test = 1 + 2; print(test); diff --git a/pkg/analysis_server/test/services/refactoring/inline_method_test.dart b/pkg/analysis_server/test/services/refactoring/inline_method_test.dart index bf8f4817565..ee14c780241 100644 --- a/pkg/analysis_server/test/services/refactoring/inline_method_test.dart +++ b/pkg/analysis_server/test/services/refactoring/inline_method_test.dart @@ -29,7 +29,7 @@ class InlineMethodTest extends RefactoringTest { bool inlineAll; test_access_FunctionElement() async { - indexTestUnit(r''' + await indexTestUnit(r''' test(a, b) { return a + b; } @@ -47,7 +47,7 @@ main() { } test_access_MethodElement() async { - indexTestUnit(r''' + await indexTestUnit(r''' class A { test(a, b) { return a + b; @@ -66,8 +66,8 @@ class A { expect(refactoring.isDeclaration, isTrue); } - test_bad_async_intoSyncStar() { - indexTestUnit(r''' + test_bad_async_intoSyncStar() async { + await indexTestUnit(r''' import 'dart:async'; class A { Future get test async => 42; @@ -81,8 +81,8 @@ class A { return _assertConditionsFatal('Cannot inline async into sync*.'); } - test_bad_async_targetIsSync_doesNotReturnFuture() { - indexTestUnit(r''' + test_bad_async_targetIsSync_doesNotReturnFuture() async { + await indexTestUnit(r''' import 'dart:async'; class A { Future get test async => 42; @@ -98,8 +98,8 @@ class A { 'Cannot inline async into a function that does not return a Future.'); } - test_bad_asyncStar() { - indexTestUnit(r''' + test_bad_asyncStar() async { + await indexTestUnit(r''' import 'dart:async'; class A { Stream test() async* { @@ -117,7 +117,7 @@ class A { } test_bad_cascadeInvocation() async { - indexTestUnit(r''' + await indexTestUnit(r''' class A { foo() {} bar() {} @@ -137,8 +137,8 @@ main() { expectedContextRange: location); } - test_bad_constructor() { - indexTestUnit(r''' + test_bad_constructor() async { + await indexTestUnit(r''' class A { A.named() {} } @@ -149,7 +149,7 @@ class A { } test_bad_deleteSource_inlineOne() async { - indexTestUnit(r''' + await indexTestUnit(r''' test(a, b) { return a + b; } @@ -171,8 +171,8 @@ main() { 'All references must be inlined to remove the source.'); } - test_bad_notExecutableElement() { - indexTestUnit(r''' + test_bad_notExecutableElement() async { + await indexTestUnit(r''' main() { } '''); @@ -181,8 +181,8 @@ main() { return _assertInvalidSelection(); } - test_bad_notSimpleIdentifier() { - indexTestUnit(r''' + test_bad_notSimpleIdentifier() async { + await indexTestUnit(r''' main() { var test = 42; var res = test; @@ -193,8 +193,8 @@ main() { return _assertInvalidSelection(); } - test_bad_operator() { - indexTestUnit(r''' + test_bad_operator() async { + await indexTestUnit(r''' class A { operator -(other) => this; } @@ -204,8 +204,8 @@ class A { return _assertConditionsFatal('Cannot inline operator.'); } - test_bad_propertyAccessor_synthetic() { - indexTestUnit(r''' + test_bad_propertyAccessor_synthetic() async { + await indexTestUnit(r''' class A { int fff; } @@ -219,8 +219,8 @@ main(A a) { return _assertInvalidSelection(); } - test_bad_reference_toClassMethod() { - indexTestUnit(r''' + test_bad_reference_toClassMethod() async { + await indexTestUnit(r''' class A { test(a, b) { print(a); @@ -236,8 +236,8 @@ main() { return _assertConditionsFatal('Cannot inline class method reference.'); } - test_bad_severalReturns() { - indexTestUnit(r''' + test_bad_severalReturns() async { + await indexTestUnit(r''' test() { if (true) { return 1; @@ -253,8 +253,8 @@ main() { return _assertConditionsError('Ambiguous return value.'); } - test_fieldAccessor_getter() { - indexTestUnit(r''' + test_fieldAccessor_getter() async { + await indexTestUnit(r''' class A { var f; get foo { @@ -279,8 +279,8 @@ main() { '''); } - test_fieldAccessor_getter_PropertyAccess() { - indexTestUnit(r''' + test_fieldAccessor_getter_PropertyAccess() async { + await indexTestUnit(r''' class A { var f; get foo { @@ -311,8 +311,8 @@ main() { '''); } - test_fieldAccessor_setter() { - indexTestUnit(r''' + test_fieldAccessor_setter() async { + await indexTestUnit(r''' class A { var f; set foo(x) { @@ -337,8 +337,8 @@ main() { '''); } - test_fieldAccessor_setter_PropertyAccess() { - indexTestUnit(r''' + test_fieldAccessor_setter_PropertyAccess() async { + await indexTestUnit(r''' class A { var f; set foo(x) { @@ -369,8 +369,8 @@ main() { '''); } - test_function_expressionFunctionBody() { - indexTestUnit(r''' + test_function_expressionFunctionBody() async { + await indexTestUnit(r''' test(a, b) => a + b; main() { print(test(1, 2)); @@ -385,8 +385,8 @@ main() { '''); } - test_function_hasReturn_assign() { - indexTestUnit(r''' + test_function_hasReturn_assign() async { + await indexTestUnit(r''' test(a, b) { print(a); print(b); @@ -409,8 +409,8 @@ main() { '''); } - test_function_hasReturn_hasReturnType() { - indexTestUnit(r''' + test_function_hasReturn_hasReturnType() async { + await indexTestUnit(r''' int test(a, b) { return a + b; } @@ -427,8 +427,8 @@ main() { '''); } - test_function_hasReturn_noVars_oneUsage() { - indexTestUnit(r''' + test_function_hasReturn_noVars_oneUsage() async { + await indexTestUnit(r''' test(a, b) { print(a); print(b); @@ -449,8 +449,8 @@ main() { '''); } - test_function_multilineString() { - indexTestUnit(r""" + test_function_multilineString() async { + await indexTestUnit(r""" main() { { test(); @@ -477,8 +477,8 @@ second line """); } - test_function_noReturn_hasVars_hasConflict_fieldSuperClass() { - indexTestUnit(r''' + test_function_noReturn_hasVars_hasConflict_fieldSuperClass() async { + await indexTestUnit(r''' class A { var c; } @@ -507,8 +507,8 @@ class B extends A { '''); } - test_function_noReturn_hasVars_hasConflict_fieldThisClass() { - indexTestUnit(r''' + test_function_noReturn_hasVars_hasConflict_fieldThisClass() async { + await indexTestUnit(r''' class A { var c; foo() { @@ -533,8 +533,8 @@ class A { '''); } - test_function_noReturn_hasVars_hasConflict_localAfter() { - indexTestUnit(r''' + test_function_noReturn_hasVars_hasConflict_localAfter() async { + await indexTestUnit(r''' test(a, b) { var c = a + b; print(c); @@ -555,8 +555,8 @@ main() { '''); } - test_function_noReturn_hasVars_hasConflict_localBefore() { - indexTestUnit(r''' + test_function_noReturn_hasVars_hasConflict_localBefore() async { + await indexTestUnit(r''' test(a, b) { var c = a + b; print(c); @@ -577,8 +577,8 @@ main() { '''); } - test_function_noReturn_hasVars_noConflict() { - indexTestUnit(r''' + test_function_noReturn_hasVars_noConflict() async { + await indexTestUnit(r''' test(a, b) { var c = a + b; print(c); @@ -597,8 +597,8 @@ main() { '''); } - test_function_noReturn_noVars_oneUsage() { - indexTestUnit(r''' + test_function_noReturn_noVars_oneUsage() async { + await indexTestUnit(r''' test(a, b) { print(a); print(b); @@ -617,8 +617,8 @@ main() { '''); } - test_function_noReturn_noVars_useIndentation() { - indexTestUnit(r''' + test_function_noReturn_noVars_useIndentation() async { + await indexTestUnit(r''' test(a, b) { print(a); print(b); @@ -641,8 +641,8 @@ main() { '''); } - test_function_noReturn_voidReturnType() { - indexTestUnit(r''' + test_function_noReturn_voidReturnType() async { + await indexTestUnit(r''' void test(a, b) { print(a + b); } @@ -659,8 +659,8 @@ main() { '''); } - test_function_notStatement_oneStatement_assign() { - indexTestUnit(r''' + test_function_notStatement_oneStatement_assign() async { + await indexTestUnit(r''' test(int p) { print(p * 2); } @@ -681,8 +681,8 @@ main() { '''); } - test_function_notStatement_oneStatement_variableDeclaration() { - indexTestUnit(r''' + test_function_notStatement_oneStatement_variableDeclaration() async { + await indexTestUnit(r''' test(int p) { print(p * 2); } @@ -701,8 +701,8 @@ main() { '''); } - test_function_notStatement_severalStatements() { - indexTestUnit(r''' + test_function_notStatement_severalStatements() async { + await indexTestUnit(r''' test(int p) { print(p); print(p * 2); @@ -723,8 +723,8 @@ main() { '''); } - test_function_notStatement_zeroStatements() { - indexTestUnit(r''' + test_function_notStatement_zeroStatements() async { + await indexTestUnit(r''' test(int p) { } main() { @@ -741,8 +741,8 @@ main() { '''); } - test_function_singleStatement() { - indexTestUnit(r''' + test_function_singleStatement() async { + await indexTestUnit(r''' var topLevelField = 0; test() { print(topLevelField); @@ -761,8 +761,8 @@ main() { '''); } - test_getter_async_targetIsAsync() { - indexTestUnit(r''' + test_getter_async_targetIsAsync() async { + await indexTestUnit(r''' import 'dart:async'; class A { Future get test async => 42; @@ -783,8 +783,8 @@ class A { '''); } - test_getter_async_targetIsAsyncStar() { - indexTestUnit(r''' + test_getter_async_targetIsAsyncStar() async { + await indexTestUnit(r''' import 'dart:async'; class A { Future get test async => 42; @@ -805,8 +805,8 @@ class A { '''); } - test_getter_async_targetIsSync() { - indexTestUnit(r''' + test_getter_async_targetIsSync() async { + await indexTestUnit(r''' import 'dart:async'; class A { Future get test async => 42; @@ -827,8 +827,8 @@ class A { '''); } - test_getter_async_targetIsSync2() { - indexTestUnit(r''' + test_getter_async_targetIsSync2() async { + await indexTestUnit(r''' import 'dart:async'; class A { Future get test async => 42; @@ -855,8 +855,8 @@ class A { '''); } - test_getter_classMember_instance() { - indexTestUnit(r''' + test_getter_classMember_instance() async { + await indexTestUnit(r''' class A { int f; int get result => f + 1; @@ -877,8 +877,8 @@ main(A a) { '''); } - test_getter_classMember_static() { - indexTestUnit(r''' + test_getter_classMember_static() async { + await indexTestUnit(r''' class A { static int get result => 1 + 2; } @@ -897,8 +897,8 @@ main() { '''); } - test_getter_topLevel() { - indexTestUnit(r''' + test_getter_topLevel() async { + await indexTestUnit(r''' String get message => 'Hello, World!'; main() { print(message); @@ -914,7 +914,7 @@ main() { } test_initialMode_all() async { - indexTestUnit(r''' + await indexTestUnit(r''' test(a, b) { return a + b; } @@ -930,7 +930,7 @@ main() { } test_initialMode_single() async { - indexTestUnit(r''' + await indexTestUnit(r''' test(a, b) { return a + b; } @@ -947,8 +947,8 @@ main() { expect(refactoring.inlineAll, false); } - test_method_async() { - indexTestUnit(r''' + test_method_async() async { + await indexTestUnit(r''' import 'dart:async'; class A { Future test() async => 42; @@ -969,8 +969,8 @@ class A { '''); } - test_method_async2() { - indexTestUnit(r''' + test_method_async2() async { + await indexTestUnit(r''' import 'dart:async'; class A { Future test() async => 42; @@ -991,8 +991,8 @@ class A { '''); } - test_method_emptyBody() { - indexTestUnit(r''' + test_method_emptyBody() async { + await indexTestUnit(r''' abstract class A { test(); } @@ -1005,8 +1005,8 @@ main(A a) { return _assertConditionsFatal('Cannot inline method without body.'); } - test_method_fieldInstance() { - indexTestUnit(r''' + test_method_fieldInstance() async { + await indexTestUnit(r''' class A { var fA; } @@ -1043,8 +1043,8 @@ main() { '''); } - test_method_fieldStatic() { - indexTestUnit(r''' + test_method_fieldStatic() async { + await indexTestUnit(r''' class A { static var FA = 1; } @@ -1081,8 +1081,8 @@ main() { '''); } - test_method_fieldStatic_sameClass() { - indexTestUnit(r''' + test_method_fieldStatic_sameClass() async { + await indexTestUnit(r''' class A { static var F = 1; foo() { @@ -1105,8 +1105,8 @@ class A { '''); } - test_method_methodInstance() { - indexTestUnit(r''' + test_method_methodInstance() async { + await indexTestUnit(r''' class A { ma() {} } @@ -1141,8 +1141,8 @@ main(B b) { '''); } - test_method_methodStatic() { - indexTestUnit(r''' + test_method_methodStatic() async { + await indexTestUnit(r''' class A { static ma() {} } @@ -1180,8 +1180,8 @@ main(B b) { '''); } - test_method_singleStatement() { - indexTestUnit(r''' + test_method_singleStatement() async { + await indexTestUnit(r''' class A { test() { print(0); @@ -1202,8 +1202,8 @@ class A { '''); } - test_method_this() { - indexTestUnit(r''' + test_method_this() async { + await indexTestUnit(r''' class A { accept(B b) {} } @@ -1236,8 +1236,8 @@ main() { '''); } - test_method_unqualifiedInvocation() { - indexTestUnit(r''' + test_method_unqualifiedInvocation() async { + await indexTestUnit(r''' class A { test(a, b) { print(a); @@ -1262,8 +1262,8 @@ class A { '''); } - test_namedArgument_inBody() { - indexTestUnit(r''' + test_namedArgument_inBody() async { + await indexTestUnit(r''' fa(pa) => fb(pb: true); fb({pb: false}) {} main() { @@ -1281,8 +1281,8 @@ main() { '''); } - test_namedArguments() { - indexTestUnit(r''' + test_namedArguments() async { + await indexTestUnit(r''' test({a: 0, b: 2}) { print(a + b); } @@ -1301,9 +1301,9 @@ main() { '''); } - test_noArgument_named_hasDefault() { + test_noArgument_named_hasDefault() async { verifyNoTestUnitErrors = false; - indexTestUnit(r''' + await indexTestUnit(r''' test({a: 42}) { print(a); } @@ -1320,9 +1320,9 @@ main() { '''); } - test_noArgument_positional_hasDefault() { + test_noArgument_positional_hasDefault() async { verifyNoTestUnitErrors = false; - indexTestUnit(r''' + await indexTestUnit(r''' test([a = 42]) { print(a); } @@ -1339,9 +1339,9 @@ main() { '''); } - test_noArgument_positional_noDefault() { + test_noArgument_positional_noDefault() async { verifyNoTestUnitErrors = false; - indexTestUnit(r''' + await indexTestUnit(r''' test([a]) { print(a); } @@ -1360,7 +1360,7 @@ main() { test_noArgument_required() async { verifyNoTestUnitErrors = false; - indexTestUnit(r''' + await indexTestUnit(r''' test(a) { print(a); } @@ -1377,8 +1377,8 @@ main() { expectedContextRange: location); } - test_reference_expressionBody() { - indexTestUnit(r''' + test_reference_expressionBody() async { + await indexTestUnit(r''' String message() => 'Hello, World!'; main() { print(message); @@ -1393,8 +1393,8 @@ main() { '''); } - test_reference_noStatement() { - indexTestUnit(r''' + test_reference_noStatement() async { + await indexTestUnit(r''' test(a, b) { return a || b; } @@ -1417,8 +1417,8 @@ baz(x) {} '''); } - test_reference_toLocal() { - indexTestUnit(r''' + test_reference_toLocal() async { + await indexTestUnit(r''' main() { test(a, b) { print(a); @@ -1439,8 +1439,8 @@ main() { '''); } - test_reference_toTopLevel() { - indexTestUnit(r''' + test_reference_toTopLevel() async { + await indexTestUnit(r''' test(a, b) { print(a); print(b); @@ -1461,8 +1461,8 @@ main() { '''); } - test_removeEmptyLinesBefore_method() { - indexTestUnit(r''' + test_removeEmptyLinesBefore_method() async { + await indexTestUnit(r''' class A { before() { } @@ -1491,8 +1491,8 @@ class A { '''); } - test_setter_classMember_instance() { - indexTestUnit(r''' + test_setter_classMember_instance() async { + await indexTestUnit(r''' class A { int f; void set result(x) { @@ -1515,8 +1515,8 @@ main(A a) { '''); } - test_setter_topLevel() { - indexTestUnit(r''' + test_setter_topLevel() async { + await indexTestUnit(r''' void set result(x) { print(x + 1); } @@ -1533,8 +1533,8 @@ main() { '''); } - test_singleExpression_oneUsage() { - indexTestUnit(r''' + test_singleExpression_oneUsage() async { + await indexTestUnit(r''' test(a, b) { return a + b; } @@ -1551,8 +1551,8 @@ main() { '''); } - test_singleExpression_oneUsage_keepMethod() { - indexTestUnit(r''' + test_singleExpression_oneUsage_keepMethod() async { + await indexTestUnit(r''' test(a, b) { return a + b; } @@ -1573,8 +1573,8 @@ main() { '''); } - test_singleExpression_twoUsages() { - indexTestUnit(r''' + test_singleExpression_twoUsages() async { + await indexTestUnit(r''' test(a, b) { return a + b; } @@ -1593,8 +1593,8 @@ main() { '''); } - test_singleExpression_twoUsages_inlineOne() { - indexTestUnit(r''' + test_singleExpression_twoUsages_inlineOne() async { + await indexTestUnit(r''' test(a, b) { return a + b; } @@ -1616,8 +1616,8 @@ main() { '''); } - test_singleExpression_wrapIntoParenthesized_alreadyInMethod() { - indexTestUnit(r''' + test_singleExpression_wrapIntoParenthesized_alreadyInMethod() async { + await indexTestUnit(r''' test(a, b) { return a * (b); } @@ -1634,8 +1634,8 @@ main() { '''); } - test_singleExpression_wrapIntoParenthesized_asNeeded() { - indexTestUnit(r''' + test_singleExpression_wrapIntoParenthesized_asNeeded() async { + await indexTestUnit(r''' test(a, b) { return a * b; } @@ -1654,8 +1654,8 @@ main() { '''); } - test_singleExpression_wrapIntoParenthesized_bool() { - indexTestUnit(r''' + test_singleExpression_wrapIntoParenthesized_bool() async { + await indexTestUnit(r''' test(bool a, bool b) { return a || b; } diff --git a/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart b/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart index e65a6e0c5dd..6c1b2bfd759 100644 --- a/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart +++ b/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart @@ -21,7 +21,7 @@ main() { @reflectiveTest class RenameClassMemberTest extends RenameRefactoringTest { test_checkFinalConditions_classNameConflict_sameClass() async { - indexTestUnit(''' + await indexTestUnit(''' class NewName { void test() {} } @@ -37,7 +37,7 @@ class NewName { } test_checkFinalConditions_classNameConflict_subClass() async { - indexTestUnit(''' + await indexTestUnit(''' class A { void test() {} // 1 } @@ -56,7 +56,7 @@ class NewName extends A { } test_checkFinalConditions_classNameConflict_superClass() async { - indexTestUnit(''' + await indexTestUnit(''' class NewName { void test() {} // 1 } @@ -75,7 +75,7 @@ class B extends NewName { } test_checkFinalConditions_hasMember_MethodElement() async { - indexTestUnit(''' + await indexTestUnit(''' class A { test() {} newName() {} // existing @@ -92,7 +92,7 @@ class A { } test_checkFinalConditions_OK_dropSuffix() async { - indexTestUnit(r''' + await indexTestUnit(r''' abstract class A { void testOld(); } @@ -108,7 +108,7 @@ class B implements A { } test_checkFinalConditions_OK_noShadow() async { - indexTestUnit(''' + await indexTestUnit(''' class A { int newName; } @@ -129,12 +129,12 @@ class C extends A { } test_checkFinalConditions_publicToPrivate_usedInOtherLibrary() async { - indexTestUnit(''' + await indexTestUnit(''' class A { test() {} } '''); - indexUnit( + await indexUnit( '/lib.dart', ''' library my.lib; @@ -153,7 +153,7 @@ main(A a) { } test_checkFinalConditions_shadowed_byLocalFunction_inSameClass() async { - indexTestUnit(''' + await indexTestUnit(''' class A { test() {} main() { @@ -173,7 +173,7 @@ class A { } test_checkFinalConditions_shadowed_byLocalVariable_inSameClass() async { - indexTestUnit(''' + await indexTestUnit(''' class A { test() {} main() { @@ -193,7 +193,7 @@ class A { } test_checkFinalConditions_shadowed_byLocalVariable_inSubClass() async { - indexTestUnit(''' + await indexTestUnit(''' class A { test() {} } @@ -215,7 +215,7 @@ class B extends A { } test_checkFinalConditions_shadowed_byLocalVariable_OK_qualifiedReference() async { - indexTestUnit(''' + await indexTestUnit(''' class A { test() {} main() { @@ -232,7 +232,7 @@ class A { } test_checkFinalConditions_shadowed_byLocalVariable_OK_renamedNotUsed() async { - indexTestUnit(''' + await indexTestUnit(''' class A { test() {} main() { @@ -248,7 +248,7 @@ class A { } test_checkFinalConditions_shadowed_byParameter_inSameClass() async { - indexTestUnit(''' + await indexTestUnit(''' class A { test() {} main(newName) { @@ -267,7 +267,7 @@ class A { } test_checkFinalConditions_shadowedBySub_MethodElement() async { - indexTestUnit(''' + await indexTestUnit(''' class A { test() {} } @@ -289,7 +289,7 @@ class B extends A { } test_checkFinalConditions_shadowsSuper_FieldElement() async { - indexTestUnit(''' + await indexTestUnit(''' class A { int newName; // marker } @@ -312,7 +312,7 @@ class C extends B { } test_checkFinalConditions_shadowsSuper_MethodElement() async { - indexTestUnit(''' + await indexTestUnit(''' class A { newName() {} // marker } @@ -335,8 +335,8 @@ class A { newName() {} // marker } '''; - indexUnit('/lib.dart', libCode); - indexTestUnit(''' + await indexUnit('/lib.dart', libCode); + await indexTestUnit(''' import 'lib.dart'; class B extends A { test() {} @@ -353,7 +353,7 @@ class B extends A { } test_checkInitialConditions_inSDK() async { - indexTestUnit(''' + await indexTestUnit(''' main() { 'abc'.toUpperCase(); } @@ -368,7 +368,7 @@ main() { } test_checkInitialConditions_operator() async { - indexTestUnit(''' + await indexTestUnit(''' class A { operator -(other) => this; } @@ -380,8 +380,8 @@ class A { assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL); } - test_checkNewName_FieldElement() { - indexTestUnit(''' + test_checkNewName_FieldElement() async { + await indexTestUnit(''' class A { int test; } @@ -397,8 +397,8 @@ class A { assertRefactoringStatusOK(refactoring.checkNewName()); } - test_checkNewName_MethodElement() { - indexTestUnit(''' + test_checkNewName_MethodElement() async { + await indexTestUnit(''' class A { test() {} } @@ -425,8 +425,8 @@ class A { assertRefactoringStatusOK(refactoring.checkNewName()); } - test_createChange_FieldElement() { - indexTestUnit(''' + test_createChange_FieldElement() async { + await indexTestUnit(''' class A { int test; // marker main() { @@ -491,8 +491,8 @@ main() { '''); } - test_createChange_FieldElement_constructorFieldInitializer() { - indexTestUnit(''' + test_createChange_FieldElement_constructorFieldInitializer() async { + await indexTestUnit(''' class A { final test; A() : test = 5; @@ -512,8 +512,8 @@ class A { '''); } - test_createChange_FieldElement_fieldFormalParameter() { - indexTestUnit(''' + test_createChange_FieldElement_fieldFormalParameter() async { + await indexTestUnit(''' class A { final test; A(this.test); @@ -533,8 +533,8 @@ class A { '''); } - test_createChange_FieldElement_fieldFormalParameter_named() { - indexTestUnit(''' + test_createChange_FieldElement_fieldFormalParameter_named() async { + await indexTestUnit(''' class A { final test; A({this.test}); @@ -560,8 +560,8 @@ main() { '''); } - test_createChange_FieldElement_invocation() { - indexTestUnit(''' + test_createChange_FieldElement_invocation() async { + await indexTestUnit(''' typedef F(a); class A { F test; @@ -595,8 +595,8 @@ main() { '''); } - test_createChange_MethodElement() { - indexTestUnit(''' + test_createChange_MethodElement() async { + await indexTestUnit(''' class A { test() {} } @@ -664,7 +664,7 @@ main() { } test_createChange_MethodElement_potential() async { - indexTestUnit(''' + await indexTestUnit(''' class A { test() {} } @@ -695,14 +695,14 @@ main(var a) { test_createChange_MethodElement_potential_inPubCache() async { String pkgLib = '/.pub-cache/lib.dart'; - indexUnit( + await indexUnit( pkgLib, r''' processObj(p) { p.test(); } '''); - indexTestUnit(''' + await indexTestUnit(''' import '$pkgLib'; class A { test() {} @@ -731,7 +731,7 @@ main(var a) { } test_createChange_MethodElement_potential_private_otherLibrary() async { - indexUnit( + await indexUnit( '/lib.dart', ''' library lib; @@ -739,7 +739,7 @@ main(p) { p._test(); } '''); - indexTestUnit(''' + await indexTestUnit(''' class A { _test() {} } @@ -766,8 +766,8 @@ main(var a) { assertNoFileChange('/lib.dart'); } - test_createChange_PropertyAccessorElement_getter() { - indexTestUnit(''' + test_createChange_PropertyAccessorElement_getter() async { + await indexTestUnit(''' class A { get test {} // marker set test(x) {} @@ -821,8 +821,8 @@ main() { '''); } - test_createChange_PropertyAccessorElement_setter() { - indexTestUnit(''' + test_createChange_PropertyAccessorElement_setter() async { + await indexTestUnit(''' class A { get test {} set test(x) {} // marker @@ -876,8 +876,8 @@ main() { '''); } - test_createChange_TypeParameterElement() { - indexTestUnit(''' + test_createChange_TypeParameterElement() async { + await indexTestUnit(''' class A { Test field; List items; diff --git a/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart b/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart index afc7782c2e2..be2d42c1a9f 100644 --- a/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart +++ b/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart @@ -23,7 +23,7 @@ main() { @reflectiveTest class RenameConstructorTest extends RenameRefactoringTest { test_checkInitialConditions_inSDK() async { - indexTestUnit(''' + await indexTestUnit(''' main() { new String.fromCharCodes([]); } @@ -37,8 +37,8 @@ main() { "The constructor 'String.fromCharCodes' is defined in the SDK, so cannot be renamed."); } - test_checkNewName() { - indexTestUnit(''' + test_checkNewName() async { + await indexTestUnit(''' class A { A.test() {} } @@ -65,7 +65,7 @@ class A { } test_checkNewName_hasMember_constructor() async { - indexTestUnit(''' + await indexTestUnit(''' class A { A.test() {} A.newName() {} // existing @@ -82,7 +82,7 @@ class A { } test_checkNewName_hasMember_method() async { - indexTestUnit(''' + await indexTestUnit(''' class A { A.test() {} newName() {} // existing @@ -98,8 +98,8 @@ class A { expectedContextSearch: 'newName() {} // existing'); } - test_createChange_add() { - indexTestUnit(''' + test_createChange_add() async { + await indexTestUnit(''' class A { A() {} // marker } @@ -132,8 +132,8 @@ main() { '''); } - test_createChange_add_toSynthetic() { - indexTestUnit(''' + test_createChange_add_toSynthetic() async { + await indexTestUnit(''' class A { } class B extends A { @@ -165,8 +165,8 @@ main() { '''); } - test_createChange_change() { - indexTestUnit(''' + test_createChange_change() async { + await indexTestUnit(''' class A { A.test() {} // marker } @@ -199,8 +199,8 @@ main() { '''); } - test_createChange_remove() { - indexTestUnit(''' + test_createChange_remove() async { + await indexTestUnit(''' class A { A.test() {} // marker } @@ -233,7 +233,7 @@ main() { '''); } - void test_newInstance_nullElement() { + test_newInstance_nullElement() async { RenameRefactoring refactoring = new RenameRefactoring(searchEngine, null); expect(refactoring, isNull); } diff --git a/pkg/analysis_server/test/services/refactoring/rename_import_test.dart b/pkg/analysis_server/test/services/refactoring/rename_import_test.dart index f2df10babe8..af03882f6e6 100644 --- a/pkg/analysis_server/test/services/refactoring/rename_import_test.dart +++ b/pkg/analysis_server/test/services/refactoring/rename_import_test.dart @@ -19,8 +19,8 @@ main() { @reflectiveTest class RenameImportTest extends RenameRefactoringTest { - test_checkNewName() { - indexTestUnit("import 'dart:async' as test;"); + test_checkNewName() async { + await indexTestUnit("import 'dart:async' as test;"); _createRefactoring("import 'dart:"); expect(refactoring.oldName, 'test'); // null @@ -42,8 +42,8 @@ class RenameImportTest extends RenameRefactoringTest { assertRefactoringStatusOK(refactoring.checkNewName()); } - test_createChange_add() { - indexTestUnit(''' + test_createChange_add() async { + await indexTestUnit(''' import 'dart:async'; import 'dart:math' show Random, min hide max; main() { @@ -68,8 +68,8 @@ main() { '''); } - test_createChange_add_interpolationExpression_hasCurlyBrackets() { - indexTestUnit(r''' + test_createChange_add_interpolationExpression_hasCurlyBrackets() async { + await indexTestUnit(r''' import 'dart:async'; main() { Future f; @@ -90,8 +90,8 @@ main() { '''); } - test_createChange_add_interpolationExpression_noCurlyBrackets() { - indexTestUnit(r''' + test_createChange_add_interpolationExpression_noCurlyBrackets() async { + await indexTestUnit(r''' import 'dart:async'; main() { Future f; @@ -112,8 +112,8 @@ main() { '''); } - test_createChange_change_className() { - indexTestUnit(''' + test_createChange_change_className() async { + await indexTestUnit(''' import 'dart:math' as test; import 'dart:async' as test; main() { @@ -135,8 +135,8 @@ main() { '''); } - test_createChange_change_function() { - indexTestUnit(''' + test_createChange_change_function() async { + await indexTestUnit(''' import 'dart:math' as test; import 'dart:async' as test; main() { @@ -160,8 +160,8 @@ main() { '''); } - test_createChange_change_onPrefixElement() { - indexTestUnit(''' + test_createChange_change_onPrefixElement() async { + await indexTestUnit(''' import 'dart:async' as test; import 'dart:math' as test; main() { @@ -187,8 +187,8 @@ main() { '''); } - test_createChange_remove() { - indexTestUnit(''' + test_createChange_remove() async { + await indexTestUnit(''' import 'dart:math' as test; import 'dart:async' as test; main() { @@ -210,8 +210,8 @@ main() { '''); } - test_oldName_empty() { - indexTestUnit(''' + test_oldName_empty() async { + await indexTestUnit(''' import 'dart:math'; import 'dart:async'; main() { diff --git a/pkg/analysis_server/test/services/refactoring/rename_label_test.dart b/pkg/analysis_server/test/services/refactoring/rename_label_test.dart index c1e995f5a51..64345a2e2bf 100644 --- a/pkg/analysis_server/test/services/refactoring/rename_label_test.dart +++ b/pkg/analysis_server/test/services/refactoring/rename_label_test.dart @@ -18,8 +18,8 @@ main() { @reflectiveTest class RenameLabelTest extends RenameRefactoringTest { - test_checkNewName_LocalVariableElement() { - indexTestUnit(''' + test_checkNewName_LocalVariableElement() async { + await indexTestUnit(''' main() { test: while (true) { @@ -43,8 +43,8 @@ test: assertRefactoringStatusOK(refactoring.checkNewName()); } - test_createChange() { - indexTestUnit(''' + test_createChange() async { + await indexTestUnit(''' main() { test: while (true) { @@ -68,8 +68,8 @@ newName: '''); } - test_oldName() { - indexTestUnit(''' + test_oldName() async { + await indexTestUnit(''' main() { test: while (true) { diff --git a/pkg/analysis_server/test/services/refactoring/rename_library_test.dart b/pkg/analysis_server/test/services/refactoring/rename_library_test.dart index fd58cc2878a..4597089bc43 100644 --- a/pkg/analysis_server/test/services/refactoring/rename_library_test.dart +++ b/pkg/analysis_server/test/services/refactoring/rename_library_test.dart @@ -19,8 +19,8 @@ main() { @reflectiveTest class RenameLibraryTest extends RenameRefactoringTest { - void test_checkNewName() { - indexTestUnit(''' + test_checkNewName() async { + await indexTestUnit(''' library my.app; '''); _createRenameRefactoring(); @@ -48,7 +48,7 @@ library my.app; ''' part of my.app; '''); - indexTestUnit(''' + await indexTestUnit(''' library my.app; part 'part.dart'; '''); @@ -76,7 +76,7 @@ part of the.new.name; ''' part of my . app; '''); - indexTestUnit(''' + await indexTestUnit(''' library my . app; part 'part.dart'; '''); diff --git a/pkg/analysis_server/test/services/refactoring/rename_local_test.dart b/pkg/analysis_server/test/services/refactoring/rename_local_test.dart index 7cc5811ae1c..4fe584ed80c 100644 --- a/pkg/analysis_server/test/services/refactoring/rename_local_test.dart +++ b/pkg/analysis_server/test/services/refactoring/rename_local_test.dart @@ -20,7 +20,7 @@ main() { @reflectiveTest class RenameLocalTest extends RenameRefactoringTest { test_checkFinalConditions_hasLocalFunction_after() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int test = 0; newName() => 1; @@ -36,7 +36,7 @@ main() { } test_checkFinalConditions_hasLocalFunction_before() async { - indexTestUnit(''' + await indexTestUnit(''' main() { newName() => 1; int test = 0; @@ -51,7 +51,7 @@ main() { } test_checkFinalConditions_hasLocalVariable_after() async { - indexTestUnit(''' + await indexTestUnit(''' main() { int test = 0; var newName = 1; @@ -69,7 +69,7 @@ main() { } test_checkFinalConditions_hasLocalVariable_before() async { - indexTestUnit(''' + await indexTestUnit(''' main() { var newName = 1; int test = 0; @@ -84,8 +84,8 @@ main() { expectedContextSearch: 'newName = 1;'); } - test_checkFinalConditions_hasLocalVariable_otherBlock() { - indexTestUnit(''' + test_checkFinalConditions_hasLocalVariable_otherBlock() async { + await indexTestUnit(''' main() { { var newName = 1; @@ -101,8 +101,8 @@ main() { return assertRefactoringConditionsOK(); } - test_checkFinalConditions_hasLocalVariable_otherForEachLoop() { - indexTestUnit(''' + test_checkFinalConditions_hasLocalVariable_otherForEachLoop() async { + await indexTestUnit(''' main() { for (int newName in []) {} for (int test in []) {} @@ -114,8 +114,8 @@ main() { return assertRefactoringConditionsOK(); } - test_checkFinalConditions_hasLocalVariable_otherForLoop() { - indexTestUnit(''' + test_checkFinalConditions_hasLocalVariable_otherForLoop() async { + await indexTestUnit(''' main() { for (int newName = 0; newName < 10; newName++) {} for (int test = 0; test < 10; test++) {} @@ -127,8 +127,8 @@ main() { return assertRefactoringConditionsOK(); } - test_checkFinalConditions_hasLocalVariable_otherFunction() { - indexTestUnit(''' + test_checkFinalConditions_hasLocalVariable_otherFunction() async { + await indexTestUnit(''' main() { int test = 0; } @@ -143,7 +143,7 @@ main2() { } test_checkFinalConditions_shadows_classMember() async { - indexTestUnit(''' + await indexTestUnit(''' class A { var newName = 1; main() { @@ -163,7 +163,7 @@ class A { } test_checkFinalConditions_shadows_classMember_namedParameter() async { - indexTestUnit(''' + await indexTestUnit(''' class A { foo({test: 1}) { } @@ -185,8 +185,8 @@ class B extends A { expectedContextSearch: 'newName);'); } - test_checkFinalConditions_shadows_classMemberOK_qualifiedReference() { - indexTestUnit(''' + test_checkFinalConditions_shadows_classMemberOK_qualifiedReference() async { + await indexTestUnit(''' class A { var newName = 1; main() { @@ -201,8 +201,8 @@ class A { return assertRefactoringConditionsOK(); } - test_checkFinalConditions_shadows_OK_namedParameterReference() { - indexTestUnit(''' + test_checkFinalConditions_shadows_OK_namedParameterReference() async { + await indexTestUnit(''' void f({newName}) {} main() { var test = 0; @@ -216,7 +216,7 @@ main() { } test_checkFinalConditions_shadows_topLevelFunction() async { - indexTestUnit(''' + await indexTestUnit(''' newName() {} main() { var test = 0; @@ -231,8 +231,8 @@ main() { expectedContextSearch: 'newName(); // ref'); } - test_checkNewName_FunctionElement() { - indexTestUnit(''' + test_checkNewName_FunctionElement() async { + await indexTestUnit(''' main() { int test() {} } @@ -248,8 +248,8 @@ main() { assertRefactoringStatusOK(refactoring.checkNewName()); } - test_checkNewName_LocalVariableElement() { - indexTestUnit(''' + test_checkNewName_LocalVariableElement() async { + await indexTestUnit(''' main() { int test = 0; } @@ -270,8 +270,8 @@ main() { assertRefactoringStatusOK(refactoring.checkNewName()); } - test_checkNewName_ParameterElement() { - indexTestUnit(''' + test_checkNewName_ParameterElement() async { + await indexTestUnit(''' main(test) { } '''); @@ -286,8 +286,8 @@ main(test) { assertRefactoringStatusOK(refactoring.checkNewName()); } - test_createChange_localFunction() { - indexTestUnit(''' + test_createChange_localFunction() async { + await indexTestUnit(''' main() { int test() => 0; print(test); @@ -309,8 +309,8 @@ main() { '''); } - test_createChange_localFunction_sameNameDifferenceScopes() { - indexTestUnit(''' + test_createChange_localFunction_sameNameDifferenceScopes() async { + await indexTestUnit(''' main() { { int test() => 0; @@ -349,8 +349,8 @@ main() { '''); } - test_createChange_localVariable() { - indexTestUnit(''' + test_createChange_localVariable() async { + await indexTestUnit(''' main() { int test = 0; test = 1; @@ -374,8 +374,8 @@ main() { '''); } - test_createChange_localVariable_sameNameDifferenceScopes() { - indexTestUnit(''' + test_createChange_localVariable_sameNameDifferenceScopes() async { + await indexTestUnit(''' main() { { int test = 0; @@ -414,8 +414,8 @@ main() { '''); } - test_createChange_parameter() { - indexTestUnit(''' + test_createChange_parameter() async { + await indexTestUnit(''' myFunction({int test}) { test = 1; test += 2; @@ -444,12 +444,12 @@ main() { } test_createChange_parameter_named_inOtherFile() async { - indexTestUnit(''' + await indexTestUnit(''' class A { A({test}); } '''); - indexUnit( + await indexUnit( '/test2.dart', ''' import 'test.dart'; @@ -478,7 +478,7 @@ main() { } test_createChange_parameter_named_updateHierarchy() async { - indexUnit( + await indexUnit( '/test2.dart', ''' library test2; @@ -493,7 +493,7 @@ class B extends A { } } '''); - indexTestUnit(''' + await indexTestUnit(''' import 'test2.dart'; main() { new A().foo(test: 10); @@ -541,8 +541,8 @@ class B extends A { '''); } - test_oldName() { - indexTestUnit(''' + test_oldName() async { + await indexTestUnit(''' main() { int test = 0; } diff --git a/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart b/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart index 1ce560d620e..e44d99a1bbc 100644 --- a/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart +++ b/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart @@ -20,7 +20,7 @@ main() { @reflectiveTest class RenameUnitMemberTest extends RenameRefactoringTest { test_checkFinalConditions_hasTopLevel_ClassElement() async { - indexTestUnit(''' + await indexTestUnit(''' class Test {} class NewName {} // existing '''); @@ -34,7 +34,7 @@ class NewName {} // existing } test_checkFinalConditions_hasTopLevel_FunctionTypeAliasElement() async { - indexTestUnit(''' + await indexTestUnit(''' class Test {} typedef NewName(); // existing '''); @@ -49,7 +49,7 @@ typedef NewName(); // existing } test_checkFinalConditions_OK_qualifiedSuper_MethodElement() async { - indexTestUnit(''' + await indexTestUnit(''' class Test {} class A { NewName() {} @@ -68,10 +68,10 @@ class B extends A { } test_checkFinalConditions_publicToPrivate_usedInOtherLibrary() async { - indexTestUnit(''' + await indexTestUnit(''' class Test {} '''); - indexUnit( + await indexUnit( '/lib.dart', ''' library my.lib; @@ -90,7 +90,7 @@ main() { } test_checkFinalConditions_shadowedBy_MethodElement() async { - indexTestUnit(''' + await indexTestUnit(''' class Test {} class A { void NewName() {} @@ -110,10 +110,10 @@ class A { } test_checkFinalConditions_shadowsInSubClass_importedLib() async { - indexTestUnit(''' + await indexTestUnit(''' class Test {} '''); - indexUnit( + await indexUnit( '/lib.dart', ''' library my.lib; @@ -136,10 +136,10 @@ class B extends A { } test_checkFinalConditions_shadowsInSubClass_importedLib_hideCombinator() async { - indexTestUnit(''' + await indexTestUnit(''' class Test {} '''); - indexUnit( + await indexUnit( '/lib.dart', ''' library my.lib; @@ -161,7 +161,7 @@ class B extends A { } test_checkFinalConditions_shadowsInSubClass_MethodElement() async { - indexTestUnit(''' + await indexTestUnit(''' class Test {} class A { NewName() {} @@ -182,7 +182,7 @@ class B extends A { } test_checkFinalConditions_shadowsInSubClass_notImportedLib() async { - indexUnit( + await indexUnit( '/lib.dart', ''' library my.lib; @@ -195,7 +195,7 @@ class B extends A { }", } '''); - indexTestUnit(''' + await indexTestUnit(''' class Test {} '''); createRenameRefactoringAtString('Test {}'); @@ -206,7 +206,7 @@ class Test {} } test_checkFinalConditions_shadowsInSubClass_notSubClass() async { - indexTestUnit(''' + await indexTestUnit(''' class Test {} class A { NewName() {} @@ -230,7 +230,7 @@ class B { r''' class A {} '''); - indexTestUnit(''' + await indexTestUnit(''' import '/.pub-cache/lib.dart'; main() { A a; @@ -251,7 +251,7 @@ main() { r''' class A {} '''); - indexTestUnit(''' + await indexTestUnit(''' import '/Pub/Cache/lib.dart'; main() { A a; @@ -267,7 +267,7 @@ main() { } test_checkInitialConditions_inSDK() async { - indexTestUnit(''' + await indexTestUnit(''' main() { String s; } @@ -281,8 +281,8 @@ main() { "The class 'String' is defined in the SDK, so cannot be renamed."); } - test_checkNewName_ClassElement() { - indexTestUnit(''' + test_checkNewName_ClassElement() async { + await indexTestUnit(''' class Test {} '''); createRenameRefactoringAtString('Test {}'); @@ -307,8 +307,8 @@ class Test {} assertRefactoringStatusOK(refactoring.checkNewName()); } - test_checkNewName_FunctionElement() { - indexTestUnit(''' + test_checkNewName_FunctionElement() async { + await indexTestUnit(''' test() {} '''); createRenameRefactoringAtString('test() {}'); @@ -327,8 +327,8 @@ test() {} assertRefactoringStatusOK(refactoring.checkNewName()); } - test_checkNewName_FunctionTypeAliasElement() { - indexTestUnit(''' + test_checkNewName_FunctionTypeAliasElement() async { + await indexTestUnit(''' typedef Test(); '''); createRenameRefactoringAtString('Test();'); @@ -342,8 +342,8 @@ typedef Test(); assertRefactoringStatusOK(refactoring.checkNewName()); } - test_checkNewName_TopLevelVariableElement() { - indexTestUnit(''' + test_checkNewName_TopLevelVariableElement() async { + await indexTestUnit(''' var test; '''); createRenameRefactoringAtString('test;'); @@ -362,8 +362,8 @@ var test; assertRefactoringStatusOK(refactoring.checkNewName()); } - test_createChange_ClassElement() { - indexTestUnit(''' + test_createChange_ClassElement() async { + await indexTestUnit(''' class Test implements Other { Test() {} Test.named() {} @@ -400,9 +400,9 @@ main() { '''); } - test_createChange_ClassElement_invocation() { + test_createChange_ClassElement_invocation() async { verifyNoTestUnitErrors = false; - indexTestUnit(''' + await indexTestUnit(''' class Test { } main() { @@ -425,8 +425,8 @@ main() { '''); } - test_createChange_ClassElement_parameterTypeNested() { - indexTestUnit(''' + test_createChange_ClassElement_parameterTypeNested() async { + await indexTestUnit(''' class Test { } main(f(Test p)) { @@ -446,8 +446,8 @@ main(f(NewName p)) { '''); } - test_createChange_ClassElement_typeAlias() { - indexTestUnit(''' + test_createChange_ClassElement_typeAlias() async { + await indexTestUnit(''' class A {} class Test = Object with A; main(Test t) { @@ -468,8 +468,8 @@ main(NewName t) { '''); } - test_createChange_FunctionElement() { - indexTestUnit(''' + test_createChange_FunctionElement() async { + await indexTestUnit(''' test() {} foo() {} main() { @@ -497,13 +497,13 @@ main() { } test_createChange_FunctionElement_imported() async { - indexUnit( + await indexUnit( '/foo.dart', r''' test() {} foo() {} '''); - indexTestUnit(''' + await indexTestUnit(''' import 'foo.dart'; main() { print(test); @@ -534,44 +534,44 @@ foo() {} '''); } - test_createChange_PropertyAccessorElement_getter_declaration() { - return _test_createChange_PropertyAccessorElement("test {}"); + test_createChange_PropertyAccessorElement_getter_declaration() async { + await _test_createChange_PropertyAccessorElement("test {}"); } - test_createChange_PropertyAccessorElement_getter_usage() { - return _test_createChange_PropertyAccessorElement("test);"); + test_createChange_PropertyAccessorElement_getter_usage() async { + await _test_createChange_PropertyAccessorElement("test);"); } - test_createChange_PropertyAccessorElement_mix() { - return _test_createChange_PropertyAccessorElement("test += 2"); + test_createChange_PropertyAccessorElement_mix() async { + await _test_createChange_PropertyAccessorElement("test += 2"); } - test_createChange_PropertyAccessorElement_setter_declaration() { - return _test_createChange_PropertyAccessorElement("test(x) {}"); + test_createChange_PropertyAccessorElement_setter_declaration() async { + await _test_createChange_PropertyAccessorElement("test(x) {}"); } - test_createChange_PropertyAccessorElement_setter_usage() { - return _test_createChange_PropertyAccessorElement("test = 1"); + test_createChange_PropertyAccessorElement_setter_usage() async { + await _test_createChange_PropertyAccessorElement("test = 1"); } - test_createChange_TopLevelVariableElement_field() { - return _test_createChange_TopLevelVariableElement("test = 0"); + test_createChange_TopLevelVariableElement_field() async { + await _test_createChange_TopLevelVariableElement("test = 0"); } - test_createChange_TopLevelVariableElement_getter() { - return _test_createChange_TopLevelVariableElement("test);"); + test_createChange_TopLevelVariableElement_getter() async { + await _test_createChange_TopLevelVariableElement("test);"); } - test_createChange_TopLevelVariableElement_mix() { - return _test_createChange_TopLevelVariableElement("test += 2"); + test_createChange_TopLevelVariableElement_mix() async { + await _test_createChange_TopLevelVariableElement("test += 2"); } - test_createChange_TopLevelVariableElement_setter() { - return _test_createChange_TopLevelVariableElement("test = 1"); + test_createChange_TopLevelVariableElement_setter() async { + await _test_createChange_TopLevelVariableElement("test = 1"); } - _test_createChange_PropertyAccessorElement(String search) { - indexTestUnit(''' + _test_createChange_PropertyAccessorElement(String search) async { + await indexTestUnit(''' get test {} set test(x) {} main() { @@ -597,8 +597,8 @@ main() { '''); } - _test_createChange_TopLevelVariableElement(String search) { - indexTestUnit(''' + _test_createChange_TopLevelVariableElement(String search) async { + await indexTestUnit(''' int test = 0; main() { print(test); diff --git a/pkg/analysis_server/test/services/search/hierarchy_test.dart b/pkg/analysis_server/test/services/search/hierarchy_test.dart index 1762d57d74f..5e2be64f476 100644 --- a/pkg/analysis_server/test/services/search/hierarchy_test.dart +++ b/pkg/analysis_server/test/services/search/hierarchy_test.dart @@ -32,8 +32,8 @@ class HierarchyTest extends AbstractSingleUnitTest { searchEngine = new SearchEngineImpl(index); } - void test_getClassMembers() { - _indexTestUnit(''' + test_getClassMembers() async { + await _indexTestUnit(''' class A { A() {} var ma1; @@ -58,8 +58,8 @@ class B extends A { } } - Future test_getHierarchyMembers_constructors() { - _indexTestUnit(''' + test_getHierarchyMembers_constructors() async { + await _indexTestUnit(''' class A { A() {} } @@ -80,8 +80,8 @@ class B extends A { return Future.wait([futureA, futureB]); } - Future test_getHierarchyMembers_fields() { - _indexTestUnit(''' + test_getHierarchyMembers_fields() async { + await _indexTestUnit(''' class A { int foo; } @@ -118,8 +118,8 @@ class D { return Future.wait([futureA, futureB, futureC, futureD]); } - Future test_getHierarchyMembers_fields_static() async { - _indexTestUnit(''' + test_getHierarchyMembers_fields_static() async { + await _indexTestUnit(''' class A { static int foo; } @@ -153,8 +153,8 @@ class C extends B { } } - Future test_getHierarchyMembers_methods() { - _indexTestUnit(''' + test_getHierarchyMembers_methods() async { + await _indexTestUnit(''' class A { foo() {} } @@ -199,8 +199,8 @@ class E extends D { return Future.wait([futureA, futureB, futureC, futureD, futureE]); } - Future test_getHierarchyMembers_methods_static() async { - _indexTestUnit(''' + test_getHierarchyMembers_methods_static() async { + await _indexTestUnit(''' class A { static foo() {} } @@ -224,8 +224,8 @@ class B extends A { } } - Future test_getHierarchyMembers_withInterfaces() { - _indexTestUnit(''' + test_getHierarchyMembers_withInterfaces() async { + await _indexTestUnit(''' class A { foo() {} } @@ -259,8 +259,8 @@ class E { return Future.wait([futureA, futureB, futureD]); } - void test_getMembers() { - _indexTestUnit(''' + test_getMembers() async { + await _indexTestUnit(''' class A { A() {} var ma1; @@ -307,8 +307,8 @@ class B extends A { } } - void test_getSuperClasses() { - _indexTestUnit(''' + test_getSuperClasses() async { + await _indexTestUnit(''' class A {} class B extends A {} class C extends B {} @@ -361,8 +361,8 @@ class F implements A {} } } - void _indexTestUnit(String code) { - resolveTestUnit(code); + Future _indexTestUnit(String code) async { + await resolveTestUnit(code); index.indexUnit(testUnit); } } diff --git a/pkg/analysis_server/test/services/search/search_engine_test.dart b/pkg/analysis_server/test/services/search/search_engine_test.dart index 24c0a9f358b..152364dbf5a 100644 --- a/pkg/analysis_server/test/services/search/search_engine_test.dart +++ b/pkg/analysis_server/test/services/search/search_engine_test.dart @@ -75,7 +75,7 @@ class SearchEngineImplTest extends AbstractSingleUnitTest { } test_searchAllSubtypes() async { - _indexTestUnit(''' + await _indexTestUnit(''' class T {} class A extends T {} class B extends A {} @@ -90,7 +90,7 @@ class C implements B {} } test_searchMemberDeclarations() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { test() {} } @@ -114,7 +114,7 @@ class B { } test_searchMemberReferences_qualified_resolved() async { - _indexTestUnit(''' + await _indexTestUnit(''' class C { var test; } @@ -131,7 +131,7 @@ main(C c) { } test_searchMemberReferences_qualified_unresolved() async { - _indexTestUnit(''' + await _indexTestUnit(''' main(p) { print(p.test); p.test = 1; @@ -152,7 +152,7 @@ main(p) { } test_searchMemberReferences_unqualified_resolved() async { - _indexTestUnit(''' + await _indexTestUnit(''' class C { var test; main() { @@ -170,7 +170,7 @@ class C { test_searchMemberReferences_unqualified_unresolved() async { verifyNoTestUnitErrors = false; - _indexTestUnit(''' + await _indexTestUnit(''' class C { main() { print(test); @@ -193,7 +193,7 @@ class C { } test_searchReferences_ClassElement() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A {} main(A p) { A v; @@ -215,7 +215,7 @@ main(A p) { ''' part of lib; '''); - _indexTestUnit(''' + await _indexTestUnit(''' library lib; part 'my_part.dart'; '''); @@ -228,7 +228,7 @@ part 'my_part.dart'; } test_searchReferences_ConstructorElement() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { A.named() {} } @@ -245,7 +245,7 @@ main() { } test_searchReferences_ConstructorElement_synthetic() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { } main() { @@ -266,7 +266,7 @@ main() { } test_searchReferences_FieldElement() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { var field; A({this.field}); @@ -300,7 +300,7 @@ class A { } test_searchReferences_FieldElement_ofEnum() async { - _indexTestUnit(''' + await _indexTestUnit(''' enum MyEnum { A, B, C } @@ -326,7 +326,7 @@ main() { } test_searchReferences_FieldElement_synthetic() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { get field => null; set field(x) {} @@ -356,7 +356,7 @@ class A { } test_searchReferences_FunctionElement() async { - _indexTestUnit(''' + await _indexTestUnit(''' test() {} main() { test(); @@ -373,7 +373,7 @@ main() { } test_searchReferences_FunctionElement_local() async { - _indexTestUnit(''' + await _indexTestUnit(''' main() { test() {} test(); @@ -390,7 +390,7 @@ main() { } test_searchReferences_FunctionTypeAliasElement() async { - _indexTestUnit(''' + await _indexTestUnit(''' typedef Test(); main() { Test a; @@ -408,7 +408,7 @@ main() { } test_searchReferences_ImportElement_noPrefix() async { - _indexTestUnit(''' + await _indexTestUnit(''' import 'dart:math' show max, PI, Random hide min; export 'dart:math' show max, PI, Random hide min; main() { @@ -432,7 +432,7 @@ Random bar() => null; } test_searchReferences_ImportElement_withPrefix() async { - _indexTestUnit(''' + await _indexTestUnit(''' import 'dart:math' as math show max, PI, Random hide min; export 'dart:math' show max, PI, Random hide min; main() { @@ -457,7 +457,7 @@ math.Random bar() => null; } test_searchReferences_ImportElement_withPrefix_forMultipleImports() async { - _indexTestUnit(''' + await _indexTestUnit(''' import 'dart:async' as p; import 'dart:math' as p; main() { @@ -485,7 +485,7 @@ main() { } test_searchReferences_LabelElement() async { - _indexTestUnit(''' + await _indexTestUnit(''' main() { label: while (true) { @@ -510,7 +510,7 @@ label: var codeB = 'part of lib; // B'; addSource('/unitA.dart', codeA); addSource('/unitB.dart', codeB); - _indexTestUnit(''' + await _indexTestUnit(''' library lib; part 'unitA.dart'; part 'unitB.dart'; @@ -530,7 +530,7 @@ part 'unitB.dart'; } test_searchReferences_LocalVariableElement() async { - _indexTestUnit(''' + await _indexTestUnit(''' main() { var v; v = 1; @@ -551,7 +551,7 @@ main() { } test_searchReferences_LocalVariableElement_inForEachLoop() async { - _indexTestUnit(''' + await _indexTestUnit(''' main() { for (var v in []) { v = 1; @@ -573,7 +573,7 @@ main() { } test_searchReferences_MethodElement() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { m() {} main() { @@ -596,7 +596,7 @@ class A { } test_searchReferences_MethodMember() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { T m() => null; } @@ -613,7 +613,7 @@ main(A a) { } test_searchReferences_null_noUnitElement() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { m() {} } @@ -630,7 +630,7 @@ main(A a) { } test_searchReferences_ParameterElement_ofConstructor() async { - _indexTestUnit(''' + await _indexTestUnit(''' class C { var f; C({p}) : f = p + 1 { @@ -660,7 +660,7 @@ main() { } test_searchReferences_ParameterElement_ofLocalFunction() async { - _indexTestUnit(''' + await _indexTestUnit(''' main() { foo({p}) { p = 1; @@ -685,7 +685,7 @@ main() { } test_searchReferences_ParameterElement_ofMethod() async { - _indexTestUnit(''' + await _indexTestUnit(''' class C { foo({p}) { p = 1; @@ -712,7 +712,7 @@ main(C c) { } test_searchReferences_ParameterElement_ofTopLevelFunction() async { - _indexTestUnit(''' + await _indexTestUnit(''' foo({p}) { p = 1; p += 2; @@ -737,7 +737,7 @@ main() { } test_searchReferences_PrefixElement() async { - _indexTestUnit(''' + await _indexTestUnit(''' import 'dart:async' as ppp; main() { ppp.Future a; @@ -755,7 +755,7 @@ main() { } test_searchReferences_PropertyAccessorElement_getter() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { get ggg => null; main() { @@ -778,7 +778,7 @@ class A { } test_searchReferences_PropertyAccessorElement_setter() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { set s(x) {} main() { @@ -803,7 +803,7 @@ class A { library lib; var V; '''); - _indexTestUnit(''' + await _indexTestUnit(''' import 'lib.dart' show V; // imp import 'lib.dart' as pref; main() { @@ -833,7 +833,7 @@ main() { } test_searchReferences_TypeParameterElement() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A { main(T a, T b) {} } @@ -849,7 +849,7 @@ class A { } test_searchSubtypes() async { - _indexTestUnit(''' + await _indexTestUnit(''' class T {} class A extends T {} // A class B = Object with T; // B @@ -869,7 +869,7 @@ class C implements T {} // C } test_searchTopLevelDeclarations() async { - _indexTestUnit(''' + await _indexTestUnit(''' class A {} // A class B = Object with A; typedef C(); @@ -930,8 +930,8 @@ class NoMatchABCDE {} isQualified: false, isResolved: false, length: length); } - void _indexTestUnit(String code) { - resolveTestUnit(code); + Future _indexTestUnit(String code) async { + await resolveTestUnit(code); index.indexUnit(testUnit); } diff --git a/pkg/analysis_server/test/src/utilities/change_builder_dart_test.dart b/pkg/analysis_server/test/src/utilities/change_builder_dart_test.dart index 2849493cf7e..4e88aec0b98 100644 --- a/pkg/analysis_server/test/src/utilities/change_builder_dart_test.dart +++ b/pkg/analysis_server/test/src/utilities/change_builder_dart_test.dart @@ -27,9 +27,9 @@ main() { @reflectiveTest class DartChangeBuilderImplTest extends AbstractContextTest { - void test_createFileEditBuilder() { + test_createFileEditBuilder() async { Source source = addSource('/test.dart', 'library test;'); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); int timeStamp = 54; DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); DartFileEditBuilderImpl fileEditBuilder = @@ -55,9 +55,9 @@ class DartEditBuilderImplTest extends AbstractContextTest { return edits[0]; } - void test_writeClassDeclaration_interfaces() { + test_writeClassDeclaration_interfaces() async { Source source = addSource('/test.dart', 'class A {}'); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration declaration = unit.declarations[0]; DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); @@ -73,9 +73,9 @@ class DartEditBuilderImplTest extends AbstractContextTest { edit.replacement, equalsIgnoringWhitespace('class C implements A { }')); } - void test_writeClassDeclaration_isAbstract() { + test_writeClassDeclaration_isAbstract() async { Source source = addSource('/test.dart', ''); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -88,9 +88,9 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(edit.replacement, equalsIgnoringWhitespace('abstract class C { }')); } - void test_writeClassDeclaration_memberWriter() { + test_writeClassDeclaration_memberWriter() async { Source source = addSource('/test.dart', ''); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -105,9 +105,9 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(edit.replacement, equalsIgnoringWhitespace('class C { /**/ }')); } - void test_writeClassDeclaration_mixins_noSuperclass() { + test_writeClassDeclaration_mixins_noSuperclass() async { Source source = addSource('/test.dart', 'class A {}'); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration classA = unit.declarations[0]; DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); @@ -123,9 +123,9 @@ class DartEditBuilderImplTest extends AbstractContextTest { equalsIgnoringWhitespace('class C extends Object with A { }')); } - void test_writeClassDeclaration_mixins_superclass() { + test_writeClassDeclaration_mixins_superclass() async { Source source = addSource('/test.dart', 'class A {} class B {}'); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration classA = unit.declarations[0]; ClassDeclaration classB = unit.declarations[1]; @@ -145,9 +145,9 @@ class DartEditBuilderImplTest extends AbstractContextTest { equalsIgnoringWhitespace('class C extends A with B { }')); } - void test_writeClassDeclaration_nameGroupName() { + test_writeClassDeclaration_nameGroupName() async { Source source = addSource('/test.dart', ''); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -167,9 +167,9 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(group.positions, hasLength(1)); } - void test_writeClassDeclaration_superclass() { + test_writeClassDeclaration_superclass() async { Source source = addSource('/test.dart', 'class B {}'); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration declaration = unit.declarations[0]; DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); @@ -185,10 +185,10 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(edit.replacement, equalsIgnoringWhitespace('class C extends B { }')); } - void test_writeFieldDeclaration_initializerWriter() { + test_writeFieldDeclaration_initializerWriter() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -203,10 +203,10 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(edit.replacement, equalsIgnoringWhitespace('var f = e;')); } - void test_writeFieldDeclaration_isConst() { + test_writeFieldDeclaration_isConst() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -218,10 +218,10 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(edit.replacement, equalsIgnoringWhitespace('const f;')); } - void test_writeFieldDeclaration_isConst_isFinal() { + test_writeFieldDeclaration_isConst_isFinal() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -234,10 +234,10 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(edit.replacement, equalsIgnoringWhitespace('const f;')); } - void test_writeFieldDeclaration_isFinal() { + test_writeFieldDeclaration_isFinal() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -249,10 +249,10 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(edit.replacement, equalsIgnoringWhitespace('final f;')); } - void test_writeFieldDeclaration_isStatic() { + test_writeFieldDeclaration_isStatic() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -264,10 +264,10 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(edit.replacement, equalsIgnoringWhitespace('static var f;')); } - void test_writeFieldDeclaration_nameGroupName() { + test_writeFieldDeclaration_nameGroupName() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -289,10 +289,10 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(position.offset, equals(13)); } - void test_writeFieldDeclaration_type_typeGroupName() { + test_writeFieldDeclaration_type_typeGroupName() async { String content = 'class A {} class B {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration declaration = unit.declarations[0]; DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); @@ -318,10 +318,10 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(position.offset, equals(20)); } - void test_writeGetterDeclaration_bodyWriter() { + test_writeGetterDeclaration_bodyWriter() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -336,10 +336,10 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(edit.replacement, equalsIgnoringWhitespace('get g {}')); } - void test_writeGetterDeclaration_isStatic() { + test_writeGetterDeclaration_isStatic() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -352,10 +352,10 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(edit.replacement, equalsIgnoringWhitespace('static get g => null;')); } - void test_writeGetterDeclaration_nameGroupName() { + test_writeGetterDeclaration_nameGroupName() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -377,10 +377,10 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(position.offset, equals(13)); } - void test_writeGetterDeclaration_returnType() { + test_writeGetterDeclaration_returnType() async { String content = 'class A {} class B {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration classA = unit.declarations[0]; DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); @@ -405,7 +405,7 @@ class DartEditBuilderImplTest extends AbstractContextTest { expect(position.offset, equals(20)); } - void test_writeOverrideOfInheritedMember() { + test_writeOverrideOfInheritedMember() async { String content = ''' class A { A add(A a) => null; @@ -413,7 +413,7 @@ class A { class B extends A { }'''; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration declaration = unit.declarations[0]; DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); @@ -434,10 +434,10 @@ A add(A a) { }''')); } - void test_writeParameters_named() { + test_writeParameters_named() async { String content = 'f(int i, {String s}) {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); FunctionDeclaration f = unit.declarations[0]; FormalParameterList parameters = f.functionExpression.parameters; Iterable elements = parameters.parameters @@ -453,10 +453,10 @@ A add(A a) { expect(edit.replacement, equalsIgnoringWhitespace('(int i, {String s})')); } - void test_writeParameters_positional() { + test_writeParameters_positional() async { String content = 'f(int i, [String s]) {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); FunctionDeclaration f = unit.declarations[0]; FormalParameterList parameters = f.functionExpression.parameters; Iterable elements = parameters.parameters @@ -472,10 +472,10 @@ A add(A a) { expect(edit.replacement, equalsIgnoringWhitespace('(int i, [String s])')); } - void test_writeParameters_required() { + test_writeParameters_required() async { String content = 'f(int i, String s) {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); FunctionDeclaration f = unit.declarations[0]; FormalParameterList parameters = f.functionExpression.parameters; Iterable elements = parameters.parameters @@ -491,13 +491,13 @@ A add(A a) { expect(edit.replacement, equalsIgnoringWhitespace('(int i, String s)')); } - void test_writeParametersMatchingArguments_named() { + test_writeParametersMatchingArguments_named() async { String content = ''' f(int i, String s) { g(s, index: i); }'''; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); FunctionDeclaration f = unit.declarations[0]; BlockFunctionBody body = f.functionExpression.body; ExpressionStatement statement = body.block.statements[0]; @@ -515,13 +515,13 @@ f(int i, String s) { edit.replacement, equalsIgnoringWhitespace('(String s, [int index])')); } - void test_writeParametersMatchingArguments_required() { + test_writeParametersMatchingArguments_required() async { String content = ''' f(int i, String s) { g(s, i); }'''; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); FunctionDeclaration f = unit.declarations[0]; BlockFunctionBody body = f.functionExpression.body; ExpressionStatement statement = body.block.statements[0]; @@ -538,10 +538,10 @@ f(int i, String s) { expect(edit.replacement, equalsIgnoringWhitespace('(String s, int i)')); } - void test_writeParameterSource() { + test_writeParameterSource() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration classA = unit.declarations[0]; DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); @@ -555,10 +555,10 @@ f(int i, String s) { expect(edit.replacement, equalsIgnoringWhitespace('A a')); } - void test_writeType_dymanic() { + test_writeType_dynamic() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -574,10 +574,10 @@ f(int i, String s) { expect(edit.replacement, equalsIgnoringWhitespace('')); } - void test_writeType_genericType() { + test_writeType_genericType() async { String content = 'class A {} class B {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration classA = unit.declarations[0]; ClassDeclaration classB = unit.declarations[1]; @@ -596,10 +596,10 @@ f(int i, String s) { expect(edit.replacement, equalsIgnoringWhitespace('B')); } - void test_writeType_groupName() { + test_writeType_groupName() async { String content = 'class A {} class B extends A {} class C extends B {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration classC = unit.declarations[2]; DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); @@ -620,10 +620,10 @@ f(int i, String s) { expect(group, isNotNull); } - void test_writeType_groupName_addSupertypeProposals() { + test_writeType_groupName_addSupertypeProposals() async { String content = 'class A {} class B extends A {} class C extends B {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration classC = unit.declarations[2]; DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); @@ -655,10 +655,10 @@ f(int i, String s) { expect(values, contains('C')); } - void test_writeType_null() { + test_writeType_null() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -670,10 +670,10 @@ f(int i, String s) { expect(edit.replacement, equalsIgnoringWhitespace('')); } - void test_writeType_required_dymanic() { + test_writeType_required_dynamic() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -691,10 +691,10 @@ f(int i, String s) { expect(edit.replacement, equalsIgnoringWhitespace('var')); } - void test_writeType_required_notNull() { + test_writeType_required_notNull() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration classA = unit.declarations[0]; DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); @@ -709,10 +709,10 @@ f(int i, String s) { expect(edit.replacement, equalsIgnoringWhitespace('A')); } - void test_writeType_required_null() { + test_writeType_required_null() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -724,10 +724,10 @@ f(int i, String s) { expect(edit.replacement, equalsIgnoringWhitespace('var')); } - void test_writeType_simpleType() { + test_writeType_simpleType() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration classA = unit.declarations[0]; DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); @@ -741,10 +741,10 @@ f(int i, String s) { expect(edit.replacement, equalsIgnoringWhitespace('A')); } - void test_writeTypes_empty() { + test_writeTypes_empty() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -756,10 +756,10 @@ f(int i, String s) { expect(edit.replacement, isEmpty); } - void test_writeTypes_noPrefix() { + test_writeTypes_noPrefix() async { String content = 'class A {} class B {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration classA = unit.declarations[0]; ClassDeclaration classB = unit.declarations[1]; @@ -776,10 +776,10 @@ f(int i, String s) { expect(edit.replacement, equalsIgnoringWhitespace('A, B')); } - void test_writeTypes_null() { + test_writeTypes_null() async { String content = 'class A {}'; Source source = addSource('/test.dart', content); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, 1, (FileEditBuilder builder) { @@ -791,10 +791,10 @@ f(int i, String s) { expect(edit.replacement, isEmpty); } - void test_writeTypes_prefix() { + test_writeTypes_prefix() async { String content = 'class A {} class B {}'; Source source = addSource('/test.dart', content); - CompilationUnit unit = resolveLibraryUnit(source); + CompilationUnit unit = await resolveLibraryUnit(source); ClassDeclaration classA = unit.declarations[0]; ClassDeclaration classB = unit.declarations[1]; @@ -814,9 +814,9 @@ f(int i, String s) { @reflectiveTest class DartFileEditBuilderImplTest extends AbstractContextTest { - void test_createEditBuilder() { + test_createEditBuilder() async { Source source = addSource('/test.dart', 'library test;'); - resolveLibraryUnit(source); + await resolveLibraryUnit(source); int timeStamp = 65; DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context); builder.addFileEdit(source, timeStamp, (FileEditBuilder builder) {