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

Unified Diff: pkg/analysis_server/test/services/completion/imported_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
Index: pkg/analysis_server/test/services/completion/imported_computer_test.dart
diff --git a/pkg/analysis_server/test/services/completion/imported_computer_test.dart b/pkg/analysis_server/test/services/completion/imported_computer_test.dart
index f5cdf45dfd607f98c7bf650db7be36fb74326946..7934201135880601e3d9c077b030883ea87b3a9a 100644
--- a/pkg/analysis_server/test/services/completion/imported_computer_test.dart
+++ b/pkg/analysis_server/test/services/completion/imported_computer_test.dart
@@ -67,21 +67,8 @@ class ImportedTypeComputerTest extends AbstractCompletionTest {
});
}
- test_PrefixedIdentifier() {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('''
- class A {var b; X _c;}
- class X{}
- main() {A a; a.^}''');
- return computeFull(true).then((_) {
- // PrefixedIdentifier is handled by InvocationComputer
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('Object');
- });
- }
-
test_Block_function() {
+ // Block BlockFunctionBody MethodDeclaration ClassDeclaration
addSource('/testA.dart', '''
export "dart:math" hide max;
@deprecated A() {int x;}
@@ -98,6 +85,7 @@ class ImportedTypeComputerTest extends AbstractCompletionTest {
// Should not suggest compilation unit elements
// which are returned by the LocalComputer
assertNotSuggested('X');
+ assertNotSuggested('foo');
});
}
@@ -118,6 +106,9 @@ class ImportedTypeComputerTest extends AbstractCompletionTest {
assertNotSuggested('_T2');
assertSuggestTopLevelVar('T3', 'int', CompletionRelevance.LOW);
assertNotSuggested('_T4');
+ // LocalComputer provides local suggestions
+ assertNotSuggested('C');
+ assertNotSuggested('foo');
});
}
@@ -213,6 +204,41 @@ class ImportedTypeComputerTest extends AbstractCompletionTest {
});
}
+ test_PrefixedIdentifier() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addSource('/testA.dart', '''
+ class A() {int x;}
+ _B() {}''');
+ addTestSource('''
+ import "/testA.dart";
+ class X {foo(){A a; a.^}}''');
+ return computeFull().then((_) {
+ // InvocationComputer provides suggestions for prefixed expressions
+ assertNotSuggested('A');
+ assertNotSuggested('x');
+ assertNotSuggested('X');
+ assertNotSuggested('Object');
+ });
+ }
+
+ test_PrefixedIdentifier_prefix() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addSource('/testA.dart', '''
+ class A {static int bar = 10;}
+ _B() {}''');
+ addTestSource('''
+ import "/testA.dart";
+ class X {foo(){A^.bar}}''');
+ return computeFull().then((_) {
+ // InvocationComputer provides suggestions for prefixed expressions
+ assertSuggestClass('A');
+ assertNotSuggested('bar');
+ assertNotSuggested('_B');
+ assertNotSuggested('X');
+ assertNotSuggested('foo');
+ });
+ }
+
test_ShowCombinator_class() {
// SimpleIdentifier ShowCombinator ImportDirective
addSource('/testAB.dart', '''

Powered by Google App Engine
This is Rietveld 408576698