| Index: pkg/analysis_server/test/services/completion/completion_test_util.dart
|
| diff --git a/pkg/analysis_server/test/services/completion/completion_test_util.dart b/pkg/analysis_server/test/services/completion/completion_test_util.dart
|
| index d84237508ee1f5b8c0c6d7f82375ddf988017760..f710bc4ba0d144f87fa075fa965802b2f3d20cdc 100644
|
| --- a/pkg/analysis_server/test/services/completion/completion_test_util.dart
|
| +++ b/pkg/analysis_server/test/services/completion/completion_test_util.dart
|
| @@ -510,31 +510,13 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| }
|
| }
|
|
|
| - test_AsExpression_target() {
|
| - // IfStatement Block BlockFunctionBody
|
| - addTestSource('''
|
| - class A {int x; int y() => 0;}
|
| - main(){var a; if (^ is A)}''');
|
| - computeFast();
|
| - return computeFull(true).then((_) {
|
| - assertSuggestLocalVariable('a', null);
|
| - assertSuggestLocalFunction('main', null);
|
| - assertSuggestLocalClass('A');
|
| - assertSuggestImportedClass('Object');
|
| - });
|
| - }
|
| -
|
| - test_AsExpression_type() {
|
| - // SimpleIdentifier TypeName IsExpression IfStatement
|
| - addTestSource('''
|
| - class A {int x; int y() => 0;}
|
| - main(){var a; if (a is ^)}''');
|
| + test_AssignmentExpression_name() {
|
| + // SimpleIdentifier VariableDeclaration VariableDeclarationList
|
| + // VariableDeclarationStatement Block
|
| + addTestSource('class A {} main() {int a; int ^b = 1;}');
|
| computeFast();
|
| return computeFull(true).then((_) {
|
| - assertNotSuggested('a');
|
| - assertNotSuggested('main');
|
| - assertSuggestLocalClass('A');
|
| - assertSuggestImportedClass('Object');
|
| + assertNoSuggestions();
|
| });
|
| }
|
|
|
| @@ -551,16 +533,6 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| });
|
| }
|
|
|
| - test_AssignmentExpression_name() {
|
| - // SimpleIdentifier VariableDeclaration VariableDeclarationList
|
| - // VariableDeclarationStatement Block
|
| - addTestSource('class A {} main() {int a; int ^b = 1;}');
|
| - computeFast();
|
| - return computeFull(true).then((_) {
|
| - assertNoSuggestions();
|
| - });
|
| - }
|
| -
|
| test_AssignmentExpression_type() {
|
| // SimpleIdentifier TypeName VariableDeclarationList
|
| // VariableDeclarationStatement Block
|
| @@ -1105,25 +1077,25 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| });
|
| }
|
|
|
| -// test_InterpolationExpression() {
|
| -// // SimpleIdentifier InterpolationExpression StringInterpolation
|
| -// addTestSource('main() {String name; print("hello \$^");}');
|
| -// computeFast();
|
| -// return computeFull(true).then((_) {
|
| -// assertSuggestLocalVariable('name', 'String');
|
| -// assertSuggestImportedClass('Object');
|
| -// });
|
| -// }
|
| -
|
| -// test_InterpolationExpression_block() {
|
| -// // SimpleIdentifier InterpolationExpression StringInterpolation
|
| -// addTestSource('main() {String name; print("hello \${n^}");}');
|
| -// computeFast();
|
| -// return computeFull(true).then((_) {
|
| -// assertSuggestLocalVariable('name', 'String');
|
| -// assertSuggestImportedClass('Object');
|
| -// });
|
| -// }
|
| + test_InterpolationExpression() {
|
| + // SimpleIdentifier InterpolationExpression StringInterpolation
|
| + addTestSource('main() {String name; print("hello \$^");}');
|
| + computeFast();
|
| + return computeFull(true).then((_) {
|
| + assertSuggestLocalVariable('name', 'String');
|
| + assertSuggestImportedClass('Object');
|
| + });
|
| + }
|
| +
|
| + test_InterpolationExpression_block() {
|
| + // SimpleIdentifier InterpolationExpression StringInterpolation
|
| + addTestSource('main() {String name; print("hello \${n^}");}');
|
| + computeFast();
|
| + return computeFull(true).then((_) {
|
| + assertSuggestLocalVariable('name', 'String');
|
| + assertSuggestImportedClass('Object');
|
| + });
|
| + }
|
|
|
| test_InterpolationExpression_prefix_selector() {
|
| // SimpleIdentifier PrefixedIdentifier InterpolationExpression
|
| @@ -1136,16 +1108,16 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| });
|
| }
|
|
|
| -// test_InterpolationExpression_prefix_target() {
|
| -// // SimpleIdentifier PrefixedIdentifier InterpolationExpression
|
| -// addTestSource('main() {String name; print("hello \${nam^e.length}");}');
|
| -// computeFast();
|
| -// return computeFull(true).then((_) {
|
| -// assertSuggestLocalVariable('name', 'String');
|
| -// assertSuggestImportedClass('Object');
|
| -// assertNotSuggested('length');
|
| -// });
|
| -// }
|
| + test_InterpolationExpression_prefix_target() {
|
| + // SimpleIdentifier PrefixedIdentifier InterpolationExpression
|
| + addTestSource('main() {String name; print("hello \${nam^e.length}");}');
|
| + computeFast();
|
| + return computeFull(true).then((_) {
|
| + assertSuggestLocalVariable('name', 'String');
|
| + assertSuggestImportedClass('Object');
|
| + assertNotSuggested('length');
|
| + });
|
| + }
|
|
|
| test_IsExpression() {
|
| // SimpleIdentifier TypeName IsExpression IfStatement
|
| @@ -1167,6 +1139,34 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| });
|
| }
|
|
|
| + test_IsExpression_target() {
|
| + // IfStatement Block BlockFunctionBody
|
| + addTestSource('''
|
| + class A {int x; int y() => 0;}
|
| + main(){var a; if (^ is A)}''');
|
| + computeFast();
|
| + return computeFull(true).then((_) {
|
| + assertSuggestLocalVariable('a', null);
|
| + assertSuggestLocalFunction('main', null);
|
| + assertSuggestLocalClass('A');
|
| + assertSuggestImportedClass('Object');
|
| + });
|
| + }
|
| +
|
| + test_IsExpression_type() {
|
| + // SimpleIdentifier TypeName IsExpression IfStatement
|
| + addTestSource('''
|
| + class A {int x; int y() => 0;}
|
| + main(){var a; if (a is ^)}''');
|
| + computeFast();
|
| + return computeFull(true).then((_) {
|
| + assertNotSuggested('a');
|
| + assertNotSuggested('main');
|
| + assertSuggestLocalClass('A');
|
| + assertSuggestImportedClass('Object');
|
| + });
|
| + }
|
| +
|
| test_Literal_string() {
|
| // SimpleStringLiteral ExpressionStatement Block
|
| addTestSource('class A {a() {"hel^lo"}}');
|
| @@ -1373,6 +1373,30 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| });
|
| }
|
|
|
| + test_PropertyAccess_expression() {
|
| + // SimpleIdentifier MethodInvocation PropertyAccess ExpressionStatement
|
| + addTestSource('class A {a() {"hello".to^String().length}}');
|
| + computeFast();
|
| + return computeFull(true).then((_) {
|
| + assertSuggestInvocationGetter('length', 'int');
|
| + assertNotSuggested('A');
|
| + assertNotSuggested('a');
|
| + assertNotSuggested('Object');
|
| + });
|
| + }
|
| +
|
| + test_PropertyAccess_selector() {
|
| + // SimpleIdentifier PropertyAccess ExpressionStatement Block
|
| + addTestSource('class A {a() {"hello".length.^}}');
|
| + computeFast();
|
| + return computeFull(true).then((_) {
|
| + assertSuggestInvocationGetter('isEven', 'bool');
|
| + assertNotSuggested('A');
|
| + assertNotSuggested('a');
|
| + assertNotSuggested('Object');
|
| + });
|
| + }
|
| +
|
| test_TopLevelVariableDeclaration_typed_name() {
|
| // SimpleIdentifier VariableDeclaration VariableDeclarationList
|
| // TopLevelVariableDeclaration
|
| @@ -1393,9 +1417,9 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| });
|
| }
|
|
|
| - test_VariableDeclarationStatement_RHS() {
|
| + test_VariableDeclaration_name() {
|
| // SimpleIdentifier VariableDeclaration VariableDeclarationList
|
| - // VariableDeclarationStatement
|
| + // VariableDeclarationStatement Block
|
| addSource('/testB.dart', '''
|
| lib B;
|
| foo() { }
|
| @@ -1404,21 +1428,15 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| addTestSource('''
|
| import "/testB.dart";
|
| class Y {Y.c(); Y._d(); z() {}}
|
| - class C {bar(){var f; {var x;} var e = ^}}''');
|
| + main() {var ^}''');
|
| computeFast();
|
| return computeFull(true).then((_) {
|
| - assertSuggestImportedClass('X');
|
| - assertNotSuggested('_B');
|
| - assertSuggestLocalClass('Y');
|
| - assertSuggestLocalClass('C');
|
| - assertSuggestLocalVariable('f', null);
|
| - assertNotSuggested('x');
|
| - assertNotSuggested('e');
|
| + assertNoSuggestions();
|
| });
|
| }
|
|
|
| - test_VariableDeclarationStatement_RHS_missing_semicolon() {
|
| - // VariableDeclaration VariableDeclarationList
|
| + test_VariableDeclarationStatement_RHS() {
|
| + // SimpleIdentifier VariableDeclaration VariableDeclarationList
|
| // VariableDeclarationStatement
|
| addSource('/testB.dart', '''
|
| lib B;
|
| @@ -1428,7 +1446,7 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| addTestSource('''
|
| import "/testB.dart";
|
| class Y {Y.c(); Y._d(); z() {}}
|
| - class C {bar(){var f; {var x;} var e = ^ var g}}''');
|
| + class C {bar(){var f; {var x;} var e = ^}}''');
|
| computeFast();
|
| return computeFull(true).then((_) {
|
| assertSuggestImportedClass('X');
|
| @@ -1441,9 +1459,9 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| });
|
| }
|
|
|
| - test_VariableDeclaration_name() {
|
| - // SimpleIdentifier VariableDeclaration VariableDeclarationList
|
| - // VariableDeclarationStatement Block
|
| + test_VariableDeclarationStatement_RHS_missing_semicolon() {
|
| + // VariableDeclaration VariableDeclarationList
|
| + // VariableDeclarationStatement
|
| addSource('/testB.dart', '''
|
| lib B;
|
| foo() { }
|
| @@ -1452,82 +1470,16 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| addTestSource('''
|
| import "/testB.dart";
|
| class Y {Y.c(); Y._d(); z() {}}
|
| - main() {var ^}''');
|
| + class C {bar(){var f; {var x;} var e = ^ var g}}''');
|
| computeFast();
|
| return computeFull(true).then((_) {
|
| - assertNoSuggestions();
|
| + assertSuggestImportedClass('X');
|
| + assertNotSuggested('_B');
|
| + assertSuggestLocalClass('Y');
|
| + assertSuggestLocalClass('C');
|
| + assertSuggestLocalVariable('f', null);
|
| + assertNotSuggested('x');
|
| + assertNotSuggested('e');
|
| });
|
| }
|
| -
|
| -// test_ConditionalExpression() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_FunctionExpression() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_FunctionExpressionInvocation() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_Identifier() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_IndexExpression() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_InstanceCreationExpression() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_Literal() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_MethodInvocation() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_NamedExpression() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_ParenthesizedExpression() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_PostfixExpression() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_PrefixedIdentifier() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_PrefixedExpression() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_PropertyAccess() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_RethrowExpression() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_SuperExpression() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_ThisExpression() {
|
| -// fail('not implemented yet');
|
| -// }
|
| -//
|
| -// test_ThrowExpression() {
|
| -// fail('not implemented yet');
|
| -// }
|
| }
|
|
|