Stop using main in test code in more places, part 4
This is the last set of changes in the analysis_server package.
Change-Id: I0cffd41118ba985fc1d90cc3ae25447abb62a212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243934
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analysis_server/test/integration/analysis/get_imported_elements_test.dart b/pkg/analysis_server/test/integration/analysis/get_imported_elements_test.dart
index 547b6d9..c53a0f4 100644
--- a/pkg/analysis_server/test/integration/analysis/get_imported_elements_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_imported_elements_test.dart
@@ -92,36 +92,33 @@
Future<void> test_getImportedElements_none() async {
text = r'''
-main() {}
+void f() {}
''';
writeFile(pathname, text);
standardAnalysisSetup();
await analysisFinished;
- await checkNoElements('main() {}');
+ await checkNoElements('f() {}');
}
Future<void> test_getImportedElements_some() async {
- var selection = r'''
-main() {
+ text = '''
+import 'dart:math';
+
+void f() {
Random r = new Random();
String s = r.nextBool().toString();
print(s);
}
''';
- text = '''
-import 'dart:math';
-
-$selection
-''';
writeFile(pathname, text);
standardAnalysisSetup();
await analysisFinished;
if (disableManageImportsOnPaste) {
- await checkElements(selection, []);
+ await checkElements('f()', []);
} else {
- await checkElements(selection, [
+ await checkElements('f()', [
ImportedElements(
path.join('lib', 'core', 'core.dart'), '', ['String', 'print']),
ImportedElements(path.join('lib', 'math', 'math.dart'), '', ['Random'])
diff --git a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
index 57dca5f..e764ec3 100644
--- a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
@@ -41,7 +41,7 @@
int fff;
A({this.fff});
}
-main() {
+void f() {
new A(^);
}
''';
@@ -66,7 +66,7 @@
int fff;
A({this.fff});
}
-main() {
+void f() {
new A(^);
}
''');
@@ -297,7 +297,7 @@
addTestSource('''
import 'package:flutter/material.dart';
-main() {
+void f() {
foo(^);
}
diff --git a/pkg/analysis_server/test/services/completion/dart/closure_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/closure_contributor_test.dart
index 21a2ef7..b8d5247 100644
--- a/pkg/analysis_server/test/services/completion/dart/closure_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/closure_contributor_test.dart
@@ -30,7 +30,7 @@
addTestSource(r'''
void f({void Function(int a, String b) closure}) {}
-void main() {
+void g() {
f(closure: ^);
}
''');
@@ -54,7 +54,7 @@
addTestSource(r'''
void f({void Function(int a, String b) closure}) {}
-void main() {
+void g() {
f(
closure: ^,
);
@@ -80,7 +80,7 @@
addTestSource(r'''
void f(void Function(int a, int b) closure) {}
-void main() {
+void g() {
f(^);
}
''');
@@ -96,7 +96,7 @@
addTestSource(r'''
void f(void Function(int a, int b) closure) {}
-void main() {
+void g() {
f(^,);
}
''');
@@ -112,7 +112,7 @@
addTestSource(r'''
void f({void Function(int a, {int b, int c}) closure}) {}
-void main() {
+void g() {
f(closure: ^);
}
''');
@@ -128,7 +128,7 @@
addTestSource(r'''
void f({void Function(int a, [int b, int c]) closure]) {}
-void main() {
+void g() {
f(closure: ^);
}
''');
diff --git a/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart b/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart
index 13a48fe..fb80d3e 100644
--- a/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart
@@ -45,7 +45,7 @@
import "a.dart" as foo;
part 'test.dart';
''');
- addTestSource('part of libB; main() {^}');
+ addTestSource('part of libB; void f() {^}');
await resolveFile('$testPackageLibPath/b.dart');
diff --git a/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
index 18e5b11..0d839ec 100644
--- a/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
@@ -493,13 +493,13 @@
}
Future<void> test_anonymous_function_async() async {
- addTestSource('main() {foo(() ^ {}}}');
+ addTestSource('void f() {foo(() ^ {}}}');
await computeSuggestions();
assertSuggestKeywords([], pseudoKeywords: ['async', 'async*', 'sync*']);
}
Future<void> test_anonymous_function_async2() async {
- addTestSource('main() {foo(() a^ {}}}');
+ addTestSource('void f() {foo(() a^ {}}}');
await computeSuggestions();
// Fasta adds a closing paren after the first `}`
// and reports a single function expression argument
@@ -509,44 +509,44 @@
}
Future<void> test_anonymous_function_async3() async {
- addTestSource('main() {foo(() async ^ {}}}');
+ addTestSource('void f() {foo(() async ^ {}}}');
await computeSuggestions();
assertSuggestKeywords([]);
}
Future<void> test_anonymous_function_async4() async {
- addTestSource('main() {foo(() ^ => 2}}');
+ addTestSource('void f() {foo(() ^ => 2}}');
await computeSuggestions();
assertSuggestKeywords([], pseudoKeywords: ['async']);
}
Future<void> test_anonymous_function_async5() async {
- addTestSource('main() {foo(() ^}}');
+ addTestSource('void f() {foo(() ^}}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE,
pseudoKeywords: ['async', 'async*', 'sync*']);
}
Future<void> test_anonymous_function_async6() async {
- addTestSource('main() {foo("bar", () as^{}}');
+ addTestSource('void f() {foo("bar", () as^{}}');
await computeSuggestions();
assertSuggestKeywords([], pseudoKeywords: ['async', 'async*', 'sync*']);
}
Future<void> test_anonymous_function_async7() async {
- addTestSource('main() {foo("bar", () as^ => null');
+ addTestSource('void f() {foo("bar", () as^ => null');
await computeSuggestions();
assertSuggestKeywords([], pseudoKeywords: ['async']);
}
Future<void> test_anonymous_function_async8() async {
- addTestSource('main() {foo(() ^ {})}}');
+ addTestSource('void f() {foo(() ^ {})}}');
await computeSuggestions();
assertSuggestKeywords([], pseudoKeywords: ['async', 'async*', 'sync*']);
}
Future<void> test_anonymous_function_async9() async {
- addTestSource('main() {foo(() a^ {})}}');
+ addTestSource('void f() {foo(() a^ {})}}');
await computeSuggestions();
// Fasta interprets the argument as a function expression
// while analyzer adds synthetic `;`s making `a` a statement.
@@ -554,37 +554,37 @@
}
Future<void> test_argument() async {
- addTestSource('main() {foo(^);}');
+ addTestSource('void f() {foo(^);}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
}
Future<void> test_argument2() async {
- addTestSource('main() {foo(n^);}');
+ addTestSource('void f() {foo(n^);}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
}
Future<void> test_argument_literal() async {
- addTestSource('main() {foo("^");}');
+ addTestSource('void f() {foo("^");}');
await computeSuggestions();
assertSuggestKeywords([]);
}
Future<void> test_argument_named() async {
- addTestSource('main() {foo(bar: ^);}');
+ addTestSource('void f() {foo(bar: ^);}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
}
Future<void> test_argument_named2() async {
- addTestSource('main() {foo(bar: n^);}');
+ addTestSource('void f() {foo(bar: n^);}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
}
Future<void> test_argument_named_literal() async {
- addTestSource('main() {foo(bar: "^");}');
+ addTestSource('void f() {foo(bar: "^");}');
await computeSuggestions();
assertSuggestKeywords([]);
}
@@ -602,26 +602,26 @@
}
Future<void> test_assignment_local() async {
- addTestSource('main() {var foo = ^}');
+ addTestSource('void f() {var foo = ^}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
}
Future<void> test_assignment_local2() async {
- addTestSource('main() {var foo = n^}');
+ addTestSource('void f() {var foo = n^}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
}
Future<void> test_assignment_local2_async() async {
- addTestSource('main() async {var foo = n^}');
+ addTestSource('void f() async {var foo = n^}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE,
pseudoKeywords: ['await']);
}
Future<void> test_assignment_local_async() async {
- addTestSource('main() async {var foo = ^}');
+ addTestSource('void f() async {var foo = ^}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE,
pseudoKeywords: ['await']);
@@ -636,7 +636,7 @@
Future<void> test_catch_1a() async {
// '}' Block BlockFunctionBody FunctionExpression
- addTestSource('main() {try {} ^}');
+ addTestSource('void f() {try {} ^}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -646,7 +646,7 @@
Future<void> test_catch_1b() async {
// [ExpressionStatement 'c'] Block BlockFunctionBody FunctionExpression
- addTestSource('main() {try {} c^}');
+ addTestSource('void f() {try {} c^}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -656,7 +656,7 @@
Future<void> test_catch_1c() async {
// [EmptyStatement] Block BlockFunction FunctionExpression
- addTestSource('main() {try {} ^;}');
+ addTestSource('void f() {try {} ^;}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -666,7 +666,7 @@
Future<void> test_catch_1d() async {
// [EmptyStatement] Block BlockFunction FunctionExpression
- addTestSource('main() {try {} ^ Foo foo;}');
+ addTestSource('void f() {try {} ^ Foo foo;}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -676,7 +676,7 @@
Future<void> test_catch_2a() async {
// '}' Block BlockFunctionBody FunctionExpression
- addTestSource('main() {try {} on SomeException {} ^}');
+ addTestSource('void f() {try {} on SomeException {} ^}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -687,7 +687,7 @@
Future<void> test_catch_2b() async {
// [ExpressionStatement 'c'] Block BlockFunctionBody FunctionExpression
- addTestSource('main() {try {} on SomeException {} c^}');
+ addTestSource('void f() {try {} on SomeException {} c^}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -698,7 +698,7 @@
Future<void> test_catch_2c() async {
// [EmptyStatement] Block BlockFunction FunctionExpression
- addTestSource('main() {try {} on SomeException {} ^;}');
+ addTestSource('void f() {try {} on SomeException {} ^;}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -709,7 +709,7 @@
Future<void> test_catch_2d() async {
// [EmptyStatement] Block BlockFunction FunctionExpression
- addTestSource('main() {try {} on SomeException {} ^ Foo foo;}');
+ addTestSource('void f() {try {} on SomeException {} ^ Foo foo;}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -720,7 +720,7 @@
Future<void> test_catch_3a() async {
// '}' Block BlockFunctionBody FunctionExpression
- addTestSource('main() {try {} catch (e) {} ^}');
+ addTestSource('void f() {try {} catch (e) {} ^}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -731,7 +731,7 @@
Future<void> test_catch_3b() async {
// [ExpressionStatement 'c'] Block BlockFunctionBody FunctionExpression
- addTestSource('main() {try {} catch (e) {} c^}');
+ addTestSource('void f() {try {} catch (e) {} c^}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -742,7 +742,7 @@
Future<void> test_catch_3c() async {
// [EmptyStatement] Block BlockFunction FunctionExpression
- addTestSource('main() {try {} catch (e) {} ^;}');
+ addTestSource('void f() {try {} catch (e) {} ^;}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -753,7 +753,7 @@
Future<void> test_catch_3d() async {
// [EmptyStatement] Block BlockFunction FunctionExpression
- addTestSource('main() {try {} catch (e) {} ^ Foo foo;}');
+ addTestSource('void f() {try {} catch (e) {} ^ Foo foo;}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -764,7 +764,7 @@
Future<void> test_catch_4a1() async {
// [CatchClause] TryStatement Block
- addTestSource('main() {try {} ^ on SomeException {}}');
+ addTestSource('void f() {try {} ^ on SomeException {}}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -773,7 +773,7 @@
Future<void> test_catch_4a2() async {
// ['c' VariableDeclarationStatement] Block BlockFunctionBody
- addTestSource('main() {try {} c^ on SomeException {}}');
+ addTestSource('void f() {try {} c^ on SomeException {}}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -784,7 +784,7 @@
Future<void> test_catch_4b1() async {
// [CatchClause] TryStatement Block
- addTestSource('main() {try {} ^ catch (e) {}}');
+ addTestSource('void f() {try {} ^ catch (e) {}}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -793,7 +793,7 @@
Future<void> test_catch_4b2() async {
// ['c' ExpressionStatement] Block BlockFunctionBody
- addTestSource('main() {try {} c^ catch (e) {}}');
+ addTestSource('void f() {try {} c^ catch (e) {}}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -804,7 +804,7 @@
Future<void> test_catch_4c1() async {
// ['finally'] TryStatement Block
- addTestSource('main() {try {} ^ finally {}}');
+ addTestSource('void f() {try {} ^ finally {}}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -813,7 +813,7 @@
Future<void> test_catch_4c2() async {
// ['c' ExpressionStatement] Block BlockFunctionBody
- addTestSource('main() {try {} c^ finally {}}');
+ addTestSource('void f() {try {} c^ finally {}}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.add(Keyword.CATCH);
@@ -824,7 +824,7 @@
Future<void> test_catch_block() async {
// '}' Block CatchClause TryStatement Block
- addTestSource('main() {try {} catch (e) {^}}}');
+ addTestSource('void f() {try {} catch (e) {^}}}');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.addAll(statementStartOutsideClass);
@@ -1061,7 +1061,7 @@
}
Future<void> test_do_break_continue_outsideClass() async {
- addTestSource('main() {do {^} while (true);}');
+ addTestSource('void f() {do {^} while (true);}');
await computeSuggestions();
assertSuggestKeywords(statementStartInLoopOutsideClass);
}
@@ -1129,43 +1129,43 @@
}
Future<void> test_for_break_continue_outsideClass() async {
- addTestSource('main() {for (int x in myList) {^}}');
+ addTestSource('void f() {for (int x in myList) {^}}');
await computeSuggestions();
assertSuggestKeywords(statementStartInLoopOutsideClass);
}
Future<void> test_for_expression_in() async {
- addTestSource('main() {for (int x i^)}');
+ addTestSource('void f() {for (int x i^)}');
await computeSuggestions();
assertSuggestKeywords([Keyword.IN]);
}
Future<void> test_for_expression_in2() async {
- addTestSource('main() {for (int x in^)}');
+ addTestSource('void f() {for (int x in^)}');
await computeSuggestions();
assertSuggestKeywords([Keyword.IN]);
}
Future<void> test_for_expression_in_inInitializer() async {
- addTestSource('main() {for (int i^)}');
+ addTestSource('void f() {for (int i^)}');
await computeSuggestions();
assertSuggestKeywords([]);
}
Future<void> test_for_expression_init() async {
- addTestSource('main() {for (int x = i^)}');
+ addTestSource('void f() {for (int x = i^)}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
}
Future<void> test_for_expression_init2() async {
- addTestSource('main() {for (int x = in^)}');
+ addTestSource('void f() {for (int x = in^)}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
}
Future<void> test_for_initialization_var() async {
- addTestSource('main() {for (^)}');
+ addTestSource('void f() {for (^)}');
await computeSuggestions();
assertSuggestKeywords([Keyword.VAR]);
}
@@ -1234,32 +1234,32 @@
}
Future<void> test_function_async() async {
- addTestSource('main()^');
+ addTestSource('void f()^');
await computeSuggestions();
assertSuggestKeywords([], pseudoKeywords: ['async', 'async*', 'sync*']);
}
Future<void> test_function_async2() async {
- addTestSource('main()^{}');
+ addTestSource('void f()^{}');
await computeSuggestions();
assertSuggestKeywords([], pseudoKeywords: ['async', 'async*', 'sync*']);
}
Future<void> test_function_async3() async {
- addTestSource('main()a^');
+ addTestSource('void f()a^');
await computeSuggestions();
assertSuggestKeywords(declarationKeywords,
pseudoKeywords: ['async', 'async*', 'sync*']);
}
Future<void> test_function_async4() async {
- addTestSource('main()a^{}');
+ addTestSource('void f()a^{}');
await computeSuggestions();
assertSuggestKeywords([], pseudoKeywords: ['async', 'async*', 'sync*']);
}
Future<void> test_function_async5() async {
- addTestSource('main()a^ Foo foo;');
+ addTestSource('void f()a^ Foo foo;');
await computeSuggestions();
assertSuggestKeywords(declarationKeywords,
pseudoKeywords: ['async', 'async*', 'sync*']);
@@ -1371,33 +1371,33 @@
}
Future<void> test_function_body_inUnit() async {
- addTestSource('main() {^}');
+ addTestSource('void f() {^}');
await computeSuggestions();
assertSuggestKeywords(statementStartOutsideClass);
}
Future<void> test_function_body_inUnit_afterBlock() async {
- addTestSource('main() {{}^}');
+ addTestSource('void f() {{}^}');
await computeSuggestions();
assertSuggestKeywords(statementStartOutsideClass);
}
Future<void> test_function_body_inUnit_async() async {
- addTestSource('main() async {^}');
+ addTestSource('void f() async {^}');
await computeSuggestions();
assertSuggestKeywords(statementStartOutsideClass,
pseudoKeywords: ['await']);
}
Future<void> test_function_body_inUnit_async_star() async {
- addTestSource('main() async* {n^}');
+ addTestSource('void f() async* {n^}');
await computeSuggestions();
assertSuggestKeywords(statementStartOutsideClass,
pseudoKeywords: ['await', 'yield', 'yield*']);
}
Future<void> test_function_body_inUnit_async_star2() async {
- addTestSource('main() async* {n^ foo}');
+ addTestSource('void f() async* {n^ foo}');
await computeSuggestions();
assertSuggestKeywords(statementStartOutsideClass,
pseudoKeywords: ['await', 'yield', 'yield*']);
@@ -1416,27 +1416,27 @@
}
Future<void> test_function_body_inUnit_sync_star() async {
- addTestSource('main() sync* {n^}');
+ addTestSource('void f() sync* {n^}');
await computeSuggestions();
assertSuggestKeywords(statementStartOutsideClass,
pseudoKeywords: ['await', 'yield', 'yield*']);
}
Future<void> test_function_body_inUnit_sync_star2() async {
- addTestSource('main() sync* {n^ foo}');
+ addTestSource('void f() sync* {n^ foo}');
await computeSuggestions();
assertSuggestKeywords(statementStartOutsideClass,
pseudoKeywords: ['await', 'yield', 'yield*']);
}
Future<void> test_if_after_else() async {
- addTestSource('main() { if (true) {} else ^ }');
+ addTestSource('void f() { if (true) {} else ^ }');
await computeSuggestions();
assertSuggestKeywords(statementStartOutsideClass);
}
Future<void> test_if_afterThen_nextCloseCurlyBrace0() async {
- addTestSource('main() { if (true) {} ^ }');
+ addTestSource('void f() { if (true) {} ^ }');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.addAll(statementStartOutsideClass);
@@ -1445,7 +1445,7 @@
}
Future<void> test_if_afterThen_nextCloseCurlyBrace1() async {
- addTestSource('main() { if (true) {} e^ }');
+ addTestSource('void f() { if (true) {} e^ }');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.addAll(statementStartOutsideClass);
@@ -1454,7 +1454,7 @@
}
Future<void> test_if_afterThen_nextStatement0() async {
- addTestSource('main() { if (true) {} ^ print(0); }');
+ addTestSource('void f() { if (true) {} ^ print(0); }');
await computeSuggestions();
var keywords = <Keyword>[];
keywords.addAll(statementStartOutsideClass);
@@ -1463,13 +1463,13 @@
}
Future<void> test_if_condition_isKeyword() async {
- addTestSource('main() { if (v i^) {} }');
+ addTestSource('void f() { if (v i^) {} }');
await computeSuggestions();
assertSuggestKeywords([Keyword.IS]);
}
Future<void> test_if_condition_isKeyword2() async {
- addTestSource('main() { if (v i^ && false) {} }');
+ addTestSource('void f() { if (v i^ && false) {} }');
await computeSuggestions();
assertSuggestKeywords([Keyword.IS]);
}
@@ -2012,25 +2012,25 @@
}
Future<void> test_integerLiteral_inArgumentList() async {
- addTestSource('main() { print(42^); }');
+ addTestSource('void f() { print(42^); }');
await computeSuggestions();
assertSuggestKeywords([]);
}
Future<void> test_integerLiteral_inListLiteral() async {
- addTestSource('main() { var items = [42^]; }');
+ addTestSource('void f() { var items = [42^]; }');
await computeSuggestions();
assertSuggestKeywords([]);
}
Future<void> test_is_expression() async {
- addTestSource('main() {if (x is^)}');
+ addTestSource('void f() {if (x is^)}');
await computeSuggestions();
assertSuggestKeywords([Keyword.IS]);
}
Future<void> test_is_expression_partial() async {
- addTestSource('main() {if (x i^)}');
+ addTestSource('void f() {if (x i^)}');
await computeSuggestions();
assertSuggestKeywords([Keyword.IS]);
}
@@ -2243,7 +2243,7 @@
}
Future<void> test_named_constructor_invocation() async {
- addTestSource('void main() {new Future.^}');
+ addTestSource('void f() {new Future.^}');
await computeSuggestions();
assertSuggestKeywords([]);
}
@@ -2335,67 +2335,67 @@
}
Future<void> test_switch_expression() async {
- addTestSource('main() {switch(^) {}}');
+ addTestSource('void f() {switch(^) {}}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
}
Future<void> test_switch_expression2() async {
- addTestSource('main() {switch(n^) {}}');
+ addTestSource('void f() {switch(n^) {}}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
}
Future<void> test_switch_expression3() async {
- addTestSource('main() {switch(n^)}');
+ addTestSource('void f() {switch(n^)}');
await computeSuggestions();
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
}
Future<void> test_switch_start() async {
- addTestSource('main() {switch(1) {^}}');
+ addTestSource('void f() {switch(1) {^}}');
await computeSuggestions();
assertSuggestKeywords([Keyword.CASE, Keyword.DEFAULT]);
}
Future<void> test_switch_start2() async {
- addTestSource('main() {switch(1) {^ case 1:}}');
+ addTestSource('void f() {switch(1) {^ case 1:}}');
await computeSuggestions();
assertSuggestKeywords([Keyword.CASE, Keyword.DEFAULT]);
}
Future<void> test_switch_start3() async {
- addTestSource('main() {switch(1) {^default:}}');
+ addTestSource('void f() {switch(1) {^default:}}');
await computeSuggestions();
assertSuggestKeywords([Keyword.CASE, Keyword.DEFAULT]);
}
Future<void> test_switch_start4() async {
- addTestSource('main() {switch(1) {^ default:}}');
+ addTestSource('void f() {switch(1) {^ default:}}');
await computeSuggestions();
assertSuggestKeywords([Keyword.CASE, Keyword.DEFAULT]);
}
Future<void> test_switch_start5() async {
- addTestSource('main() {switch(1) {c^ default:}}');
+ addTestSource('void f() {switch(1) {c^ default:}}');
await computeSuggestions();
- expect(replacementOffset, 19);
+ expect(replacementOffset, 21);
expect(replacementLength, 1);
assertSuggestKeywords([Keyword.CASE, Keyword.DEFAULT]);
}
Future<void> test_switch_start6() async {
- addTestSource('main() {switch(1) {c^}}');
+ addTestSource('void f() {switch(1) {c^}}');
await computeSuggestions();
- expect(replacementOffset, 19);
+ expect(replacementOffset, 21);
expect(replacementLength, 1);
assertSuggestKeywords([Keyword.CASE, Keyword.DEFAULT]);
}
Future<void> test_switch_start7() async {
- addTestSource('main() {switch(1) { c^ }}');
+ addTestSource('void f() {switch(1) { c^ }}');
await computeSuggestions();
- expect(replacementOffset, 20);
+ expect(replacementOffset, 22);
expect(replacementLength, 1);
assertSuggestKeywords([Keyword.CASE, Keyword.DEFAULT]);
}
@@ -2419,7 +2419,7 @@
}
Future<void> test_switch_statement_outsideClass() async {
- addTestSource('main() {switch(1) {case 1:^}}');
+ addTestSource('void f() {switch(1) {case 1:^}}');
await computeSuggestions();
assertSuggestKeywords(statementStartInSwitchOutsideClass);
}
@@ -2431,7 +2431,7 @@
}
Future<void> test_while_break_continue() async {
- addTestSource('main() {while (true) {^}}');
+ addTestSource('void f() {while (true) {^}}');
await computeSuggestions();
assertSuggestKeywords(statementStartInLoopOutsideClass);
}
diff --git a/pkg/analysis_server/test/services/completion/dart/label_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/label_contributor_test.dart
index 2d6d5f5..03ad24f 100644
--- a/pkg/analysis_server/test/services/completion/dart/label_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/label_contributor_test.dart
@@ -44,7 +44,7 @@
Future<void> test_break_ignores_outer_functions_using_closure() async {
addTestSource('''
-void main() {
+void g() {
foo: while (true) {
var f = () {
bar: while (true) { break ^ }
@@ -60,7 +60,7 @@
Future<void> test_break_ignores_outer_functions_using_local_function() async {
addTestSource('''
-void main() {
+void g() {
foo: while (true) {
void f() {
bar: while (true) { break ^ }
@@ -77,7 +77,7 @@
Future<void> test_break_ignores_toplevel_variables() async {
addTestSource('''
int x;
-void main() {
+void f() {
while (true) {
break ^
}
@@ -89,7 +89,7 @@
Future<void> test_break_ignores_unrelated_statements() async {
addTestSource('''
-void main() {
+void f() {
foo: while (true) {}
while (true) { break ^ }
bar: while (true) {}
@@ -105,7 +105,7 @@
Future<void> test_break_to_enclosing_loop() async {
addTestSource('''
-void main() {
+void f() {
foo: while (true) {
bar: while (true) {
break ^
@@ -120,7 +120,7 @@
Future<void> test_continue_from_loop_to_switch() async {
addTestSource('''
-void main() {
+void f() {
switch (x) {
foo: case 1:
break;
@@ -142,7 +142,7 @@
Future<void> test_continue_from_switch_to_loop() async {
addTestSource('''
-void main() {
+void f() {
foo: while (true) {
switch (x) {
case 1:
@@ -158,7 +158,7 @@
Future<void>
test_continue_ignores_outer_functions_using_closure_with_loop() async {
addTestSource('''
-void main() {
+void f() {
foo: while (true) {
var f = () {
bar: while (true) { continue ^ }
@@ -175,7 +175,7 @@
Future<void>
test_continue_ignores_outer_functions_using_closure_with_switch() async {
addTestSource('''
-void main() {
+void g() {
switch (x) {
foo: case 1:
var f = () {
@@ -193,7 +193,7 @@
Future<void>
test_continue_ignores_outer_functions_using_local_function_with_loop() async {
addTestSource('''
-void main() {
+void g() {
foo: while (true) {
void f() {
bar: while (true) { continue ^ }
@@ -210,7 +210,7 @@
Future<void>
test_continue_ignores_outer_functions_using_local_function_with_switch() async {
addTestSource('''
-void main() {
+void g() {
switch (x) {
foo: case 1:
void f() {
@@ -227,7 +227,7 @@
Future<void> test_continue_ignores_unrelated_statements() async {
addTestSource('''
-void main() {
+void f() {
foo: while (true) {}
while (true) { continue ^ }
bar: while (true) {}
@@ -243,7 +243,7 @@
Future<void> test_continue_to_earlier_case() async {
addTestSource('''
-void main() {
+void f() {
switch (x) {
foo: case 1:
break;
@@ -258,7 +258,7 @@
Future<void> test_continue_to_enclosing_loop() async {
addTestSource('''
-void main() {
+void f() {
foo: while (true) {
bar: while (true) {
continue ^
@@ -273,7 +273,7 @@
Future<void> test_continue_to_enclosing_switch() async {
addTestSource('''
-void main() {
+void f() {
switch (x) {
foo: case 1:
break;
@@ -296,7 +296,7 @@
Future<void> test_continue_to_later_case() async {
addTestSource('''
-void main() {
+void f() {
switch (x) {
case 1:
break;
@@ -311,7 +311,7 @@
Future<void> test_continue_to_same_case() async {
addTestSource('''
-void main() {
+void f() {
switch (x) {
case 1:
break;
diff --git a/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
index 83bd6c0..500335f 100644
--- a/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
@@ -33,15 +33,19 @@
extension MyExt on int {}
''');
addTestSource('''
- import "b.dart" as b;
- main() {b.^}''');
+import "b.dart" as b;
+void f() {b.^}
+''');
await computeSuggestions();
assertSuggest('MyExt');
}
Future<void> test_libraryPrefix() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('import "dart:async" as bar; foo() {bar.^}');
+ addTestSource('''
+import "dart:async" as bar;
+foo() {bar.^}
+''');
await computeSuggestions();
assertSuggestClass('Future');
assertNotSuggested('loadLibrary');
@@ -49,14 +53,26 @@
Future<void> test_libraryPrefix2() async {
// SimpleIdentifier MethodInvocation ExpressionStatement
- addTestSource('import "dart:async" as bar; foo() {bar.^ print("f")}');
+ addTestSource('''
+import "dart:async" as bar;
+foo() {
+ bar.^
+ print("f");
+}
+''');
await computeSuggestions();
assertSuggestClass('Future');
}
Future<void> test_libraryPrefix3() async {
// SimpleIdentifier MethodInvocation ExpressionStatement
- addTestSource('import "dart:async" as bar; foo() {new bar.F^ print("f")}');
+ addTestSource('''
+import "dart:async" as bar;
+foo() {
+ new bar.F^
+ print("f");
+}
+''');
await computeSuggestions();
assertSuggestConstructor('Future');
assertSuggestConstructor('Future.delayed');
@@ -64,32 +80,44 @@
Future<void> test_libraryPrefix_cascade() async {
addTestSource('''
- import "dart:math" as math;
- main() {math..^}''');
+import "dart:math" as math;
+void f() {
+ math..^
+}
+''');
await computeSuggestions();
assertNoSuggestions();
}
Future<void> test_libraryPrefix_cascade2() async {
addTestSource('''
- import "dart:math" as math;
- main() {math.^.}''');
+import "dart:math" as math;
+void f() {
+ math.^.
+}
+''');
await computeSuggestions();
assertSuggestFunction('min', 'T');
}
Future<void> test_libraryPrefix_cascade3() async {
addTestSource('''
- import "dart:math" as math;
- main() {math..^a}''');
+import "dart:math" as math;
+void f() {
+ math..^a
+}
+''');
await computeSuggestions();
assertNoSuggestions();
}
Future<void> test_libraryPrefix_cascade4() async {
addTestSource('''
- import "dart:math" as math;
- main() {math.^.a}''');
+import "dart:math" as math;
+void f() {
+ math.^.a
+}
+''');
await computeSuggestions();
assertSuggestFunction('min', 'T');
}
@@ -105,9 +133,10 @@
Future<void> test_libraryPrefix_deferred_inPart() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
newFile('$testPackageLibPath/a.dart', '''
- library testA;
- import "dart:async" deferred as bar;
- part "test.dart";''');
+library testA;
+import "dart:async" deferred as bar;
+part "test.dart";
+''');
addTestSource('part of testA; foo() {bar.^}');
await resolveFile('$testPackageLibPath/a.dart');
// Assume that libraries containing has been computed for part files
@@ -124,7 +153,11 @@
export "a.dart";
class B { }
@deprecated class B1 { }''');
- addTestSource('import "b.dart" as foo; main() {foo.^} class C { }');
+ addTestSource('''
+import "b.dart" as foo;
+void f() {foo.^}
+class C { }
+''');
await computeSuggestions();
assertSuggestClass('B');
assertSuggestClass('B1', isDeprecated: true);
@@ -135,15 +168,17 @@
Future<void> test_PrefixedIdentifier_library() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
- lib B;
- var T1;
- class X { }
- class Y { }''');
+lib B;
+var T1;
+class X { }
+class Y { }
+''');
addTestSource('''
- import "b.dart" as b;
- var T2;
- class A { }
- main() {b.^}''');
+import "b.dart" as b;
+var T2;
+class A { }
+void f() {b.^}
+''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
expect(replacementLength, 0);
@@ -167,7 +202,7 @@
''');
addTestSource(r'''
import 'b.dart' as p;
-main() {
+void f() {
p.^
}
''');
@@ -183,7 +218,7 @@
''');
addTestSource(r'''
import 'a.dart' as p show A;
-main() {
+void f() {
p.^
}
''');
@@ -200,14 +235,16 @@
class X { }
class Y { }''');
newFile('$testPackageLibPath/a.dart', '''
- library testA;
- import "b.dart" as b;
- part "test.dart";
- var T2;
- class A { }''');
+library testA;
+import "b.dart" as b;
+part "test.dart";
+var T2;
+class A { }
+''');
addTestSource('''
- part of testA;
- main() {b.^}''');
+part of testA;
+void f() {b.^}
+''');
await resolveFile('$testPackageLibPath/a.dart');
// Assume that libraries containing has been computed for part files
await computeSuggestions();
@@ -226,18 +263,20 @@
Future<void> test_PrefixedIdentifier_library_typesOnly() async {
// SimpleIdentifier PrefixedIdentifier NamedType
newFile('$testPackageLibPath/b.dart', '''
- lib B;
- var T1;
- class X { }
- class Y { }
- typedef void TypeAliasLegacy();
- typedef TypeAliasFunctionType = void Function();
- typedef TypeAliasInterfaceType = List<int>;''');
+lib B;
+var T1;
+class X { }
+class Y { }
+typedef void TypeAliasLegacy();
+typedef TypeAliasFunctionType = void Function();
+typedef TypeAliasInterfaceType = List<int>;
+''');
addTestSource('''
- import "b.dart" as b;
- var T2;
- class A { }
- foo(b.^ f) {}''');
+import "b.dart" as b;
+var T2;
+class A { }
+foo(b.^ f) {}
+''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
expect(replacementLength, 0);
@@ -259,15 +298,17 @@
Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
// SimpleIdentifier PrefixedIdentifier NamedType
newFile('$testPackageLibPath/b.dart', '''
- lib B;
- var T1;
- class X { }
- class Y { }''');
+lib B;
+var T1;
+class X { }
+class Y { }
+''');
addTestSource('''
- import "b.dart" as b;
- var T2;
- class A { }
- foo(b.^) {}''');
+import "b.dart" as b;
+var T2;
+class A { }
+foo(b.^) {}
+''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
expect(replacementLength, 0);
@@ -284,13 +325,15 @@
Future<void> test_PrefixedIdentifier_parameter() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
newFile('$testPackageLibPath/b.dart', '''
- lib B;
- class _W {M y; var _z;}
- class X extends _W {}
- class M{}''');
+lib B;
+class _W {M y; var _z;}
+class X extends _W {}
+class M{}
+''');
addTestSource('''
- import "b.dart";
- foo(X x) {x.^}''');
+import "b.dart";
+foo(X x) {x.^}
+''');
await computeSuggestions();
assertNoSuggestions();
}
@@ -298,11 +341,13 @@
Future<void> test_PrefixedIdentifier_prefix() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
newFile('$testPackageLibPath/a.dart', '''
- class A {static int bar = 10;}
- _B() {}''');
+class A {static int bar = 10;}
+_B() {}
+''');
addTestSource('''
- import "a.dart";
- class X {foo(){A^.bar}}''');
+import "a.dart";
+class X {foo(){A^.bar}}
+''');
await computeSuggestions();
assertNoSuggestions();
}
diff --git a/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
index 34904db..7298c06 100644
--- a/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
@@ -282,7 +282,7 @@
addTestSource('''
import "a.dart" as t;
import "dart:math" as math;
-main() {new ^ String x = "hello";}''');
+void f() {new ^ String x = "hello";}''');
await computeSuggestions();
assertSuggestLibraryPrefixes(['math', 't']);
}
@@ -303,10 +303,10 @@
import "a.dart" as t;
import "dart:math" as math;
part "test.dart";
-main() {new ^ String x = "hello";}''');
+void f() {new ^ String x = "hello";}''');
addTestSource('''
part of testB;
-main() {new ^ String x = "hello";}''');
+void f() {new ^ String x = "hello";}''');
await analyzeTestPackageFiles();
await computeSuggestions();
assertSuggestLibraryPrefixes(['math', 't']);
@@ -322,10 +322,10 @@
import "a.dart" as t;
import "dart:math" as math;
//part "$testFile"
-main() {new ^ String x = "hello";}''');
+void f() {new ^ String x = "hello";}''');
addTestSource('''
//part of testB;
-main() {new ^ String x = "hello";}''');
+void f() {new ^ String x = "hello";}''');
await computeSuggestions();
assertNoSuggestions();
}
diff --git a/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart
index 55e4757..3214f4d 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart
@@ -43,7 +43,7 @@
addTestSource('''
part of libA;
class B { B.bar(int x); }
- main() {new ^}''');
+ void f() {new ^}''');
await resolveFile('$testPackageLibPath/a.dart');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@@ -77,7 +77,7 @@
import "b.dart";
part "a.dart";
class A { A({String boo: 'hoo'}) { } }
- main() {new ^}
+ void f() {new ^}
var m;''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@@ -129,7 +129,7 @@
import "b.dart";
part "a.dart";
class Local { }
- main() {
+ void f() {
A a;
// FAIL:
a = new ^
@@ -176,7 +176,7 @@
import "b.dart";
part "a.dart";
class Local { }
- main() {
+ void f() {
A a = new ^
}
var m;''');
@@ -223,7 +223,7 @@
addTestSource('''
part of libA;
class B { B.bar(int x); }
- main() {^}''');
+ void f() {^}''');
await resolveFile('$testPackageLibPath/a.dart');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@@ -270,7 +270,7 @@
import "b.dart";
part "a.dart";
class A { A({String boo: 'hoo'}) { } }
- main() {^}
+ void f() {^}
var m;''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
diff --git a/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
index 7c9b3d8..cfd0d74 100644
--- a/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
@@ -300,7 +300,7 @@
addTestSource('''
import 'b.dart';
var m;
- main() {new X.^}''');
+ void f() {new X.^}''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@@ -328,7 +328,7 @@
addTestSource('''
import 'b.dart';
var m;
- main() {new X.^}''');
+ void f() {new X.^}''');
// Assume that imported libraries are NOT resolved
//await resolveLibraryUnit(libSource);
await computeSuggestions();
@@ -357,7 +357,7 @@
addTestSource('''
import 'b.dart';
var m;
- main() {new X.^}''');
+ void f() {new X.^}''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@@ -378,7 +378,7 @@
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addTestSource('''
- main() {new String.fr^omCharCodes([]);}''');
+ void f() {new String.fr^omCharCodes([]);}''');
await computeSuggestions();
expect(replacementOffset, completionOffset - 2);
expect(replacementLength, 13);
@@ -401,7 +401,7 @@
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}
- main() {new X.^}''');
+ void f() {new X.^}''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
expect(replacementLength, 0);
@@ -428,7 +428,7 @@
int T1;
F1() { }
class X {factory X.c(); factory X._d(); z() {}}
- main() {new X.^}''');
+ void f() {new X.^}''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
expect(replacementLength, 0);
diff --git a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
index 7c2a610..dfb345c 100644
--- a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
@@ -52,7 +52,7 @@
}
Future<void> test_enumConst() async {
- addTestSource('enum E { one, two } main() {E.^}');
+ addTestSource('enum E { one, two } void f() {E.^}');
await computeSuggestions();
assertNotSuggested('E');
assertSuggestEnumConst('one');
@@ -62,7 +62,7 @@
}
Future<void> test_enumConst2() async {
- addTestSource('enum E { one, two } main() {E.o^}');
+ addTestSource('enum E { one, two } void f() {E.o^}');
await computeSuggestions();
assertNotSuggested('E');
assertSuggestEnumConst('one');
@@ -72,7 +72,7 @@
}
Future<void> test_enumConst3() async {
- addTestSource('enum E { one, two } main() {E.^ int g;}');
+ addTestSource('enum E { one, two } void f() {E.^ int g;}');
await computeSuggestions();
assertNotSuggested('E');
assertSuggestEnumConst('one');
@@ -82,13 +82,13 @@
}
Future<void> test_enumConst_cascade1() async {
- addTestSource('enum E { one, two } main() {E..^}');
+ addTestSource('enum E { one, two } void f() {E..^}');
await computeSuggestions();
assertNoSuggestions();
}
Future<void> test_enumConst_cascade2() async {
- addTestSource('enum E { one, two } main() {E.^.}');
+ addTestSource('enum E { one, two } void f() {E.^.}');
await computeSuggestions();
assertNotSuggested('E');
assertSuggestEnumConst('one');
@@ -98,13 +98,13 @@
}
Future<void> test_enumConst_cascade3() async {
- addTestSource('enum E { one, two } main() {E..o^}');
+ addTestSource('enum E { one, two } void f() {E..o^}');
await computeSuggestions();
assertNoSuggestions();
}
Future<void> test_enumConst_cascade4() async {
- addTestSource('enum E { one, two } main() {E.^.o}');
+ addTestSource('enum E { one, two } void f() {E.^.o}');
await computeSuggestions();
assertNotSuggested('E');
assertSuggestEnumConst('one');
@@ -114,7 +114,7 @@
}
Future<void> test_enumConst_deprecated() async {
- addTestSource('@deprecated enum E { one, two } main() {E.^}');
+ addTestSource('@deprecated enum E { one, two } void f() {E.^}');
await computeSuggestions();
assertNotSuggested('E');
assertSuggestEnumConst('one', isDeprecated: true);
@@ -129,7 +129,7 @@
static int i;
static String s;
}
-main() {E.^}
+void f() {E.^}
''');
await computeSuggestions();
assertNotSuggested('E');
@@ -169,7 +169,7 @@
addTestSource('''
import 'a.dart';
-main() {
+void f() {
A.^;
}
''');
@@ -190,7 +190,7 @@
addTestSource('''
import 'a.dart';
-main() {
+void f() {
A Function() v = A.^;
}
''');
@@ -211,7 +211,7 @@
addTestSource('''
import 'a.dart';
-main() {
+void f() {
int Function() v = A.^;
}
''');
@@ -222,7 +222,8 @@
}
Future<void> test_keyword() async {
- addTestSource('class C { static C get instance => null; } main() {C.in^}');
+ addTestSource(
+ 'class C { static C get instance => null; } void f() {C.in^}');
await computeSuggestions();
assertSuggestGetter('instance', 'C');
}
@@ -239,7 +240,7 @@
m1() {}
static m2() {}
}
-void main() {C.^}''');
+void f() {C.^}''');
await computeSuggestions();
assertNotSuggested('b1');
assertNotSuggested('f1');
@@ -260,7 +261,7 @@
m1() {}
static m2() {}
}
-void main() {C.^ print("something");}''');
+void f() {C.^ print("something");}''');
await computeSuggestions();
assertNotSuggested('b1');
assertNotSuggested('f1');
@@ -281,7 +282,7 @@
m1() {}
static m2() {}
}
-void main() {C..^}''');
+void f() {C..^}''');
await computeSuggestions();
assertNoSuggestions();
}
@@ -298,7 +299,7 @@
m1() {}
static m2() {}
}
-void main() {C.^.}''');
+void f() {C.^.}''');
await computeSuggestions();
assertNotSuggested('b1');
assertNotSuggested('f1');
@@ -319,7 +320,7 @@
m1() {}
static m2() {}
}
-void main() {C..m^()}''');
+void f() {C..m^()}''');
await computeSuggestions();
assertNoSuggestions();
}
@@ -336,7 +337,7 @@
m1() {}
static m2() {}
}
-void main() {C.^.m()}''');
+void f() {C.^.m()}''');
await computeSuggestions();
assertNotSuggested('b1');
assertNotSuggested('f1');
@@ -349,7 +350,7 @@
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addTestSource('''
import "dart:async" as async;
-void main() {async.Future..w^()}''');
+void f() {async.Future..w^()}''');
await computeSuggestions();
assertNoSuggestions();
}
@@ -358,7 +359,7 @@
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addTestSource('''
import "dart:async" as async;
-void main() {async.Future.^.w()}''');
+void f() {async.Future.^.w()}''');
await computeSuggestions();
assertSuggestMethod('wait', 'Future', 'Future<List<T>>');
}
@@ -383,7 +384,7 @@
class A extends B {
static const String scA = 'foo';
w() { }}
- main() {A.^}''');
+ void f() {A.^}''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
expect(replacementLength, 0);
diff --git a/pkg/analysis_server/test/services/correction/sort_members_test.dart b/pkg/analysis_server/test/services/correction/sort_members_test.dart
index a8595c8..bb4d2d5 100644
--- a/pkg/analysis_server/test/services/correction/sort_members_test.dart
+++ b/pkg/analysis_server/test/services/correction/sort_members_test.dart
@@ -1350,12 +1350,12 @@
aaa() {}
get bbb() {}
class A {}
-main() {}
+void main() {}
class B {}
''');
// validate change
_assertSort(r'''
-main() {}
+void main() {}
get bbb() {}
aaa() {}
class A {}
diff --git a/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart b/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart
index 693ac67..ff55a93 100644
--- a/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart
+++ b/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart
@@ -34,7 +34,7 @@
var unitOutline = await _computeOutline('''
import 'package:flutter/widgets.dart';
-main() {
+void f() {
return new WidgetA(
value: 42,
); // WidgetA
@@ -51,8 +51,8 @@
var attribute = widget.attributes![0];
expect(attribute.name, 'value');
expect(attribute.label, '42');
- _assertLocation(attribute.nameLocation!, 75, 5);
- _assertLocation(attribute.valueLocation!, 82, 2);
+ _assertLocation(attribute.nameLocation!, 77, 5);
+ _assertLocation(attribute.valueLocation!, 84, 2);
}
Future<void> test_attributes_bool() async {
@@ -596,7 +596,7 @@
var unitOutline = await _computeOutline('''
import 'package:flutter/widgets.dart';
-main() {
+void f() {
new MyWidget($value);
}
@@ -617,7 +617,7 @@
var attribute = newMyWidget.attributes![0];
expect(attribute.name, name);
expect(attribute.nameLocation, isNull);
- _assertLocation(attribute.valueLocation!, 64, value.length);
+ _assertLocation(attribute.valueLocation!, 66, value.length);
return attribute;
}