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

Side by Side Diff: pkg/analysis_server/test/services/completion/completion_target_test.dart

Issue 2679503002: suggest method references in named expressions (Closed)
Patch Set: merge Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.services.completion.target; 5 library test.services.completion.target;
6 6
7 import 'package:analysis_server/src/provisional/completion/dart/completion_targe t.dart'; 7 import 'package:analysis_server/src/provisional/completion/dart/completion_targe t.dart';
8 import 'package:analyzer/dart/ast/ast.dart'; 8 import 'package:analyzer/dart/ast/ast.dart';
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:test/test.dart'; 10 import 'package:test/test.dart';
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 addTestSource('main() {new Foo(a,^)}'); 67 addTestSource('main() {new Foo(a,^)}');
68 assertTarget(')', '(a)', argIndex: 1); 68 assertTarget(')', '(a)', argIndex: 1);
69 } 69 }
70 70
71 test_ArgumentList_InstanceCreationExpression_functionArg2() { 71 test_ArgumentList_InstanceCreationExpression_functionArg2() {
72 // ArgumentList InstanceCreationExpression Block 72 // ArgumentList InstanceCreationExpression Block
73 addTestSource('main() {new B(^)} class B{B(f()){}}'); 73 addTestSource('main() {new B(^)} class B{B(f()){}}');
74 assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true); 74 assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true);
75 } 75 }
76 76
77 test_ArgumentList_InstanceCreationExpression_functionArg3() {
78 // ArgumentList InstanceCreationExpression Block
79 addTestSource('main() {new B(1, f: ^)} class B{B(int i, {f()}){}}');
80 assertTarget('', 'f: ', argIndex: 1, isFunctionalArgument: true);
81 }
82
77 test_ArgumentList_MethodInvocation() { 83 test_ArgumentList_MethodInvocation() {
78 // ArgumentList MethodInvocation Block 84 // ArgumentList MethodInvocation Block
79 addTestSource('main() {foo(^)}'); 85 addTestSource('main() {foo(^)}');
80 assertTarget(')', '()', argIndex: 0); 86 assertTarget(')', '()', argIndex: 0);
81 } 87 }
82 88
83 test_ArgumentList_MethodInvocation2() { 89 test_ArgumentList_MethodInvocation2() {
84 // ArgumentList MethodInvocation Block 90 // ArgumentList MethodInvocation Block
85 addTestSource('main() {foo(^n)}'); 91 addTestSource('main() {foo(^n)}');
86 assertTarget('n', '(n)', argIndex: 0); 92 assertTarget('n', '(n)', argIndex: 0);
(...skipping 22 matching lines...) Expand all
109 addTestSource('main() {foo(^)} foo(f()) {}'); 115 addTestSource('main() {foo(^)} foo(f()) {}');
110 assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true); 116 assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true);
111 } 117 }
112 118
113 test_ArgumentList_MethodInvocation_functionArg2() { 119 test_ArgumentList_MethodInvocation_functionArg2() {
114 // ArgumentList MethodInvocation Block 120 // ArgumentList MethodInvocation Block
115 addTestSource('main() {new B().boo(^)} class B{boo(f()){}}'); 121 addTestSource('main() {new B().boo(^)} class B{boo(f()){}}');
116 assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true); 122 assertTarget(')', '()', argIndex: 0, isFunctionalArgument: true);
117 } 123 }
118 124
125 test_ArgumentList_MethodInvocation_functionArg3() {
126 // ArgumentList MethodInvocation Block
127 addTestSource('main() {foo(f: ^)} foo({f()}) {}');
128 assertTarget('', 'f: ', argIndex: 0, isFunctionalArgument: true);
129 }
130
131 test_ArgumentList_MethodInvocation_functionArg4() {
132 // ArgumentList MethodInvocation Block
133 addTestSource('main() {new B().boo(f: ^)} class B{boo({f()}){}}');
134 assertTarget('', 'f: ', argIndex: 0, isFunctionalArgument: true);
135 }
136
119 test_AsExpression_identifier() { 137 test_AsExpression_identifier() {
120 // SimpleIdentifier TypeName AsExpression 138 // SimpleIdentifier TypeName AsExpression
121 addTestSource('class A {var b; X _c; foo() {var a; (a^ as String).foo();}'); 139 addTestSource('class A {var b; X _c; foo() {var a; (a^ as String).foo();}');
122 assertTarget('a as String', '(a as String)'); 140 assertTarget('a as String', '(a as String)');
123 } 141 }
124 142
125 test_AsExpression_keyword() { 143 test_AsExpression_keyword() {
126 // SimpleIdentifier TypeName AsExpression 144 // SimpleIdentifier TypeName AsExpression
127 addTestSource('class A {var b; X _c; foo() {var a; (a ^as String).foo();}'); 145 addTestSource('class A {var b; X _c; foo() {var a; (a ^as String).foo();}');
128 assertTarget('as', 'a as String'); 146 assertTarget('as', 'a as String');
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 addTestSource('main() {int b^ = 1;}'); 581 addTestSource('main() {int b^ = 1;}');
564 assertTarget('b = 1', 'int b = 1'); 582 assertTarget('b = 1', 'int b = 1');
565 } 583 }
566 584
567 test_VariableDeclaration_lhs_identifier_before() { 585 test_VariableDeclaration_lhs_identifier_before() {
568 // VariableDeclaration VariableDeclarationList 586 // VariableDeclaration VariableDeclarationList
569 addTestSource('main() {int ^b = 1;}'); 587 addTestSource('main() {int ^b = 1;}');
570 assertTarget('b = 1', 'int b = 1'); 588 assertTarget('b = 1', 'int b = 1');
571 } 589 }
572 } 590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698