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

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

Issue 965753003: fix invocation completion with trailing stmt (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 10 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/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 6db05c48f70340931ecb814259cdd75604e3e428..f5581d7b02ec59af7337082e719311658b6d08e9 100644
--- a/pkg/analysis_server/test/services/completion/completion_test_util.dart
+++ b/pkg/analysis_server/test/services/completion/completion_test_util.dart
@@ -2082,7 +2082,6 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
expect(request.replacementOffset, completionOffset);
expect(request.replacementLength, 0);
assertSuggestInvocationMethod('toString', 'Object', 'String');
- //TODO (danrubel) type for '_c' should be 'X' not null
assertNotSuggested('Object');
assertNotSuggested('A');
assertNotSuggested('==');
@@ -2806,6 +2805,105 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
});
}
+ test_PrefixedIdentifier_trailingStmt_const() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('const String g = "hello"; f() {g.^ int y = 0;}');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestInvocationGetter('length', 'int');
+ });
+ }
+
+ test_PrefixedIdentifier_trailingStmt_field() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('class A {String g; f() {g.^ int y = 0;}}');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestInvocationGetter('length', 'int');
+ });
+ }
+
+ test_PrefixedIdentifier_trailingStmt_function() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('String g() => "one"; f() {g.^ int y = 0;}');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestInvocationGetter('length', 'int');
+ });
+ }
+
+ test_PrefixedIdentifier_trailingStmt_functionTypeAlias() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('typedef String g(); f() {g.^ int y = 0;}');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestInvocationGetter('length', 'int');
+ });
+ }
+
+ test_PrefixedIdentifier_trailingStmt_getter() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('String get g => "one"; f() {g.^ int y = 0;}');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestInvocationGetter('length', 'int');
+ });
+ }
+
+ test_PrefixedIdentifier_trailingStmt_local_typed() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('f() {String g; g.^ int y = 0;}');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestInvocationGetter('length', 'int');
+ });
+ }
+
+ test_PrefixedIdentifier_trailingStmt_local_untyped() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('f() {var g = "hello"; g.^ int y = 0;}');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestInvocationGetter('length', 'int');
+ });
+ }
+
+ test_PrefixedIdentifier_trailingStmt_method() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('class A {String g() {}; f() {g.^ int y = 0;}}');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestInvocationGetter('length', 'int');
+ });
+ }
+
+ test_PrefixedIdentifier_trailingStmt_param() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('class A {f(String g) {g.^ int y = 0;}}');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestInvocationGetter('length', 'int');
+ });
+ }
+
+ test_PrefixedIdentifier_trailingStmt_param2() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('f(String g) {g.^ int y = 0;}');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestInvocationGetter('length', 'int');
+ });
+ }
+
+ test_PrefixedIdentifier_trailingStmt_topLevelVar() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('String g; f() {g.^ int y = 0;}');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestInvocationGetter('length', 'int');
+ });
+ }
+
test_PropertyAccess_expression() {
// SimpleIdentifier MethodInvocation PropertyAccess ExpressionStatement
addTestSource('class A {a() {"hello".to^String().length}}');

Powered by Google App Engine
This is Rietveld 408576698