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

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

Issue 658053002: filter void methods when suggesting 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/lib/src/services/completion/local_computer.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/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 1174254c4019d5129175f85ba2e3c6549481c380..b7101ca91d4e250c817223a2a33b6ef343fa47ea 100644
--- a/pkg/analysis_server/test/services/completion/completion_test_util.dart
+++ b/pkg/analysis_server/test/services/completion/completion_test_util.dart
@@ -962,12 +962,15 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
class _B { }''');
addTestSource('''
import "/testA.dart";
- class C {foo(){O^}}''');
+ class C {foo(){O^} void bar() {}}''');
computeFast();
return computeFull(true).then((_) {
assertSuggestImportedClass('A');
assertSuggestImportedFunction('F1', '_B', false);
assertSuggestLocalClass('C');
+ assertSuggestLocalMethod('foo', 'C', null);
+ assertSuggestLocalMethod('bar', 'C', 'void');
+ assertSuggestLocalClass('C');
assertNotSuggested('x');
assertNotSuggested('_B');
});
@@ -1074,22 +1077,29 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
test_ForStatement_updaters_prefix_expression() {
// SimpleIdentifier PrefixExpression ForStatement
- addTestSource('main() {for (int index = 0; index < 10; ++i^)}');
+ addTestSource('''
+ void bar() { }
+ main() {for (int index = 0; index < 10; ++i^)}''');
computeFast();
return computeFull(true).then((_) {
assertSuggestLocalVariable('index', 'int');
+ assertSuggestLocalFunction('main', null);
+ assertNotSuggested('bar');
});
}
test_FunctionExpression_body_function() {
// Block BlockFunctionBody FunctionExpression
- addTestSource('String foo(List args) {x.then((R b) {^});}');
+ addTestSource('''
+ void bar() { }
+ String foo(List args) {x.then((R b) {^});}''');
computeFast();
return computeFull(true).then((_) {
var f = assertSuggestLocalFunction('foo', 'String', false);
if (f != null) {
expect(f.element.isPrivate, isFalse);
}
+ assertSuggestLocalFunction('bar', 'void');
assertSuggestParameter('args', 'List');
assertSuggestParameter('b', 'R');
assertSuggestImportedClass('Object');
@@ -1215,12 +1225,16 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
test_IsExpression_target() {
// IfStatement Block BlockFunctionBody
addTestSource('''
+ foo() { }
+ void bar() { }
class A {int x; int y() => 0;}
main(){var a; if (^ is A)}''');
computeFast();
return computeFull(true).then((_) {
assertSuggestLocalVariable('a', null);
assertSuggestLocalFunction('main', null);
+ assertSuggestLocalFunction('foo', null);
+ assertNotSuggested('bar');
assertSuggestLocalClass('A');
assertSuggestImportedClass('Object');
});
@@ -1314,9 +1328,14 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
test_MethodDeclaration_parameters_positional() {
// Block BlockFunctionBody MethodDeclaration
- addTestSource('class A {Z a(X x, [int y=1]) {^}}');
+ addTestSource('''
+ foo() { }
+ void bar() { }
+ class A {Z a(X x, [int y=1]) {^}}''');
computeFast();
return computeFull(true).then((_) {
+ assertSuggestLocalFunction('foo', null);
+ assertSuggestLocalFunction('bar', 'void');
assertSuggestLocalMethod('a', 'A', 'Z');
assertSuggestParameter('x', 'X');
assertSuggestParameter('y', 'int');
@@ -1456,7 +1475,6 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
computeFast();
return computeFull(true).then((_) {
assertSuggestInvocationGetter('length', 'int');
- assertNotSuggested('==');
assertNotSuggested('A');
assertNotSuggested('a');
assertNotSuggested('Object');
@@ -1544,16 +1562,23 @@ class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
// VariableDeclarationStatement
addSource('/testB.dart', '''
lib B;
- foo() { }
+ foo1() { }
+ void bar1() { }
class _B { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "/testB.dart";
+ foo2() { }
+ void bar2() { }
class Y {Y.c(); Y._d(); z() {}}
class C {bar(){var f; {var x;} var e = ^ var g}}''');
computeFast();
return computeFull(true).then((_) {
assertSuggestImportedClass('X');
+ assertSuggestImportedFunction('foo1', null);
+ assertNotSuggested('bar1');
+ assertSuggestLocalFunction('foo2', null);
+ assertNotSuggested('bar2');
assertNotSuggested('_B');
assertSuggestLocalClass('Y');
assertSuggestLocalClass('C');
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/local_computer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698