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

Side by Side Diff: pkg/analysis_server/test/completion_test.dart

Issue 803913003: fix named constructor completion (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | Annotate | Revision Log
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.completion.support; 5 library test.completion.support;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'completion_test_support.dart'; 9 import 'completion_test_support.dart';
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 failingTests: '1'); 114 failingTests: '1');
115 115
116 CompletionTestCase.buildTests('testCommentSnippets022', ''' 116 CompletionTestCase.buildTests('testCommentSnippets022', '''
117 class Map{}class F{m(){new !1;}}''', <String>["1+Map"], failingTests: '1'); 117 class Map{}class F{m(){new !1;}}''', <String>["1+Map"], failingTests: '1');
118 118
119 CompletionTestCase.buildTests('testCommentSnippets022a', ''' 119 CompletionTestCase.buildTests('testCommentSnippets022a', '''
120 class Map{}class F{m(){new !1''', <String>["1+Map"], failingTests: '1'); 120 class Map{}class F{m(){new !1''', <String>["1+Map"], failingTests: '1');
121 121
122 CompletionTestCase.buildTests('testCommentSnippets022b', ''' 122 CompletionTestCase.buildTests('testCommentSnippets022b', '''
123 class Map{factory Map.qq(){return null;}}class F{m(){new Map.!1qq();}}''', 123 class Map{factory Map.qq(){return null;}}class F{m(){new Map.!1qq();}}''',
124 <String>["1+qq"], 124 <String>["1+qq"]);
125 failingTests: '1');
126 125
127 CompletionTestCase.buildTests('testCommentSnippets023', ''' 126 CompletionTestCase.buildTests('testCommentSnippets023', '''
128 class X {X c; X(this.!1c!3) : super() {c.!2}}''', 127 class X {X c; X(this.!1c!3) : super() {c.!2}}''',
129 <String>["1+c", "2+c", "3+c"]); 128 <String>["1+c", "2+c", "3+c"]);
130 129
131 CompletionTestCase.buildTests('testCommentSnippets024', ''' 130 CompletionTestCase.buildTests('testCommentSnippets024', '''
132 class q {m(Map q){var x;m(!1)}n(){var x;n(!2)}}''', <String>["1+x", "2+x"]); 131 class q {m(Map q){var x;m(!1)}n(){var x;n(!2)}}''', <String>["1+x", "2+x"]);
133 132
134 CompletionTestCase.buildTests('testCommentSnippets025', ''' 133 CompletionTestCase.buildTests('testCommentSnippets025', '''
135 class q {num m() {var q; num x=!1 q!3 + !2/**/;}}''', 134 class q {num m() {var q; num x=!1 q!3 + !2/**/;}}''',
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // Type propagation 174 // Type propagation
176 CompletionTestCase.buildTests('testCommentSnippets035', ''' 175 CompletionTestCase.buildTests('testCommentSnippets035', '''
177 class List{clear(){}length(){}}t3() {var x=new List(), y=x.!1length();x.!2clear( );}''', 176 class List{clear(){}length(){}}t3() {var x=new List(), y=x.!1length();x.!2clear( );}''',
178 <String>["1+length", "2+clear"]); 177 <String>["1+length", "2+clear"]);
179 178
180 CompletionTestCase.buildTests('testCommentSnippets036', ''' 179 CompletionTestCase.buildTests('testCommentSnippets036', '''
181 class List{}t3() {var x=new List!1}''', <String>["1+List"], failingTests: '1'); 180 class List{}t3() {var x=new List!1}''', <String>["1+List"], failingTests: '1');
182 181
183 CompletionTestCase.buildTests('testCommentSnippets037', ''' 182 CompletionTestCase.buildTests('testCommentSnippets037', '''
184 class List{factory List.from(){}}t3() {var x=new List.!1}''', 183 class List{factory List.from(){}}t3() {var x=new List.!1}''',
185 <String>["1+from"], 184 <String>["1+from"]);
186 failingTests: '1');
187 185
188 CompletionTestCase.buildTests('testCommentSnippets038', ''' 186 CompletionTestCase.buildTests('testCommentSnippets038', '''
189 f(){int xa; String s = '\$x!1';}''', <String>["1+xa"]); 187 f(){int xa; String s = '\$x!1';}''', <String>["1+xa"]);
190 188
191 CompletionTestCase.buildTests('testCommentSnippets038a', ''' 189 CompletionTestCase.buildTests('testCommentSnippets038a', '''
192 int xa; String s = '\$x!1\'''', <String>["1+xa"]); 190 int xa; String s = '\$x!1\'''', <String>["1+xa"]);
193 191
194 CompletionTestCase.buildTests('testCommentSnippets039', ''' 192 CompletionTestCase.buildTests('testCommentSnippets039', '''
195 f(){int xa; String s = '\$!1';}''', <String>["1+xa"]); 193 f(){int xa; String s = '\$!1';}''', <String>["1+xa"]);
196 194
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 "1+xdr", 254 "1+xdr",
257 "1+xa", 255 "1+xa",
258 "1+xdr.a", 256 "1+xdr.a",
259 "1+xdr.b", 257 "1+xdr.b",
260 "2-xa", 258 "2-xa",
261 "2-xdr", 259 "2-xdr",
262 "2+xdr.a", 260 "2+xdr.a",
263 "2-xdr.b", 261 "2-xdr.b",
264 "3-b", 262 "3-b",
265 "3+a"], 263 "3+a"],
266 failingTests: '123'); 264 failingTests: '12');
267 265
268 // Type propagation. 266 // Type propagation.
269 CompletionTestCase.buildTests('testCommentSnippets051', ''' 267 CompletionTestCase.buildTests('testCommentSnippets051', '''
270 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}} 268 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}}
271 void r() { 269 void r() {
272 var v; 270 var v;
273 if (v is String) { 271 if (v is String) {
274 v.!1length; 272 v.!1length;
275 v.!2getKeys; 273 v.!2getKeys;
276 } 274 }
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 1410
1413 CompletionTestCase.buildTests( 1411 CompletionTestCase.buildTests(
1414 'testCompletion_privateElement_sameLibrary_constructor', 1412 'testCompletion_privateElement_sameLibrary_constructor',
1415 ''' 1413 '''
1416 class A { 1414 class A {
1417 A._c(); 1415 A._c();
1418 A.c(); 1416 A.c();
1419 } 1417 }
1420 main() { 1418 main() {
1421 new A.!1 1419 new A.!1
1422 }''', <String>["1+_c", "1+c"], failingTests: '1'); 1420 }''', <String>["1+_c", "1+c"]);
1423 1421
1424 CompletionTestCase.buildTests( 1422 CompletionTestCase.buildTests(
1425 'testCompletion_privateElement_sameLibrary_member', 1423 'testCompletion_privateElement_sameLibrary_member',
1426 ''' 1424 '''
1427 class A { 1425 class A {
1428 _m() {} 1426 _m() {}
1429 m() {} 1427 m() {}
1430 } 1428 }
1431 main(A a) { 1429 main(A a) {
1432 a.!1 1430 a.!1
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 int b() => this.!1a(); 1874 int b() => this.!1a();
1877 }''', <String>["1+a"]); 1875 }''', <String>["1+a"]);
1878 1876
1879 CompletionTestCase.buildTests('test004', ''' 1877 CompletionTestCase.buildTests('test004', '''
1880 class A { 1878 class A {
1881 int x; 1879 int x;
1882 A() : this.!1x = 1; 1880 A() : this.!1x = 1;
1883 A.b() : this(); 1881 A.b() : this();
1884 A.c() : this.!2b(); 1882 A.c() : this.!2b();
1885 g() => new A.!3c(); 1883 g() => new A.!3c();
1886 }''', <String>["1+x", "2+b", "3+c"], failingTests: '23'); 1884 }''', <String>["1+x", "2+b", "3+c"], failingTests: '2');
1887 1885
1888 CompletionTestCase.buildTests('test005', ''' 1886 CompletionTestCase.buildTests('test005', '''
1889 class A {} 1887 class A {}
1890 void rr(var vim) { 1888 void rr(var vim) {
1891 var !1vq = v!2.toString(); 1889 var !1vq = v!2.toString();
1892 var vf; 1890 var vf;
1893 v!3.toString(); 1891 v!3.toString();
1894 }''', 1892 }''',
1895 <String>[ 1893 <String>[
1896 "1-A", 1894 "1-A",
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 } 2171 }
2174 }''', <String>["1+getKeys", "2+getKeys"]); 2172 }''', <String>["1+getKeys", "2+getKeys"]);
2175 2173
2176 // Note lack of semicolon following completion location 2174 // Note lack of semicolon following completion location
2177 CompletionTestCase.buildTests('test024', ''' 2175 CompletionTestCase.buildTests('test024', '''
2178 class List{factory List.from(Iterable other) {}} 2176 class List{factory List.from(Iterable other) {}}
2179 class F { 2177 class F {
2180 f() { 2178 f() {
2181 new List.!1 2179 new List.!1
2182 } 2180 }
2183 }''', <String>["1+from"], failingTests: '1'); 2181 }''', <String>["1+from"]);
2184 2182
2185 CompletionTestCase.buildTests('test025', ''' 2183 CompletionTestCase.buildTests('test025', '''
2186 class R { 2184 class R {
2187 static R _m; 2185 static R _m;
2188 static R m; 2186 static R m;
2189 f() { 2187 f() {
2190 var a = !1m; 2188 var a = !1m;
2191 var b = _!2m; 2189 var b = _!2m;
2192 var c = !3g(); 2190 var c = !3g();
2193 } 2191 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2401 'test_classMembers_inGetter', 2399 'test_classMembers_inGetter',
2402 '''class A { var fff; get z {ff!1}}''', 2400 '''class A { var fff; get z {ff!1}}''',
2403 <String>["1+fff"]); 2401 <String>["1+fff"]);
2404 2402
2405 CompletionTestCase.buildTests( 2403 CompletionTestCase.buildTests(
2406 'testSingle', 2404 'testSingle',
2407 '''class A {int x; !2mth() {int y = this.x;}}class B{}''', 2405 '''class A {int x; !2mth() {int y = this.x;}}class B{}''',
2408 <String>["2+B"]); 2406 <String>["2+B"]);
2409 } 2407 }
2410 } 2408 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698