Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1076)

Unified Diff: pkg/analysis_server/test/services/completion/local_computer_test.dart

Issue 626303002: filter undesired suggestions from prefix expression (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/test/services/completion/imported_computer_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/completion/local_computer_test.dart
diff --git a/pkg/analysis_server/test/services/completion/local_computer_test.dart b/pkg/analysis_server/test/services/completion/local_computer_test.dart
index 19f1b0a7e8a8dee8feff7e09027c228248a6ec01..8c7a446cb14250ef4063c6cbaf1449679a0ed61f 100644
--- a/pkg/analysis_server/test/services/completion/local_computer_test.dart
+++ b/pkg/analysis_server/test/services/completion/local_computer_test.dart
@@ -124,6 +124,27 @@ class LocalComputerTest extends AbstractCompletionTest {
assertSuggestLocalVariable('i', 'int');
}
+ test_ForStatement_condition() {
+ // SimpleIdentifier ForStatement
+ addTestSource('main() {for (int index = 0; i^)}');
+ expect(computeFast(), isTrue);
+ assertSuggestLocalVariable('index', 'int');
+ }
+
+ test_ForStatement_updaters() {
+ // SimpleIdentifier ForStatement
+ addTestSource('main() {for (int index = 0; index < 10; i^)}');
+ expect(computeFast(), isTrue);
+ assertSuggestLocalVariable('index', 'int');
+ }
+
+ test_ForStatement_updaters_prefix_expression() {
+ // SimpleIdentifier PrefixExpression ForStatement
+ addTestSource('main() {for (int index = 0; index < 10; ++i^)}');
+ expect(computeFast(), isTrue);
+ assertSuggestLocalVariable('index', 'int');
+ }
+
test_FunctionExpression_body_function() {
// Block BlockFunctionBody FunctionExpression
addTestSource('String foo(List args) {x.then((R b) {^});}');
@@ -148,6 +169,20 @@ class LocalComputerTest extends AbstractCompletionTest {
assertNotSuggested('x');
}
+ test_InterpolationExpression() {
+ // SimpleIdentifier InterpolationExpression StringInterpolation
+ addTestSource('main() {String name; print("hello \$^");}');
+ expect(computeFast(), isTrue);
+ assertSuggestLocalVariable('name', 'String');
+ }
+
+ test_InterpolationExpression_block() {
+ // SimpleIdentifier InterpolationExpression StringInterpolation
+ addTestSource('main() {String name; print("hello \${n^}");}');
+ expect(computeFast(), isTrue);
+ assertSuggestLocalVariable('name', 'String');
+ }
+
test_MethodDeclaration_body_getters() {
// Block BlockFunctionBody MethodDeclaration
addTestSource('class A {@deprecated X get f => 0; Z a() {^} get _g => 1;}');
@@ -198,6 +233,35 @@ class LocalComputerTest extends AbstractCompletionTest {
assertSuggestParameter('y', 'int');
}
+ test_PrefixedIdentifier() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('''
+ class A {var b; X _c;}
+ class X{}
+ main() {A a; a.^}''');
+ expect(computeFast(), isTrue);
+ // PrefixedIdentifier is handled by InvocationComputer
+ assertNotSuggested('b');
+ assertNotSuggested('_c');
+ }
+
+ test_PrefixedIdentifier_interpolation() {
+ // SimpleIdentifier PrefixedIdentifier InterpolationExpression
+ addTestSource('main() {String name; print("hello \${name.^}");}');
+ expect(computeFast(), isTrue);
+ // InvocationComputer creates suggestions for prefixed identifiers
+ assertNotSuggested('name');
+ assertNotSuggested('length');
+ }
+
+ test_PrefixedIdentifier_prefix() {
+ // SimpleIdentifier PrefixedIdentifier InterpolationExpression
+ addTestSource('main() {String name; print("hello \${nam^e.length}");}');
+ expect(computeFast(), isTrue);
+ assertSuggestLocalVariable('name', 'String');
+ assertNotSuggested('length');
+ }
+
test_TopLevelVariableDeclaration_typed_name() {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// TopLevelVariableDeclaration
@@ -225,8 +289,8 @@ class LocalComputerTest extends AbstractCompletionTest {
}
test_VariableDeclaration_RHS() {
-
- // VariableDeclaration VariableDeclarationList VariableDeclarationStatement
+ // VariableDeclaration VariableDeclarationList
+ // VariableDeclarationStatement
addTestSource('class A {a() {var f; {var x;} var e = ^ var g;}}');
expect(computeFast(), isTrue);
assertSuggestClass('A');
« no previous file with comments | « pkg/analysis_server/test/services/completion/imported_computer_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698