OLD | NEW |
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:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
11 | 11 |
12 import 'completion_test_support.dart'; | 12 import 'completion_test_support.dart'; |
| 13 import 'utils.dart'; |
| 14 |
| 15 main() { |
| 16 initializeTestEnvironment(); |
| 17 CompletionTestBuilder builder = new CompletionTestBuilder(); |
| 18 builder.buildAll(); |
| 19 } |
13 | 20 |
14 /** | 21 /** |
15 * Assigning the name of a single test to this string causes just that test to | 22 * Assigning the name of a single test to this string causes just that test to |
16 * be run. Assigning null to this string causes all tests to be run. | 23 * be run. Assigning null to this string causes all tests to be run. |
17 */ | 24 */ |
18 const String SOLO_TEST = null; | 25 const String SOLO_TEST = null; |
19 | 26 |
20 main() { | |
21 CompletionTestBuilder builder = new CompletionTestBuilder(); | |
22 builder.buildAll(); | |
23 } | |
24 | |
25 /** | 27 /** |
26 * Type of functions used to create tests. | 28 * Type of functions used to create tests. |
27 */ | 29 */ |
28 typedef void _Tester(String spec, TestFunction body); | 30 typedef void _Tester(String spec, TestFunction body); |
29 | 31 |
30 /** | 32 /** |
31 * A builder that builds the completion tests. | 33 * A builder that builds the completion tests. |
32 */ | 34 */ |
33 class CompletionTestBuilder { | 35 class CompletionTestBuilder { |
34 /** | 36 /** |
(...skipping 11 matching lines...) Expand all Loading... |
46 buildCommentSnippetTests(); | 48 buildCommentSnippetTests(); |
47 buildCompletionTests(); | 49 buildCompletionTests(); |
48 buildOtherTests(); | 50 buildOtherTests(); |
49 buildLibraryTests(); | 51 buildLibraryTests(); |
50 int testCount = expectedPassCount + expectedFailCount; | 52 int testCount = expectedPassCount + expectedFailCount; |
51 print( | 53 print( |
52 'Total $testCount tests, of which $expectedFailCount are expected to fai
l.'); | 54 'Total $testCount tests, of which $expectedFailCount are expected to fai
l.'); |
53 } | 55 } |
54 | 56 |
55 void buildCommentSnippetTests() { | 57 void buildCommentSnippetTests() { |
56 buildTests('testCommentSnippets001', ''' | 58 buildTests( |
| 59 'testCommentSnippets001', |
| 60 ''' |
57 class X {static final num MAX = 0;num yc,xc;mth() {xc = yc = MA!1X;x!2c.abs();nu
m f = M!3AX;}}''', | 61 class X {static final num MAX = 0;num yc,xc;mth() {xc = yc = MA!1X;x!2c.abs();nu
m f = M!3AX;}}''', |
58 <String>["1+MAX", "2+xc", "3+MAX"]); | 62 <String>["1+MAX", "2+xc", "3+MAX"]); |
59 | 63 |
60 buildTests('testCommentSnippets002', ''' | 64 buildTests( |
| 65 'testCommentSnippets002', |
| 66 ''' |
61 class Y {String x='hi';mth() {x.l!1ength;int n = 0;x!2.codeUnitAt(n!3);}}''', | 67 class Y {String x='hi';mth() {x.l!1ength;int n = 0;x!2.codeUnitAt(n!3);}}''', |
62 <String>["1+length", "2+x", "3+n"]); | 68 <String>["1+length", "2+x", "3+n"]); |
63 | 69 |
64 buildTests('testCommentSnippets004', ''' | 70 buildTests( |
| 71 'testCommentSnippets004', |
| 72 ''' |
65 class A {!1int x; !2mth() {!3int y = this.!5x!6;}}class B{}''', | 73 class A {!1int x; !2mth() {!3int y = this.!5x!6;}}class B{}''', |
66 <String>["1+A", "2+B", "3+x", "3-y", "5+mth", "6+x"]); | 74 <String>["1+A", "2+B", "3+x", "3-y", "5+mth", "6+x"]); |
67 | 75 |
68 buildTests('testCommentSnippets005', ''' | 76 buildTests( |
| 77 'testCommentSnippets005', |
| 78 ''' |
69 class Date { static Date JUN, JUL;}class X { m() { return Da!1te.JU!2L; }}''', | 79 class Date { static Date JUN, JUL;}class X { m() { return Da!1te.JU!2L; }}''', |
70 <String>["1+Date", "2+JUN", "2+JUL"]); | 80 <String>["1+Date", "2+JUN", "2+JUL"]); |
71 | 81 |
72 buildTests('testCommentSnippets007', ''' | 82 buildTests( |
| 83 'testCommentSnippets007', |
| 84 ''' |
73 class C {mth(Map x, !1) {}mtf(!2, Map x) {}m() {for (in!3t i=0; i<5; i++); A!4 x
;}}class int{}class Arrays{}''', | 85 class C {mth(Map x, !1) {}mtf(!2, Map x) {}m() {for (in!3t i=0; i<5; i++); A!4 x
;}}class int{}class Arrays{}''', |
74 <String>["1+bool", "2+bool", "3+int", "4+Arrays"]); | 86 <String>["1+bool", "2+bool", "3+int", "4+Arrays"]); |
75 | 87 |
76 buildTests('testCommentSnippets008', ''' | 88 buildTests( |
77 class Date{}final num M = Dat!1''', <String>["1+Date"]); | 89 'testCommentSnippets008', |
| 90 ''' |
| 91 class Date{}final num M = Dat!1''', |
| 92 <String>["1+Date"]); |
78 | 93 |
79 // space, char, eol are important | 94 // space, char, eol are important |
80 buildTests('testCommentSnippets009', ''' | 95 buildTests( |
81 class Maps{}class x extends!5 !2M!3 !4implements!6 !1\n{}''', <String>[ | 96 'testCommentSnippets009', |
82 "1+Map", | 97 ''' |
83 "2+Maps", | 98 class Maps{}class x extends!5 !2M!3 !4implements!6 !1\n{}''', |
84 "3+Maps", | 99 <String>[ |
85 "4-Maps", | 100 "1+Map", |
86 "4+implements", | 101 "2+Maps", |
87 "5-Maps", | 102 "3+Maps", |
88 "6-Map", | 103 "4-Maps", |
89 "6+implements" | 104 "4+implements", |
90 ], failingTests: '46'); | 105 "5-Maps", |
| 106 "6-Map", |
| 107 "6+implements" |
| 108 ], |
| 109 failingTests: '46'); |
91 | 110 |
92 // space, char, eol are important | 111 // space, char, eol are important |
93 buildTests('testCommentSnippets010', ''' | 112 buildTests( |
94 class x implements !1{}''', <String>["1+Map"]); | 113 'testCommentSnippets010', |
| 114 ''' |
| 115 class x implements !1{}''', |
| 116 <String>["1+Map"]); |
95 | 117 |
96 // space, char, eol are important | 118 // space, char, eol are important |
97 buildTests('testCommentSnippets011', ''' | 119 buildTests( |
98 class x implements M!1{}''', <String>["1+Map"]); | 120 'testCommentSnippets011', |
| 121 ''' |
| 122 class x implements M!1{}''', |
| 123 <String>["1+Map"]); |
99 | 124 |
100 // space, char, eol are important | 125 // space, char, eol are important |
101 buildTests('testCommentSnippets012', ''' | 126 buildTests( |
102 class x implements M!1\n{}''', <String>["1+Map"]); | 127 'testCommentSnippets012', |
103 | 128 ''' |
104 buildTests('testCommentSnippets013', ''' | 129 class x implements M!1\n{}''', |
105 class x !2{!1}!3''', <String>["1+num", "2-num", "3+num"]); | 130 <String>["1+Map"]); |
| 131 |
| 132 buildTests( |
| 133 'testCommentSnippets013', |
| 134 ''' |
| 135 class x !2{!1}!3''', |
| 136 <String>["1+num", "2-num", "3+num"]); |
106 | 137 |
107 // trailing space is important | 138 // trailing space is important |
108 buildTests('testCommentSnippets014', ''' | 139 buildTests( |
109 typedef n!1 ;''', <String>["1+num"]); | 140 'testCommentSnippets014', |
110 | 141 ''' |
111 buildTests('testCommentSnippets015', ''' | 142 typedef n!1 ;''', |
112 class D {f(){} g(){f!1(f!2);}}''', <String>["1+f", "2+f"]); | 143 <String>["1+num"]); |
113 | 144 |
114 buildTests('testCommentSnippets016', ''' | 145 buildTests( |
115 class F {m() { m(); !1}}''', <String>["1+m"]); | 146 'testCommentSnippets015', |
116 | 147 ''' |
117 buildTests('testCommentSnippets017', ''' | 148 class D {f(){} g(){f!1(f!2);}}''', |
118 class F {var x = !1false;}''', <String>["1+true"]); | 149 <String>["1+f", "2+f"]); |
119 | 150 |
120 buildTests('testCommentSnippets018', ''' | 151 buildTests( |
| 152 'testCommentSnippets016', |
| 153 ''' |
| 154 class F {m() { m(); !1}}''', |
| 155 <String>["1+m"]); |
| 156 |
| 157 buildTests( |
| 158 'testCommentSnippets017', |
| 159 ''' |
| 160 class F {var x = !1false;}''', |
| 161 <String>["1+true"]); |
| 162 |
| 163 buildTests( |
| 164 'testCommentSnippets018', |
| 165 ''' |
121 class Map{}class Arrays{}class C{ m(!1){} n(!2 x, q)''', | 166 class Map{}class Arrays{}class C{ m(!1){} n(!2 x, q)''', |
122 <String>["1+Map", "1-void", "1-null", "2+Arrays", "2-void", "2-null"]); | 167 <String>["1+Map", "1-void", "1-null", "2+Arrays", "2-void", "2-null"]); |
123 | 168 |
124 buildTests('testCommentSnippets019', ''' | 169 buildTests( |
125 class A{m(){Object x;x.!1/**/clear()''', <String>["1+toString"]); | 170 'testCommentSnippets019', |
126 | 171 ''' |
127 buildTests('testCommentSnippets020', ''' | 172 class A{m(){Object x;x.!1/**/clear()''', |
| 173 <String>["1+toString"]); |
| 174 |
| 175 buildTests( |
| 176 'testCommentSnippets020', |
| 177 ''' |
128 classMap{}class tst {var newt;void newf(){}test() {var newz;new!1/**/;}}''', | 178 classMap{}class tst {var newt;void newf(){}test() {var newz;new!1/**/;}}''', |
129 <String>["1+newt", "1+newf", "1+newz", "1-Map"]); | 179 <String>["1+newt", "1+newf", "1+newz", "1-Map"]); |
130 | 180 |
131 buildTests('testCommentSnippets021', ''' | 181 buildTests( |
| 182 'testCommentSnippets021', |
| 183 ''' |
132 class Map{}class tst {var newt;void newf(){}test() {var newz;new !1/**/;}}''', | 184 class Map{}class tst {var newt;void newf(){}test() {var newz;new !1/**/;}}''', |
133 <String>["1+Map", "1-newt"]); | 185 <String>["1+Map", "1-newt"]); |
134 | 186 |
135 buildTests('testCommentSnippets022', ''' | 187 buildTests( |
136 class Map{}class F{m(){new !1;}}''', <String>["1+Map"]); | 188 'testCommentSnippets022', |
137 | 189 ''' |
138 buildTests('testCommentSnippets022a', ''' | 190 class Map{}class F{m(){new !1;}}''', |
139 class Map{}class F{m(){new !1''', <String>["1+Map"]); | 191 <String>["1+Map"]); |
140 | 192 |
141 buildTests('testCommentSnippets022b', ''' | 193 buildTests( |
| 194 'testCommentSnippets022a', |
| 195 ''' |
| 196 class Map{}class F{m(){new !1''', |
| 197 <String>["1+Map"]); |
| 198 |
| 199 buildTests( |
| 200 'testCommentSnippets022b', |
| 201 ''' |
142 class Map{factory Map.qq(){return null;}}class F{m(){new Map.!1qq();}}''', | 202 class Map{factory Map.qq(){return null;}}class F{m(){new Map.!1qq();}}''', |
143 <String>["1+qq"]); | 203 <String>["1+qq"]); |
144 | 204 |
145 buildTests('testCommentSnippets023', ''' | 205 buildTests( |
| 206 'testCommentSnippets023', |
| 207 ''' |
146 class X {X c; X(this.!1c!3) : super() {c.!2}}''', | 208 class X {X c; X(this.!1c!3) : super() {c.!2}}''', |
147 <String>["1+c", "2+c", "3+c"]); | 209 <String>["1+c", "2+c", "3+c"]); |
148 | 210 |
149 buildTests('testCommentSnippets024', ''' | 211 buildTests( |
150 class q {m(Map q){var x;m(!1)}n(){var x;n(!2)}}''', <String>["1+x", "2+x"]); | 212 'testCommentSnippets024', |
151 | 213 ''' |
152 buildTests('testCommentSnippets025', ''' | 214 class q {m(Map q){var x;m(!1)}n(){var x;n(!2)}}''', |
| 215 <String>["1+x", "2+x"]); |
| 216 |
| 217 buildTests( |
| 218 'testCommentSnippets025', |
| 219 ''' |
153 class q {num m() {var q; num x=!1 q!3 + !2/**/;}}''', | 220 class q {num m() {var q; num x=!1 q!3 + !2/**/;}}''', |
154 <String>["1+q", "2+q", "3+q"]); | 221 <String>["1+q", "2+q", "3+q"]); |
155 | 222 |
156 buildTests('testCommentSnippets026', ''' | 223 buildTests( |
157 class List{}class a implements !1{}''', <String>["1+List"]); | 224 'testCommentSnippets026', |
158 | 225 ''' |
159 buildTests('testCommentSnippets027', ''' | 226 class List{}class a implements !1{}''', |
| 227 <String>["1+List"]); |
| 228 |
| 229 buildTests( |
| 230 'testCommentSnippets027', |
| 231 ''' |
160 class String{}class List{}class test <X extends !1String!2> {}''', | 232 class String{}class List{}class test <X extends !1String!2> {}''', |
161 <String>["1+List", "2+String", "2-List"]); | 233 <String>["1+List", "2+String", "2-List"]); |
162 | 234 |
163 buildTests('testCommentSnippets028', ''' | 235 buildTests( |
| 236 'testCommentSnippets028', |
| 237 ''' |
164 class String{}class List{}class DateTime{}typedef T Y<T extends !1>(List input);
''', | 238 class String{}class List{}class DateTime{}typedef T Y<T extends !1>(List input);
''', |
165 <String>["1+DateTime", "1+String"]); | 239 <String>["1+DateTime", "1+String"]); |
166 | 240 |
167 buildTests('testCommentSnippets029', ''' | 241 buildTests( |
| 242 'testCommentSnippets029', |
| 243 ''' |
168 interface A<X> default B<X extends !1List!2> {}''', | 244 interface A<X> default B<X extends !1List!2> {}''', |
169 <String>["1+DateTime", "2+List"]); | 245 <String>["1+DateTime", "2+List"]); |
170 | 246 |
171 buildTests('testCommentSnippets030', ''' | 247 buildTests( |
| 248 'testCommentSnippets030', |
| 249 ''' |
172 class Bar<T extends Foo> {const Bar(!1T!2 k);T!3 m(T!4 a, T!5 b){}final T!6 f =
null;}''', | 250 class Bar<T extends Foo> {const Bar(!1T!2 k);T!3 m(T!4 a, T!5 b){}final T!6 f =
null;}''', |
173 <String>["1+T", "2+T", "3+T", "4+T", "5+T", "6+T"], | 251 <String>["1+T", "2+T", "3+T", "4+T", "5+T", "6+T"], |
174 failingTests: '123456'); | 252 failingTests: '123456'); |
175 | 253 |
176 buildTests('testCommentSnippets031', ''' | 254 buildTests( |
| 255 'testCommentSnippets031', |
| 256 ''' |
177 class Bar<T extends Foo> {m(x){if (x is !1) return;if (x is!!!2)}}''', | 257 class Bar<T extends Foo> {m(x){if (x is !1) return;if (x is!!!2)}}''', |
178 <String>["1+Bar", "1+T", "2+T", "2+Bar"], failingTests: '12'); | 258 <String>["1+Bar", "1+T", "2+T", "2+Bar"], |
179 | 259 failingTests: '12'); |
180 buildTests('testCommentSnippets032', ''' | 260 |
| 261 buildTests( |
| 262 'testCommentSnippets032', |
| 263 ''' |
181 class Fit{}class Bar<T extends Fooa> {const !2F!1ara();}''', | 264 class Fit{}class Bar<T extends Fooa> {const !2F!1ara();}''', |
182 <String>["1+Fit", "1+Fara", "1-Bar", "2+Fit"], failingTests: '1'); | 265 <String>["1+Fit", "1+Fara", "1-Bar", "2+Fit"], |
| 266 failingTests: '1'); |
183 | 267 |
184 // Type propagation | 268 // Type propagation |
185 buildTests('testCommentSnippets033', ''' | 269 buildTests( |
| 270 'testCommentSnippets033', |
| 271 ''' |
186 class List{add(){}length(){}}t1() {var x;if (x is List) {x.!1add(3);}}''', | 272 class List{add(){}length(){}}t1() {var x;if (x is List) {x.!1add(3);}}''', |
187 <String>["1+add", "1+length"]); | 273 <String>["1+add", "1+length"]); |
188 | 274 |
189 // Type propagation | 275 // Type propagation |
190 buildTests('testCommentSnippets035', ''' | 276 buildTests( |
| 277 'testCommentSnippets035', |
| 278 ''' |
191 class List{clear(){}length(){}}t3() {var x=new List(), y=x.!1length();x.!2clear(
);}''', | 279 class List{clear(){}length(){}}t3() {var x=new List(), y=x.!1length();x.!2clear(
);}''', |
192 <String>["1+length", "2+clear"]); | 280 <String>["1+length", "2+clear"]); |
193 | 281 |
194 buildTests('testCommentSnippets036', ''' | 282 buildTests( |
195 class List{}t3() {var x=new List!1}''', <String>["1+List"]); | 283 'testCommentSnippets036', |
196 | 284 ''' |
197 buildTests('testCommentSnippets037', ''' | 285 class List{}t3() {var x=new List!1}''', |
| 286 <String>["1+List"]); |
| 287 |
| 288 buildTests( |
| 289 'testCommentSnippets037', |
| 290 ''' |
198 class List{factory List.from(){}}t3() {var x=new List.!1}''', | 291 class List{factory List.from(){}}t3() {var x=new List.!1}''', |
199 <String>["1+from"]); | 292 <String>["1+from"]); |
200 | 293 |
201 buildTests('testCommentSnippets038', ''' | 294 buildTests( |
202 f(){int xa; String s = '\$x!1';}''', <String>["1+xa"]); | 295 'testCommentSnippets038', |
203 | 296 ''' |
204 buildTests('testCommentSnippets038a', ''' | 297 f(){int xa; String s = '\$x!1';}''', |
205 int xa; String s = '\$x!1\'''', <String>["1+xa"]); | 298 <String>["1+xa"]); |
206 | 299 |
207 buildTests('testCommentSnippets039', ''' | 300 buildTests( |
208 f(){int xa; String s = '\$!1';}''', <String>["1+xa"]); | 301 'testCommentSnippets038a', |
209 | 302 ''' |
210 buildTests('testCommentSnippets039a', ''' | 303 int xa; String s = '\$x!1\'''', |
211 int xa; String s = '\$!1\'''', <String>["1+xa"]); | 304 <String>["1+xa"]); |
212 | 305 |
213 buildTests('testCommentSnippets040', ''' | 306 buildTests( |
| 307 'testCommentSnippets039', |
| 308 ''' |
| 309 f(){int xa; String s = '\$!1';}''', |
| 310 <String>["1+xa"]); |
| 311 |
| 312 buildTests( |
| 313 'testCommentSnippets039a', |
| 314 ''' |
| 315 int xa; String s = '\$!1\'''', |
| 316 <String>["1+xa"]); |
| 317 |
| 318 buildTests( |
| 319 'testCommentSnippets040', |
| 320 ''' |
214 class List{add(){}}class Map{}class X{m(){List list; list.!1 Map map;}}''', | 321 class List{add(){}}class Map{}class X{m(){List list; list.!1 Map map;}}''', |
215 <String>["1+add"]); | 322 <String>["1+add"]); |
216 | 323 |
217 buildTests('testCommentSnippets041', ''' | 324 buildTests( |
| 325 'testCommentSnippets041', |
| 326 ''' |
218 class List{add(){}length(){}}class X{m(){List list; list.!1 zox();}}''', | 327 class List{add(){}length(){}}class X{m(){List list; list.!1 zox();}}''', |
219 <String>["1+add"]); | 328 <String>["1+add"]); |
220 | 329 |
221 buildTests('testCommentSnippets042', ''' | 330 buildTests( |
| 331 'testCommentSnippets042', |
| 332 ''' |
222 class DateTime{static const int WED=3;int get day;}fd(){DateTime d=new DateTime.
now();d.!1WED!2;}''', | 333 class DateTime{static const int WED=3;int get day;}fd(){DateTime d=new DateTime.
now();d.!1WED!2;}''', |
223 <String>["1+day", "2-WED"]); | 334 <String>["1+day", "2-WED"]); |
224 | 335 |
225 buildTests('testCommentSnippets043', ''' | 336 buildTests( |
226 class L{var k;void.!1}''', <String>["1-k"]); | 337 'testCommentSnippets043', |
227 | 338 ''' |
228 buildTests('testCommentSnippets044', ''' | 339 class L{var k;void.!1}''', |
| 340 <String>["1-k"]); |
| 341 |
| 342 buildTests( |
| 343 'testCommentSnippets044', |
| 344 ''' |
229 class List{}class XXX {XXX.fisk();}main() {main(); new !1}}''', | 345 class List{}class XXX {XXX.fisk();}main() {main(); new !1}}''', |
230 <String>["1+List", "1+XXX.fisk"]); | 346 <String>["1+List", "1+XXX.fisk"]); |
231 | 347 |
232 buildTests('testCommentSnippets047', ''' | 348 buildTests( |
233 f(){int x;int y=!1;}''', <String>["1+x"]); | 349 'testCommentSnippets047', |
234 | 350 ''' |
235 buildTests('testCommentSnippets048', ''' | 351 f(){int x;int y=!1;}''', |
236 import 'dart:convert' as json;f() {var x=new js!1}''', <String>["1+json"]); | 352 <String>["1+x"]); |
237 | 353 |
238 buildTests('testCommentSnippets049', ''' | 354 buildTests( |
| 355 'testCommentSnippets048', |
| 356 ''' |
| 357 import 'dart:convert' as json;f() {var x=new js!1}''', |
| 358 <String>["1+json"]); |
| 359 |
| 360 buildTests( |
| 361 'testCommentSnippets049', |
| 362 ''' |
239 import 'dart:convert' as json; | 363 import 'dart:convert' as json; |
240 import 'dart:convert' as jxx; | 364 import 'dart:convert' as jxx; |
241 class JsonDecoderX{} | 365 class JsonDecoderX{} |
242 f1() {var x=new !2j!1s!3}''', <String>[ | 366 f1() {var x=new !2j!1s!3}''', |
| 367 <String>[ |
243 "1+json", | 368 "1+json", |
244 "1+jxx", | 369 "1+jxx", |
245 "2+json", | 370 "2+json", |
246 "2+jxx", | 371 "2+jxx", |
247 "2-JsonDecoder", | 372 "2-JsonDecoder", |
248 "3+json", | 373 "3+json", |
249 "3-jxx" | 374 "3-jxx" |
250 ]); | 375 ]); |
251 | 376 |
252 buildTests('testCommentSnippets050', ''' | 377 buildTests( |
| 378 'testCommentSnippets050', |
| 379 ''' |
253 class xdr { | 380 class xdr { |
254 xdr(); | 381 xdr(); |
255 const xdr.a(a,b,c); | 382 const xdr.a(a,b,c); |
256 xdr.b(); | 383 xdr.b(); |
257 f() => 3; | 384 f() => 3; |
258 } | 385 } |
259 class xa{} | 386 class xa{} |
260 k() { | 387 k() { |
261 new x!1dr().f(); | 388 new x!1dr().f(); |
262 const x!2dr.!3a(1, 2, 3); | 389 const x!2dr.!3a(1, 2, 3); |
263 }''', <String>[ | 390 }''', |
| 391 <String>[ |
264 "1+xdr", | 392 "1+xdr", |
265 "1+xa", | 393 "1+xa", |
266 "1+xdr.a", | 394 "1+xdr.a", |
267 "1+xdr.b", | 395 "1+xdr.b", |
268 "2+xa", // suggest default constructor | 396 "2+xa", // suggest default constructor |
269 "2+xdr", // suggest normal constructor | 397 "2+xdr", // suggest normal constructor |
270 "2+xdr.a", | 398 "2+xdr.a", |
271 "2+xdr.b", // suggest named constructor | 399 "2+xdr.b", // suggest named constructor |
272 "3+b", // suggest named constructor | 400 "3+b", // suggest named constructor |
273 "3+a" | 401 "3+a" |
274 ]); | 402 ]); |
275 | 403 |
276 // Type propagation. | 404 // Type propagation. |
277 buildTests('testCommentSnippets051', ''' | 405 buildTests( |
| 406 'testCommentSnippets051', |
| 407 ''' |
278 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 408 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
279 void r() { | 409 void r() { |
280 var v; | 410 var v; |
281 if (v is String) { | 411 if (v is String) { |
282 v.!1length; | 412 v.!1length; |
283 v.!2getKeys; | 413 v.!2getKeys; |
284 } | 414 } |
285 }''', <String>["1+length", "2-getKeys"]); | 415 }''', |
| 416 <String>["1+length", "2-getKeys"]); |
286 | 417 |
287 // Type propagation. | 418 // Type propagation. |
288 buildTests('testCommentSnippets052', ''' | 419 buildTests( |
| 420 'testCommentSnippets052', |
| 421 ''' |
289 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 422 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
290 void r() { | 423 void r() { |
291 List<String> values = ['a','b','c']; | 424 List<String> values = ['a','b','c']; |
292 for (var v in values) { | 425 for (var v in values) { |
293 v.!1toUpperCase; | 426 v.!1toUpperCase; |
294 v.!2getKeys; | 427 v.!2getKeys; |
295 } | 428 } |
296 }''', <String>["1+toUpperCase", "2-getKeys"]); | 429 }''', |
| 430 <String>["1+toUpperCase", "2-getKeys"]); |
297 | 431 |
298 // Type propagation. | 432 // Type propagation. |
299 buildTests('testCommentSnippets053', ''' | 433 buildTests( |
| 434 'testCommentSnippets053', |
| 435 ''' |
300 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 436 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
301 void r() { | 437 void r() { |
302 var v; | 438 var v; |
303 while (v is String) { | 439 while (v is String) { |
304 v.!1toUpperCase; | 440 v.!1toUpperCase; |
305 v.!2getKeys; | 441 v.!2getKeys; |
306 } | 442 } |
307 }''', <String>["1+toUpperCase", "2-getKeys"]); | 443 }''', |
| 444 <String>["1+toUpperCase", "2-getKeys"]); |
308 | 445 |
309 buildTests('testCommentSnippets054', ''' | 446 buildTests( |
| 447 'testCommentSnippets054', |
| 448 ''' |
310 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 449 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
311 void r() { | 450 void r() { |
312 var v; | 451 var v; |
313 for (; v is String; v.!1isEmpty) { | 452 for (; v is String; v.!1isEmpty) { |
314 v.!2toUpperCase; | 453 v.!2toUpperCase; |
315 v.!3getKeys; | 454 v.!3getKeys; |
316 } | 455 } |
317 }''', <String>["1+isEmpty", "2+toUpperCase", "3-getKeys"]); | 456 }''', |
| 457 <String>["1+isEmpty", "2+toUpperCase", "3-getKeys"]); |
318 | 458 |
319 buildTests('testCommentSnippets055', ''' | 459 buildTests( |
| 460 'testCommentSnippets055', |
| 461 ''' |
320 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 462 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
321 void r() { | 463 void r() { |
322 String v; | 464 String v; |
323 if (v is Object) { | 465 if (v is Object) { |
324 v.!1toUpperCase; | 466 v.!1toUpperCase; |
325 } | 467 } |
326 }''', <String>["1+toUpperCase"]); | 468 }''', |
| 469 <String>["1+toUpperCase"]); |
327 | 470 |
328 // Type propagation. | 471 // Type propagation. |
329 buildTests('testCommentSnippets056', ''' | 472 buildTests( |
| 473 'testCommentSnippets056', |
| 474 ''' |
330 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 475 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
331 void f(var v) { | 476 void f(var v) { |
332 if (v is!! String) { | 477 if (v is!! String) { |
333 return; | 478 return; |
334 } | 479 } |
335 v.!1toUpperCase; | 480 v.!1toUpperCase; |
336 }''', <String>["1+toUpperCase"]); | 481 }''', |
| 482 <String>["1+toUpperCase"]); |
337 | 483 |
338 // Type propagation. | 484 // Type propagation. |
339 buildTests('testCommentSnippets057', ''' | 485 buildTests( |
| 486 'testCommentSnippets057', |
| 487 ''' |
340 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 488 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
341 void f(var v) { | 489 void f(var v) { |
342 if ((v as String).!2length == 0) { | 490 if ((v as String).!2length == 0) { |
343 v.!1toUpperCase; | 491 v.!1toUpperCase; |
344 } | 492 } |
345 }''', <String>["1+toUpperCase", "2+length"]); | 493 }''', |
| 494 <String>["1+toUpperCase", "2+length"]); |
346 | 495 |
347 buildTests('testCommentSnippets058', ''' | 496 buildTests( |
| 497 'testCommentSnippets058', |
| 498 ''' |
348 typedef vo!2id callback(int k); | 499 typedef vo!2id callback(int k); |
349 void x(callback q){} | 500 void x(callback q){} |
350 void r() { | 501 void r() { |
351 callback v; | 502 callback v; |
352 x(!1); | 503 x(!1); |
353 }''', <String>["1+v", "2+void"], failingTests: '2'); | 504 }''', |
| 505 <String>["1+v", "2+void"], |
| 506 failingTests: '2'); |
354 | 507 |
355 buildTests('testCommentSnippets059', ''' | 508 buildTests( |
356 f(){((int x) => x+4).!1call(1);}''', <String>["1-call"]); | 509 'testCommentSnippets059', |
| 510 ''' |
| 511 f(){((int x) => x+4).!1call(1);}''', |
| 512 <String>["1-call"]); |
357 | 513 |
358 buildTests('testCommentSnippets060', ''' | 514 buildTests( |
| 515 'testCommentSnippets060', |
| 516 ''' |
359 class Map{} | 517 class Map{} |
360 abstract class MM extends Map{factory MM() => new Map();} | 518 abstract class MM extends Map{factory MM() => new Map();} |
361 class Z { | 519 class Z { |
362 MM x; | 520 MM x; |
363 f() { | 521 f() { |
364 x!1 | 522 x!1 |
365 } | 523 } |
366 }''', <String>["1+x", "1-x[]"]); | 524 }''', |
| 525 <String>["1+x", "1-x[]"]); |
367 | 526 |
368 buildTests('testCommentSnippets061', ''' | 527 buildTests( |
| 528 'testCommentSnippets061', |
| 529 ''' |
369 class A{m(){!1f(3);!2}}n(){!3f(3);!4}f(x)=>x*3;''', | 530 class A{m(){!1f(3);!2}}n(){!3f(3);!4}f(x)=>x*3;''', |
370 <String>["1+f", "1+n", "2+f", "2+n", "3+f", "3+n", "4+f", "4+n"]); | 531 <String>["1+f", "1+n", "2+f", "2+n", "3+f", "3+n", "4+f", "4+n"]); |
371 | 532 |
372 // Type propagation. | 533 // Type propagation. |
373 buildTests('testCommentSnippets063', ''' | 534 buildTests( |
| 535 'testCommentSnippets063', |
| 536 ''' |
374 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 537 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
375 void r(var v) { | 538 void r(var v) { |
376 v.!1toUpperCase; | 539 v.!1toUpperCase; |
377 assert(v is String); | 540 assert(v is String); |
378 v.!2toUpperCase; | 541 v.!2toUpperCase; |
379 }''', <String>["1-toUpperCase", "2+toUpperCase"]); | 542 }''', |
| 543 <String>["1-toUpperCase", "2+toUpperCase"]); |
380 | 544 |
381 buildTests('testCommentSnippets064', ''' | 545 buildTests( |
| 546 'testCommentSnippets064', |
| 547 ''' |
382 class Spline { | 548 class Spline { |
383 Line c; | 549 Line c; |
384 Spline a() { | 550 Spline a() { |
385 return this; | 551 return this; |
386 } | 552 } |
387 Line b() { | 553 Line b() { |
388 return null; | 554 return null; |
389 } | 555 } |
390 Spline f() { | 556 Spline f() { |
391 Line x = new Line(); | 557 Line x = new Line(); |
392 x.!9h()..!1a()..!2b().!7g(); | 558 x.!9h()..!1a()..!2b().!7g(); |
393 x.!8j..!3b()..!4c..!6c..!5a(); | 559 x.!8j..!3b()..!4c..!6c..!5a(); |
394 } | 560 } |
395 } | 561 } |
396 class Line { | 562 class Line { |
397 Spline j; | 563 Spline j; |
398 Line g() { | 564 Line g() { |
399 return this; | 565 return this; |
400 } | 566 } |
401 Spline h() { | 567 Spline h() { |
402 return null; | 568 return null; |
403 } | 569 } |
404 }''', <String>[ | 570 }''', |
| 571 <String>[ |
405 "1+a", | 572 "1+a", |
406 "2+b", | 573 "2+b", |
407 "1-g", | 574 "1-g", |
408 "2-h", | 575 "2-h", |
409 "3+b", | 576 "3+b", |
410 "4+c", | 577 "4+c", |
411 "5+a", | 578 "5+a", |
412 "6+c", | 579 "6+c", |
413 "7+g", | 580 "7+g", |
414 "8+j", | 581 "8+j", |
415 "9+h" | 582 "9+h" |
416 ]); | 583 ]); |
417 | 584 |
418 buildTests('testCommentSnippets065', ''' | 585 buildTests( |
| 586 'testCommentSnippets065', |
| 587 ''' |
419 class Spline { | 588 class Spline { |
420 Line c; | 589 Line c; |
421 Spline a() { | 590 Spline a() { |
422 return this; | 591 return this; |
423 } | 592 } |
424 Line b() { | 593 Line b() { |
425 return null; | 594 return null; |
426 } | 595 } |
427 Spline f() { | 596 Spline f() { |
428 Line x = new Line(); | 597 Line x = new Line(); |
429 x.h()..!1; | 598 x.h()..!1; |
430 } | 599 } |
431 } | 600 } |
432 class Line { | 601 class Line { |
433 Spline j; | 602 Spline j; |
434 Line g() { | 603 Line g() { |
435 return this; | 604 return this; |
436 } | 605 } |
437 Spline h() { | 606 Spline h() { |
438 return null; | 607 return null; |
439 } | 608 } |
440 }''', <String>["1+a"]); | 609 }''', |
| 610 <String>["1+a"]); |
441 | 611 |
442 buildTests('testCommentSnippets066', ''' | 612 buildTests( |
| 613 'testCommentSnippets066', |
| 614 ''' |
443 class Spline { | 615 class Spline { |
444 Line c; | 616 Line c; |
445 Spline a() { | 617 Spline a() { |
446 return this; | 618 return this; |
447 } | 619 } |
448 Line b() { | 620 Line b() { |
449 return null; | 621 return null; |
450 } | 622 } |
451 Spline f() { | 623 Spline f() { |
452 Line x = new Line(); | 624 Line x = new Line(); |
453 x.h()..a()..!1; | 625 x.h()..a()..!1; |
454 } | 626 } |
455 } | 627 } |
456 class Line { | 628 class Line { |
457 Spline j; | 629 Spline j; |
458 Line g() { | 630 Line g() { |
459 return this; | 631 return this; |
460 } | 632 } |
461 Spline h() { | 633 Spline h() { |
462 return null; | 634 return null; |
463 } | 635 } |
464 }''', <String>["1+b"]); | 636 }''', |
| 637 <String>["1+b"]); |
465 | 638 |
466 buildTests('testCommentSnippets067', ''' | 639 buildTests( |
| 640 'testCommentSnippets067', |
| 641 ''' |
467 class Spline { | 642 class Spline { |
468 Line c; | 643 Line c; |
469 Spline a() { | 644 Spline a() { |
470 return this; | 645 return this; |
471 } | 646 } |
472 Line b() { | 647 Line b() { |
473 return null; | 648 return null; |
474 } | 649 } |
475 Spline f() { | 650 Spline f() { |
476 Line x = new Line(); | 651 Line x = new Line(); |
477 x.h()..a()..c..!1; | 652 x.h()..a()..c..!1; |
478 } | 653 } |
479 } | 654 } |
480 class Line { | 655 class Line { |
481 Spline j; | 656 Spline j; |
482 Line g() { | 657 Line g() { |
483 return this; | 658 return this; |
484 } | 659 } |
485 Spline h() { | 660 Spline h() { |
486 return null; | 661 return null; |
487 } | 662 } |
488 }''', <String>["1+b"]); | 663 }''', |
| 664 <String>["1+b"]); |
489 | 665 |
490 buildTests('testCommentSnippets068', ''' | 666 buildTests( |
| 667 'testCommentSnippets068', |
| 668 ''' |
491 class Spline { | 669 class Spline { |
492 Line c; | 670 Line c; |
493 Spline a() { | 671 Spline a() { |
494 return this; | 672 return this; |
495 } | 673 } |
496 Line b() { | 674 Line b() { |
497 return null; | 675 return null; |
498 } | 676 } |
499 Spline f() { | 677 Spline f() { |
500 Line x = new Line(); | 678 Line x = new Line(); |
501 x.j..b()..c..!1; | 679 x.j..b()..c..!1; |
502 } | 680 } |
503 } | 681 } |
504 class Line { | 682 class Line { |
505 Spline j; | 683 Spline j; |
506 Line g() { | 684 Line g() { |
507 return this; | 685 return this; |
508 } | 686 } |
509 Spline h() { | 687 Spline h() { |
510 return null; | 688 return null; |
511 } | 689 } |
512 }''', <String>["1+c"]); | 690 }''', |
| 691 <String>["1+c"]); |
513 | 692 |
514 buildTests('testCommentSnippets069', ''' | 693 buildTests( |
| 694 'testCommentSnippets069', |
| 695 ''' |
515 class Spline { | 696 class Spline { |
516 Line c; | 697 Line c; |
517 Spline a() { | 698 Spline a() { |
518 return this; | 699 return this; |
519 } | 700 } |
520 Line b() { | 701 Line b() { |
521 return null; | 702 return null; |
522 } | 703 } |
523 Spline f() { | 704 Spline f() { |
524 Line x = new Line(); | 705 Line x = new Line(); |
525 x.j..b()..!1; | 706 x.j..b()..!1; |
526 } | 707 } |
527 } | 708 } |
528 class Line { | 709 class Line { |
529 Spline j; | 710 Spline j; |
530 Line g() { | 711 Line g() { |
531 return this; | 712 return this; |
532 } | 713 } |
533 Spline h() { | 714 Spline h() { |
534 return null; | 715 return null; |
535 } | 716 } |
536 }''', <String>["1+c"]); | 717 }''', |
| 718 <String>["1+c"]); |
537 | 719 |
538 buildTests('testCommentSnippets070', ''' | 720 buildTests( |
| 721 'testCommentSnippets070', |
| 722 ''' |
539 class Spline { | 723 class Spline { |
540 Line c; | 724 Line c; |
541 Spline a() { | 725 Spline a() { |
542 return this; | 726 return this; |
543 } | 727 } |
544 Line b() { | 728 Line b() { |
545 return null; | 729 return null; |
546 } | 730 } |
547 Spline f() { | 731 Spline f() { |
548 Line x = new Line(); | 732 Line x = new Line(); |
549 x.j..!1; | 733 x.j..!1; |
550 } | 734 } |
551 } | 735 } |
552 class Line { | 736 class Line { |
553 Spline j; | 737 Spline j; |
554 Line g() { | 738 Line g() { |
555 return this; | 739 return this; |
556 } | 740 } |
557 Spline h() { | 741 Spline h() { |
558 return null; | 742 return null; |
559 } | 743 } |
560 }''', <String>["1+b"]); | 744 }''', |
| 745 <String>["1+b"]); |
561 | 746 |
562 buildTests('testCommentSnippets072', ''' | 747 buildTests( |
| 748 'testCommentSnippets072', |
| 749 ''' |
563 class X { | 750 class X { |
564 int _p; | 751 int _p; |
565 set p(int x) => _p = x; | 752 set p(int x) => _p = x; |
566 } | 753 } |
567 f() { | 754 f() { |
568 X x = new X(); | 755 X x = new X(); |
569 x.!1p = 3; | 756 x.!1p = 3; |
570 }''', <String>["1+p"]); | 757 }''', |
| 758 <String>["1+p"]); |
571 | 759 |
572 buildTests('testCommentSnippets073', ''' | 760 buildTests( |
| 761 'testCommentSnippets073', |
| 762 ''' |
573 class X { | 763 class X { |
574 m() { | 764 m() { |
575 JSON.stri!1; | 765 JSON.stri!1; |
576 X f = null; | 766 X f = null; |
577 } | 767 } |
578 } | 768 } |
579 class JSON { | 769 class JSON { |
580 static stringify() {} | 770 static stringify() {} |
581 }''', <String>["1+stringify"]); | 771 }''', |
| 772 <String>["1+stringify"]); |
582 | 773 |
583 buildTests('testCommentSnippets074', ''' | 774 buildTests( |
| 775 'testCommentSnippets074', |
| 776 ''' |
584 class X { | 777 class X { |
585 m() { | 778 m() { |
586 _x!1 | 779 _x!1 |
587 } | 780 } |
588 _x1(){} | 781 _x1(){} |
589 }''', <String>["1+_x1"]); | 782 }''', |
| 783 <String>["1+_x1"]); |
590 | 784 |
591 buildTests('testCommentSnippets075', ''' | 785 buildTests( |
592 p(x)=>0;var E;f(q)=>!1p(!2E);''', <String>["1+p", "2+E"]); | 786 'testCommentSnippets075', |
| 787 ''' |
| 788 p(x)=>0;var E;f(q)=>!1p(!2E);''', |
| 789 <String>["1+p", "2+E"]); |
593 | 790 |
594 buildTests('testCommentSnippets076', ''' | 791 buildTests( |
| 792 'testCommentSnippets076', |
| 793 ''' |
595 class Map<K,V>{}class List<E>{}class int{}main() {var m=new Map<Lis!1t<Map<int,i
n!2t>>,List<!3int>>();}''', | 794 class Map<K,V>{}class List<E>{}class int{}main() {var m=new Map<Lis!1t<Map<int,i
n!2t>>,List<!3int>>();}''', |
596 <String>["1+List", "2+int", "3+int"]); | 795 <String>["1+List", "2+int", "3+int"]); |
597 | 796 |
598 buildTests('testCommentSnippets076a', ''' | 797 buildTests( |
| 798 'testCommentSnippets076a', |
| 799 ''' |
599 class Map<K,V>{}class List<E>{}class int{}main() {var m=new Map<Lis!1t<Map<int,i
n!2t>>,List<!3>>();}''', | 800 class Map<K,V>{}class List<E>{}class int{}main() {var m=new Map<Lis!1t<Map<int,i
n!2t>>,List<!3>>();}''', |
600 <String>["1+List", "2+int", "3+int"]); | 801 <String>["1+List", "2+int", "3+int"]); |
601 | 802 |
602 buildTests('testCommentSnippets077', ''' | 803 buildTests( |
| 804 'testCommentSnippets077', |
| 805 ''' |
603 class FileMode { | 806 class FileMode { |
604 static const READ = const FileMode._internal(0); | 807 static const READ = const FileMode._internal(0); |
605 static const WRITE = const FileMode._internal(1); | 808 static const WRITE = const FileMode._internal(1); |
606 static const APPEND = const FileMode._internal(2); | 809 static const APPEND = const FileMode._internal(2); |
607 const FileMode._internal(int this._mode); | 810 const FileMode._internal(int this._mode); |
608 factory FileMode._internal1(int this._mode); | 811 factory FileMode._internal1(int this._mode); |
609 factory FileMode(_mode); | 812 factory FileMode(_mode); |
610 final int _mode; | 813 final int _mode; |
611 } | 814 } |
612 class File { | 815 class File { |
613 factory File(String path) => null; | 816 factory File(String path) => null; |
614 factory File.fromPath(Path path) => null; | 817 factory File.fromPath(Path path) => null; |
615 } | 818 } |
616 f() => new Fil!1''', <String>[ | 819 f() => new Fil!1''', |
| 820 <String>[ |
617 "1+File", | 821 "1+File", |
618 "1+File.fromPath", | 822 "1+File.fromPath", |
619 "1+FileMode", | 823 "1+FileMode", |
620 "1+FileMode._internal1", | 824 "1+FileMode._internal1", |
621 "1+FileMode._internal" | 825 "1+FileMode._internal" |
622 ]); | 826 ]); |
623 | 827 |
624 buildTests('testCommentSnippets078', ''' | 828 buildTests( |
| 829 'testCommentSnippets078', |
| 830 ''' |
625 class Map{static from()=>null;clear(){}}void main() { Map.!1 }''', | 831 class Map{static from()=>null;clear(){}}void main() { Map.!1 }''', |
626 <String>["1+from", "1-clear"]); // static method, instance method | 832 <String>["1+from", "1-clear"]); // static method, instance method |
627 | 833 |
628 buildTests('testCommentSnippets079', ''' | 834 buildTests( |
| 835 'testCommentSnippets079', |
| 836 ''' |
629 class Map{static from()=>null;clear(){}}void main() { Map s; s.!1 }''', | 837 class Map{static from()=>null;clear(){}}void main() { Map s; s.!1 }''', |
630 <String>["1-from", "1+clear"]); // static method, instance method | 838 <String>["1-from", "1+clear"]); // static method, instance method |
631 | 839 |
632 buildTests('testCommentSnippets080', ''' | 840 buildTests( |
| 841 'testCommentSnippets080', |
| 842 ''' |
633 class RuntimeError{var message;}void main() { RuntimeError.!1 }''', | 843 class RuntimeError{var message;}void main() { RuntimeError.!1 }''', |
634 <String>["1-message"]); // field | 844 <String>["1-message"]); // field |
635 | 845 |
636 buildTests('testCommentSnippets081', ''' | 846 buildTests( |
637 class Foo {this.!1}''', <String>["1-Object"], failingTests: '1'); | 847 'testCommentSnippets081', |
| 848 ''' |
| 849 class Foo {this.!1}''', |
| 850 <String>["1-Object"], |
| 851 failingTests: '1'); |
638 | 852 |
639 buildTests('testCommentSnippets082', ''' | 853 buildTests( |
| 854 'testCommentSnippets082', |
| 855 ''' |
640 class HttpRequest {} | 856 class HttpRequest {} |
641 class HttpResponse {} | 857 class HttpResponse {} |
642 main() { | 858 main() { |
643 var v = (HttpRequest req, HttpResp!1) | 859 var v = (HttpRequest req, HttpResp!1) |
644 }''', <String>["1+HttpResponse"]); | 860 }''', |
| 861 <String>["1+HttpResponse"]); |
645 | 862 |
646 buildTests('testCommentSnippets083', ''' | 863 buildTests( |
647 main() {(.!1)}''', <String>["1-toString"]); | 864 'testCommentSnippets083', |
| 865 ''' |
| 866 main() {(.!1)}''', |
| 867 <String>["1-toString"]); |
648 | 868 |
649 buildTests('testCommentSnippets083a', ''' | 869 buildTests( |
650 main() { .!1 }''', <String>["1-toString"]); | 870 'testCommentSnippets083a', |
| 871 ''' |
| 872 main() { .!1 }''', |
| 873 <String>["1-toString"]); |
651 | 874 |
652 buildTests('testCommentSnippets083b', ''' | 875 buildTests( |
653 main() { null.!1 }''', <String>["1+toString"], failingTests: '1'); | 876 'testCommentSnippets083b', |
| 877 ''' |
| 878 main() { null.!1 }''', |
| 879 <String>["1+toString"], |
| 880 failingTests: '1'); |
654 | 881 |
655 buildTests('testCommentSnippets084', ''' | 882 buildTests( |
656 class List{}class Map{}typedef X = !1Lis!2t with !3Ma!4p;''', <String>[ | 883 'testCommentSnippets084', |
657 "1+Map", | 884 ''' |
658 "2+List", | 885 class List{}class Map{}typedef X = !1Lis!2t with !3Ma!4p;''', |
659 "2-Map", | 886 <String>["1+Map", "2+List", "2-Map", "3+List", "4+Map", "4-List"], |
660 "3+List", | 887 failingTests: '1234'); |
661 "4+Map", | |
662 "4-List" | |
663 ], failingTests: '1234'); | |
664 | 888 |
665 buildTests('testCommentSnippets085', ''' | 889 buildTests( |
| 890 'testCommentSnippets085', |
| 891 ''' |
666 class List{}class Map{}class Z extends List with !1Ma!2p {}''', | 892 class List{}class Map{}class Z extends List with !1Ma!2p {}''', |
667 <String>["1+List", "1+Map", "2+Map", "2-List"], failingTests: '12'); | 893 <String>["1+List", "1+Map", "2+Map", "2-List"], |
| 894 failingTests: '12'); |
668 | 895 |
669 buildTests('testCommentSnippets086', ''' | 896 buildTests( |
670 class Q{f(){xy() {!2};x!1y();}}''', <String>["1+xy", "2+f", "2-xy"], | 897 'testCommentSnippets086', |
| 898 ''' |
| 899 class Q{f(){xy() {!2};x!1y();}}''', |
| 900 <String>["1+xy", "2+f", "2-xy"], |
671 failingTests: '2'); | 901 failingTests: '2'); |
672 | 902 |
673 buildTests('testCommentSnippets087', ''' | 903 buildTests( |
| 904 'testCommentSnippets087', |
| 905 ''' |
674 class Map{}class Q extends Object with !1Map {}''', | 906 class Map{}class Q extends Object with !1Map {}''', |
675 <String>["1+Map", "1-HashMap"], failingTests: '1'); | 907 <String>["1+Map", "1-HashMap"], |
| 908 failingTests: '1'); |
676 | 909 |
677 buildTests('testCommentSnippets088', ''' | 910 buildTests( |
| 911 'testCommentSnippets088', |
| 912 ''' |
678 class A { | 913 class A { |
679 int f; | 914 int f; |
680 B m(){} | 915 B m(){} |
681 } | 916 } |
682 class B extends A { | 917 class B extends A { |
683 num f; | 918 num f; |
684 A m(){} | 919 A m(){} |
685 } | 920 } |
686 class Z { | 921 class Z { |
687 B q; | 922 B q; |
688 f() {q.!1} | 923 f() {q.!1} |
689 }''', <String>["1+f", "1+m"]); // f->num, m()->A | 924 }''', |
| 925 <String>["1+f", "1+m"]); // f->num, m()->A |
690 | 926 |
691 buildTests('testCommentSnippets089', ''' | 927 buildTests( |
| 928 'testCommentSnippets089', |
| 929 ''' |
692 class Q { | 930 class Q { |
693 fqe() { | 931 fqe() { |
694 xya() { | 932 xya() { |
695 xyb() { | 933 xyb() { |
696 !1 | 934 !1 |
697 } | 935 } |
698 !3 xyb(); | 936 !3 xyb(); |
699 }; | 937 }; |
700 xza() { | 938 xza() { |
701 !2 | 939 !2 |
702 } | 940 } |
703 xya(); | 941 xya(); |
704 !4 xza(); | 942 !4 xza(); |
705 } | 943 } |
706 fqi() { | 944 fqi() { |
707 !5 | 945 !5 |
708 } | 946 } |
709 }''', <String>[ | 947 }''', |
710 "1+fqe", | 948 <String>[ |
711 "1+fqi", | 949 "1+fqe", |
712 "1+Q", | 950 "1+fqi", |
713 "1-xya", | 951 "1+Q", |
714 "1-xyb", | 952 "1-xya", |
715 "1-xza", | 953 "1-xyb", |
716 "2+fqe", | 954 "1-xza", |
717 "2+fqi", | 955 "2+fqe", |
718 "2+Q", | 956 "2+fqi", |
719 "2-xya", | 957 "2+Q", |
720 "2-xyb", | 958 "2-xya", |
721 "2-xza", | 959 "2-xyb", |
722 "3+fqe", | 960 "2-xza", |
723 "3+fqi", | 961 "3+fqe", |
724 "3+Q", | 962 "3+fqi", |
725 "3-xya", | 963 "3+Q", |
726 "3+xyb", | 964 "3-xya", |
727 "3-xza", | 965 "3+xyb", |
728 "4+fqe", | 966 "3-xza", |
729 "4+fqi", | 967 "4+fqe", |
730 "4+Q", | 968 "4+fqi", |
731 "4+xya", | 969 "4+Q", |
732 "4-xyb", | 970 "4+xya", |
733 "4+xza", | 971 "4-xyb", |
734 "5+fqe", | 972 "4+xza", |
735 "5+fqi", | 973 "5+fqe", |
736 "5+Q", | 974 "5+fqi", |
737 "5-xya", | 975 "5+Q", |
738 "5-xyb", | 976 "5-xya", |
739 "5-xza" | 977 "5-xyb", |
740 ], failingTests: '123'); | 978 "5-xza" |
| 979 ], |
| 980 failingTests: '123'); |
741 | 981 |
742 buildTests('testCommentSnippets090', ''' | 982 buildTests( |
743 class X { f() { var a = 'x'; a.!1 }}''', <String>["1+length"]); | 983 'testCommentSnippets090', |
| 984 ''' |
| 985 class X { f() { var a = 'x'; a.!1 }}''', |
| 986 <String>["1+length"]); |
744 } | 987 } |
745 | 988 |
746 void buildCompletionTests() { | 989 void buildCompletionTests() { |
747 buildTests('testCompletion_alias_field', ''' | 990 buildTests( |
748 typedef int fnint(int k); fn!1int x;''', <String>["1+fnint"]); | 991 'testCompletion_alias_field', |
| 992 ''' |
| 993 typedef int fnint(int k); fn!1int x;''', |
| 994 <String>["1+fnint"]); |
749 | 995 |
750 buildTests('testCompletion_annotation_argumentList', ''' | 996 buildTests( |
| 997 'testCompletion_annotation_argumentList', |
| 998 ''' |
751 class AAA {", | 999 class AAA {", |
752 const AAA({int aaa, int bbb});", | 1000 const AAA({int aaa, int bbb});", |
753 }", | 1001 }", |
754 ", | 1002 ", |
755 @AAA(!1) | 1003 @AAA(!1) |
756 main() { | 1004 main() { |
757 }''', <String>["1+AAA" /*":" + ProposalKind.ARGUMENT_LIST*/, "1+aaa", "1+bbb"], | 1005 }''', |
| 1006 <String>[ |
| 1007 "1+AAA" /*":" + ProposalKind.ARGUMENT_LIST*/, |
| 1008 "1+aaa", |
| 1009 "1+bbb" |
| 1010 ], |
758 failingTests: '1'); | 1011 failingTests: '1'); |
759 | 1012 |
760 buildTests('testCompletion_annotation_topLevelVar', ''' | 1013 buildTests( |
| 1014 'testCompletion_annotation_topLevelVar', |
| 1015 ''' |
761 const fooConst = null; | 1016 const fooConst = null; |
762 final fooNotConst = null; | 1017 final fooNotConst = null; |
763 const bar = null; | 1018 const bar = null; |
764 | 1019 |
765 @foo!1 | 1020 @foo!1 |
766 main() { | 1021 main() { |
767 }''', <String>["1+fooConst", "1-fooNotConst", "1-bar"], failingTests: '1'); | 1022 }''', |
| 1023 <String>["1+fooConst", "1-fooNotConst", "1-bar"], |
| 1024 failingTests: '1'); |
768 | 1025 |
769 buildTests('testCompletion_annotation_type', ''' | 1026 buildTests( |
| 1027 'testCompletion_annotation_type', |
| 1028 ''' |
770 class AAA { | 1029 class AAA { |
771 const AAA({int a, int b}); | 1030 const AAA({int a, int b}); |
772 const AAA.nnn(int c, int d); | 1031 const AAA.nnn(int c, int d); |
773 } | 1032 } |
774 @AAA!1 | 1033 @AAA!1 |
775 main() { | 1034 main() { |
776 }''', <String>[ | 1035 }''', |
777 "1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/, | 1036 <String>[ |
778 "1+AAA.nnn" /*":" + ProposalKind.CONSTRUCTOR*/ | 1037 "1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/, |
779 ], failingTests: '1'); | 1038 "1+AAA.nnn" /*":" + ProposalKind.CONSTRUCTOR*/ |
| 1039 ], |
| 1040 failingTests: '1'); |
780 | 1041 |
781 buildTests('testCompletion_annotation_type_inClass_withoutMember', ''' | 1042 buildTests( |
| 1043 'testCompletion_annotation_type_inClass_withoutMember', |
| 1044 ''' |
782 class AAA { | 1045 class AAA { |
783 const AAA(); | 1046 const AAA(); |
784 } | 1047 } |
785 | 1048 |
786 class C { | 1049 class C { |
787 @A!1 | 1050 @A!1 |
788 }''', <String>["1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/]); | 1051 }''', |
| 1052 <String>["1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/]); |
789 | 1053 |
790 buildTests('testCompletion_argument_typeName', ''' | 1054 buildTests( |
| 1055 'testCompletion_argument_typeName', |
| 1056 ''' |
791 class Enum { | 1057 class Enum { |
792 static Enum FOO = new Enum(); | 1058 static Enum FOO = new Enum(); |
793 } | 1059 } |
794 f(Enum e) {} | 1060 f(Enum e) {} |
795 main() { | 1061 main() { |
796 f(En!1); | 1062 f(En!1); |
797 }''', <String>["1+Enum"]); | 1063 }''', |
| 1064 <String>["1+Enum"]); |
798 | 1065 |
799 buildTests('testCompletion_arguments_ignoreEmpty', ''' | 1066 buildTests( |
| 1067 'testCompletion_arguments_ignoreEmpty', |
| 1068 ''' |
800 class A { | 1069 class A { |
801 test() {} | 1070 test() {} |
802 } | 1071 } |
803 main(A a) { | 1072 main(A a) { |
804 a.test(!1); | 1073 a.test(!1); |
805 }''', <String>["1-test"]); | 1074 }''', |
| 1075 <String>["1-test"]); |
806 | 1076 |
807 buildTests('testCompletion_as_asIdentifierPrefix', ''' | 1077 buildTests( |
| 1078 'testCompletion_as_asIdentifierPrefix', |
| 1079 ''' |
808 main(p) { | 1080 main(p) { |
809 var asVisible; | 1081 var asVisible; |
810 var v = as!1; | 1082 var v = as!1; |
811 }''', <String>["1+asVisible"]); | 1083 }''', |
| 1084 <String>["1+asVisible"]); |
812 | 1085 |
813 buildTests('testCompletion_as_asPrefixedIdentifierStart', ''' | 1086 buildTests( |
| 1087 'testCompletion_as_asPrefixedIdentifierStart', |
| 1088 ''' |
814 class A { | 1089 class A { |
815 var asVisible; | 1090 var asVisible; |
816 } | 1091 } |
817 | 1092 |
818 main(A p) { | 1093 main(A p) { |
819 var v = p.as!1; | 1094 var v = p.as!1; |
820 }''', <String>["1+asVisible"]); | 1095 }''', |
| 1096 <String>["1+asVisible"]); |
821 | 1097 |
822 buildTests('testCompletion_as_incompleteStatement', ''' | 1098 buildTests( |
| 1099 'testCompletion_as_incompleteStatement', |
| 1100 ''' |
823 class MyClass {} | 1101 class MyClass {} |
824 main(p) { | 1102 main(p) { |
825 var justSomeVar; | 1103 var justSomeVar; |
826 var v = p as !1 | 1104 var v = p as !1 |
827 }''', <String>["1+MyClass", "1-justSomeVar"]); | 1105 }''', |
| 1106 <String>["1+MyClass", "1-justSomeVar"]); |
828 | 1107 |
829 buildTests('testCompletion_cascade', ''' | 1108 buildTests( |
| 1109 'testCompletion_cascade', |
| 1110 ''' |
830 class A { | 1111 class A { |
831 aaa() {} | 1112 aaa() {} |
832 } | 1113 } |
833 | 1114 |
834 | 1115 |
835 main(A a) { | 1116 main(A a) { |
836 a..!1 aaa(); | 1117 a..!1 aaa(); |
837 }''', <String>["1+aaa", "1-main"]); | 1118 }''', |
| 1119 <String>["1+aaa", "1-main"]); |
838 | 1120 |
839 buildTests('testCompletion_combinator_afterComma', ''' | 1121 buildTests( |
| 1122 'testCompletion_combinator_afterComma', |
| 1123 ''' |
840 "import 'dart:math' show cos, !1;''', | 1124 "import 'dart:math' show cos, !1;''', |
841 <String>["1+PI", "1+sin", "1+Random", "1-String"], failingTests: '1'); | 1125 <String>["1+PI", "1+sin", "1+Random", "1-String"], |
| 1126 failingTests: '1'); |
842 | 1127 |
843 buildTests('testCompletion_combinator_ended', ''' | 1128 buildTests( |
| 1129 'testCompletion_combinator_ended', |
| 1130 ''' |
844 import 'dart:math' show !1;"''', | 1131 import 'dart:math' show !1;"''', |
845 <String>["1+PI", "1+sin", "1+Random", "1-String"]); | 1132 <String>["1+PI", "1+sin", "1+Random", "1-String"]); |
846 | 1133 |
847 buildTests('testCompletion_combinator_export', ''' | 1134 buildTests( |
| 1135 'testCompletion_combinator_export', |
| 1136 ''' |
848 export 'dart:math' show !1;"''', | 1137 export 'dart:math' show !1;"''', |
849 <String>["1+PI", "1+sin", "1+Random", "1-String"]); | 1138 <String>["1+PI", "1+sin", "1+Random", "1-String"]); |
850 | 1139 |
851 buildTests('testCompletion_combinator_hide', ''' | 1140 buildTests( |
| 1141 'testCompletion_combinator_hide', |
| 1142 ''' |
852 import 'dart:math' hide !1;"''', | 1143 import 'dart:math' hide !1;"''', |
853 <String>["1+PI", "1+sin", "1+Random", "1-String"]); | 1144 <String>["1+PI", "1+sin", "1+Random", "1-String"]); |
854 | 1145 |
855 buildTests('testCompletion_combinator_notEnded', ''' | 1146 buildTests( |
| 1147 'testCompletion_combinator_notEnded', |
| 1148 ''' |
856 import 'dart:math' show !1"''', | 1149 import 'dart:math' show !1"''', |
857 <String>["1+PI", "1+sin", "1+Random", "1-String"]); | 1150 <String>["1+PI", "1+sin", "1+Random", "1-String"]); |
858 | 1151 |
859 buildTests('testCompletion_combinator_usePrefix', ''' | 1152 buildTests( |
| 1153 'testCompletion_combinator_usePrefix', |
| 1154 ''' |
860 import 'dart:math' show s!1"''', | 1155 import 'dart:math' show s!1"''', |
861 <String>["1+sin", "1+sqrt", "1-cos", "1-String"]); | 1156 <String>["1+sin", "1+sqrt", "1-cos", "1-String"]); |
862 | 1157 |
863 buildTests('testCompletion_constructor_field', ''' | 1158 buildTests( |
864 class X { X(this.field); int f!1ield;}''', <String>["1+field"], | 1159 'testCompletion_constructor_field', |
| 1160 ''' |
| 1161 class X { X(this.field); int f!1ield;}''', |
| 1162 <String>["1+field"], |
865 failingTests: '1'); | 1163 failingTests: '1'); |
866 | 1164 |
867 buildTests('testCompletion_constructorArguments_showOnlyCurrent', ''' | 1165 buildTests( |
| 1166 'testCompletion_constructorArguments_showOnlyCurrent', |
| 1167 ''' |
868 class A { | 1168 class A { |
869 A.first(int p); | 1169 A.first(int p); |
870 A.second(double p); | 1170 A.second(double p); |
871 } | 1171 } |
872 main() { | 1172 main() { |
873 new A.first(!1); | 1173 new A.first(!1); |
874 }''', <String>["1+A.first", "1-A.second"], failingTests: '1'); | 1174 }''', |
| 1175 <String>["1+A.first", "1-A.second"], |
| 1176 failingTests: '1'); |
875 | 1177 |
876 buildTests('testCompletion_constructorArguments_whenPrefixedType', ''' | 1178 buildTests( |
| 1179 'testCompletion_constructorArguments_whenPrefixedType', |
| 1180 ''' |
877 import 'dart:math' as m; | 1181 import 'dart:math' as m; |
878 main() { | 1182 main() { |
879 new m.Random(!1); | 1183 new m.Random(!1); |
880 }''', <String>["1+Random:ARGUMENT_LIST"], failingTests: '1'); | 1184 }''', |
| 1185 <String>["1+Random:ARGUMENT_LIST"], |
| 1186 failingTests: '1'); |
881 | 1187 |
882 buildTests('testCompletion_dartDoc_reference_forClass', ''' | 1188 buildTests( |
| 1189 'testCompletion_dartDoc_reference_forClass', |
| 1190 ''' |
883 /** | 1191 /** |
884 * [int!1] | 1192 * [int!1] |
885 * [method!2] | 1193 * [method!2] |
886 */ | 1194 */ |
887 class AAA { | 1195 class AAA { |
888 methodA() {} | 1196 methodA() {} |
889 }''', <String>["1+int", "1-method", "2+methodA", "2-int"]); | 1197 }''', |
| 1198 <String>["1+int", "1-method", "2+methodA", "2-int"]); |
890 | 1199 |
891 buildTests('testCompletion_dartDoc_reference_forConstructor', ''' | 1200 buildTests( |
| 1201 'testCompletion_dartDoc_reference_forConstructor', |
| 1202 ''' |
892 class A { | 1203 class A { |
893 /** | 1204 /** |
894 * [aa!1] | 1205 * [aa!1] |
895 * [int!2] | 1206 * [int!2] |
896 * [method!3] | 1207 * [method!3] |
897 */ | 1208 */ |
898 A.named(aaa, bbb) {} | 1209 A.named(aaa, bbb) {} |
899 methodA() {} | 1210 methodA() {} |
900 }''', <String>["1+aaa", "1-bbb", "2+int", "2-double", "3+methodA"]); | 1211 }''', |
| 1212 <String>["1+aaa", "1-bbb", "2+int", "2-double", "3+methodA"]); |
901 | 1213 |
902 buildTests('testCompletion_dartDoc_reference_forFunction', ''' | 1214 buildTests( |
| 1215 'testCompletion_dartDoc_reference_forFunction', |
| 1216 ''' |
903 /** | 1217 /** |
904 * [aa!1] | 1218 * [aa!1] |
905 * [int!2] | 1219 * [int!2] |
906 * [function!3] | 1220 * [function!3] |
907 */ | 1221 */ |
908 functionA(aaa, bbb) {} | 1222 functionA(aaa, bbb) {} |
909 functionB() {}''', <String>[ | 1223 functionB() {}''', |
910 "1+aaa", | 1224 <String>[ |
911 "1-bbb", | 1225 "1+aaa", |
912 "2+int", | 1226 "1-bbb", |
913 "2-double", | 1227 "2+int", |
914 "3+functionA", | 1228 "2-double", |
915 "3+functionB", | 1229 "3+functionA", |
916 "3-int" | 1230 "3+functionB", |
917 ], failingTests: '1'); | 1231 "3-int" |
| 1232 ], |
| 1233 failingTests: '1'); |
918 | 1234 |
919 buildTests('testCompletion_dartDoc_reference_forFunctionTypeAlias', ''' | 1235 buildTests( |
| 1236 'testCompletion_dartDoc_reference_forFunctionTypeAlias', |
| 1237 ''' |
920 /** | 1238 /** |
921 * [aa!1] | 1239 * [aa!1] |
922 * [int!2] | 1240 * [int!2] |
923 * [Function!3] | 1241 * [Function!3] |
924 */ | 1242 */ |
925 typedef FunctionA(aaa, bbb) {} | 1243 typedef FunctionA(aaa, bbb) {} |
926 typedef FunctionB() {}''', <String>[ | 1244 typedef FunctionB() {}''', |
927 "1+aaa", | 1245 <String>[ |
928 "1-bbb", | 1246 "1+aaa", |
929 "2+int", | 1247 "1-bbb", |
930 "2-double", | 1248 "2+int", |
931 "3+FunctionA", | 1249 "2-double", |
932 "3+FunctionB", | 1250 "3+FunctionA", |
933 "3-int" | 1251 "3+FunctionB", |
934 ], failingTests: '1'); | 1252 "3-int" |
| 1253 ], |
| 1254 failingTests: '1'); |
935 | 1255 |
936 buildTests('testCompletion_dartDoc_reference_forMethod', ''' | 1256 buildTests( |
| 1257 'testCompletion_dartDoc_reference_forMethod', |
| 1258 ''' |
937 class A { | 1259 class A { |
938 /** | 1260 /** |
939 * [aa!1] | 1261 * [aa!1] |
940 * [int!2] | 1262 * [int!2] |
941 * [method!3] | 1263 * [method!3] |
942 */ | 1264 */ |
943 methodA(aaa, bbb) {} | 1265 methodA(aaa, bbb) {} |
944 methodB() {} | 1266 methodB() {} |
945 }''', <String>[ | 1267 }''', |
| 1268 <String>[ |
946 "1+aaa", | 1269 "1+aaa", |
947 "1-bbb", | 1270 "1-bbb", |
948 "2+int", | 1271 "2+int", |
949 "2-double", | 1272 "2-double", |
950 "3+methodA", | 1273 "3+methodA", |
951 "3+methodB", | 1274 "3+methodB", |
952 "3-int" | 1275 "3-int" |
953 ]); | 1276 ]); |
954 | 1277 |
955 buildTests('testCompletion_dartDoc_reference_incomplete', ''' | 1278 buildTests( |
| 1279 'testCompletion_dartDoc_reference_incomplete', |
| 1280 ''' |
956 /** | 1281 /** |
957 * [doubl!1 some text | 1282 * [doubl!1 some text |
958 * other text | 1283 * other text |
959 */ | 1284 */ |
960 class A {} | 1285 class A {} |
961 /** | 1286 /** |
962 * [!2 some text | 1287 * [!2 some text |
963 * other text | 1288 * other text |
964 */ | 1289 */ |
965 class B {} | 1290 class B {} |
966 /** | 1291 /** |
967 * [!3] some text | 1292 * [!3] some text |
968 */ | 1293 */ |
969 class C {}''', <String>[ | 1294 class C {}''', |
| 1295 <String>[ |
970 "1+double", | 1296 "1+double", |
971 "1-int", | 1297 "1-int", |
972 "2+int", | 1298 "2+int", |
973 "2+String", | 1299 "2+String", |
974 "3+int", | 1300 "3+int", |
975 "3+String" | 1301 "3+String" |
976 ]); | 1302 ]); |
977 | 1303 |
978 buildTests('testCompletion_double_inFractionPart', ''' | 1304 buildTests( |
| 1305 'testCompletion_double_inFractionPart', |
| 1306 ''' |
979 main() { | 1307 main() { |
980 1.0!1 | 1308 1.0!1 |
981 }''', <String>["1-abs", "1-main"]); | 1309 }''', |
| 1310 <String>["1-abs", "1-main"]); |
982 | 1311 |
983 buildTests('testCompletion_enum', ''' | 1312 buildTests( |
| 1313 'testCompletion_enum', |
| 1314 ''' |
984 enum MyEnum {A, B, C} | 1315 enum MyEnum {A, B, C} |
985 main() { | 1316 main() { |
986 MyEnum.!1; | 1317 MyEnum.!1; |
987 }''', <String>["1+values", "1+A", "1+B", "1+C"]); | 1318 }''', |
| 1319 <String>["1+values", "1+A", "1+B", "1+C"]); |
988 | 1320 |
989 buildTests('testCompletion_exactPrefix_hasHigherRelevance', ''' | 1321 buildTests( |
| 1322 'testCompletion_exactPrefix_hasHigherRelevance', |
| 1323 ''' |
990 var STR; | 1324 var STR; |
991 main(p) { | 1325 main(p) { |
992 var str; | 1326 var str; |
993 str!1; | 1327 str!1; |
994 STR!2; | 1328 STR!2; |
995 Str!3; | 1329 Str!3; |
996 }''', <String>[ | 1330 }''', |
| 1331 <String>[ |
997 "1+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, | 1332 "1+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, |
998 "1+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, | 1333 "1+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, |
999 "2+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, | 1334 "2+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, |
1000 "2+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, | 1335 "2+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, |
1001 "3+String" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, | 1336 "3+String" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, |
1002 "3+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, | 1337 "3+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, |
1003 "3+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/ | 1338 "3+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/ |
1004 ]); | 1339 ]); |
1005 | 1340 |
1006 buildTests('testCompletion_export_dart', ''' | 1341 buildTests( |
| 1342 'testCompletion_export_dart', |
| 1343 ''' |
1007 import 'dart:math | 1344 import 'dart:math |
1008 import 'dart:_chrome | 1345 import 'dart:_chrome |
1009 import 'dart:_collection.dev | 1346 import 'dart:_collection.dev |
1010 export 'dart:!1''', <String>[ | 1347 export 'dart:!1''', |
1011 "1+dart:core", | 1348 <String>[ |
1012 "1+dart:math", | 1349 "1+dart:core", |
1013 "1-dart:_chrome", | 1350 "1+dart:math", |
1014 "1-dart:_collection.dev" | 1351 "1-dart:_chrome", |
1015 ], failingTests: '1'); | 1352 "1-dart:_collection.dev" |
| 1353 ], |
| 1354 failingTests: '1'); |
1016 | 1355 |
1017 buildTests('testCompletion_export_noStringLiteral_noSemicolon', ''' | 1356 buildTests( |
| 1357 'testCompletion_export_noStringLiteral_noSemicolon', |
| 1358 ''' |
1018 import !1 | 1359 import !1 |
1019 | 1360 |
1020 class A {}''', <String>["1+'dart:!';", "1+'package:!';"], failingTests: '1'); | 1361 class A {}''', |
| 1362 <String>["1+'dart:!';", "1+'package:!';"], |
| 1363 failingTests: '1'); |
1021 | 1364 |
1022 buildTests('testCompletion_forStmt_vars', ''' | 1365 buildTests( |
| 1366 'testCompletion_forStmt_vars', |
| 1367 ''' |
1023 class int{}class Foo { mth() { for (in!1t i = 0; i!2 < 5; i!3++); }}''', | 1368 class int{}class Foo { mth() { for (in!1t i = 0; i!2 < 5; i!3++); }}''', |
1024 <String>["1+int", "2+i", "3+i"]); | 1369 <String>["1+int", "2+i", "3+i"]); |
1025 | 1370 |
1026 buildTests('testCompletion_function', ''' | 1371 buildTests( |
| 1372 'testCompletion_function', |
| 1373 ''' |
1027 class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1) => a.compareTo(b));
}}''', | 1374 class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1) => a.compareTo(b));
}}''', |
1028 <String>["1+String"]); | 1375 <String>["1+String"]); |
1029 | 1376 |
1030 buildTests('testCompletion_function_partial', ''' | 1377 buildTests( |
| 1378 'testCompletion_function_partial', |
| 1379 ''' |
1031 class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1)); }}''', | 1380 class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1)); }}''', |
1032 <String>["1+String"]); | 1381 <String>["1+String"]); |
1033 | 1382 |
1034 buildTests('testCompletion_functionTypeParameter_namedArgument', ''' | 1383 buildTests( |
| 1384 'testCompletion_functionTypeParameter_namedArgument', |
| 1385 ''' |
1035 typedef FFF(a, b, {x1, x2, y}); | 1386 typedef FFF(a, b, {x1, x2, y}); |
1036 main(FFF fff) { | 1387 main(FFF fff) { |
1037 fff(1, 2, !1)!2; | 1388 fff(1, 2, !1)!2; |
1038 }''', <String>["1+x1", "2-x2"], failingTests: '1'); | 1389 }''', |
| 1390 <String>["1+x1", "2-x2"], |
| 1391 failingTests: '1'); |
1039 | 1392 |
1040 buildTests('testCompletion_ifStmt_field1', ''' | 1393 buildTests( |
1041 class Foo { int myField = 7; mth() { if (!1) {}}}''', <String>["1+myField"]); | 1394 'testCompletion_ifStmt_field1', |
| 1395 ''' |
| 1396 class Foo { int myField = 7; mth() { if (!1) {}}}''', |
| 1397 <String>["1+myField"]); |
1042 | 1398 |
1043 buildTests('testCompletion_ifStmt_field1a', ''' | 1399 buildTests( |
1044 class Foo { int myField = 7; mth() { if (!1) }}''', <String>["1+myField"]); | 1400 'testCompletion_ifStmt_field1a', |
| 1401 ''' |
| 1402 class Foo { int myField = 7; mth() { if (!1) }}''', |
| 1403 <String>["1+myField"]); |
1045 | 1404 |
1046 buildTests('testCompletion_ifStmt_field2', ''' | 1405 buildTests( |
1047 class Foo { int myField = 7; mth() { if (m!1) {}}}''', <String>["1+myField"]); | 1406 'testCompletion_ifStmt_field2', |
| 1407 ''' |
| 1408 class Foo { int myField = 7; mth() { if (m!1) {}}}''', |
| 1409 <String>["1+myField"]); |
1048 | 1410 |
1049 buildTests('testCompletion_ifStmt_field2a', ''' | 1411 buildTests( |
1050 class Foo { int myField = 7; mth() { if (m!1) }}''', <String>["1+myField"]); | 1412 'testCompletion_ifStmt_field2a', |
| 1413 ''' |
| 1414 class Foo { int myField = 7; mth() { if (m!1) }}''', |
| 1415 <String>["1+myField"]); |
1051 | 1416 |
1052 buildTests('testCompletion_ifStmt_field2b', ''' | 1417 buildTests( |
1053 class Foo { myField = 7; mth() { if (m!1) {}}}''', <String>["1+myField"]); | 1418 'testCompletion_ifStmt_field2b', |
| 1419 ''' |
| 1420 class Foo { myField = 7; mth() { if (m!1) {}}}''', |
| 1421 <String>["1+myField"]); |
1054 | 1422 |
1055 buildTests('testCompletion_ifStmt_localVar', ''' | 1423 buildTests( |
1056 class Foo { mth() { int value = 7; if (v!1) {}}}''', <String>["1+value"]); | 1424 'testCompletion_ifStmt_localVar', |
| 1425 ''' |
| 1426 class Foo { mth() { int value = 7; if (v!1) {}}}''', |
| 1427 <String>["1+value"]); |
1057 | 1428 |
1058 buildTests('testCompletion_ifStmt_localVara', ''' | 1429 buildTests( |
1059 class Foo { mth() { value = 7; if (v!1) {}}}''', <String>["1-value"]); | 1430 'testCompletion_ifStmt_localVara', |
| 1431 ''' |
| 1432 class Foo { mth() { value = 7; if (v!1) {}}}''', |
| 1433 <String>["1-value"]); |
1060 | 1434 |
1061 buildTests('testCompletion_ifStmt_topLevelVar', ''' | 1435 buildTests( |
1062 int topValue = 7; class Foo { mth() { if (t!1) {}}}''', <String>["1+topValue"]); | 1436 'testCompletion_ifStmt_topLevelVar', |
| 1437 ''' |
| 1438 int topValue = 7; class Foo { mth() { if (t!1) {}}}''', |
| 1439 <String>["1+topValue"]); |
1063 | 1440 |
1064 buildTests('testCompletion_ifStmt_topLevelVara', ''' | 1441 buildTests( |
1065 topValue = 7; class Foo { mth() { if (t!1) {}}}''', <String>["1+topValue"]); | 1442 'testCompletion_ifStmt_topLevelVara', |
| 1443 ''' |
| 1444 topValue = 7; class Foo { mth() { if (t!1) {}}}''', |
| 1445 <String>["1+topValue"]); |
1066 | 1446 |
1067 buildTests('testCompletion_ifStmt_unionType_nonStrict', ''' | 1447 buildTests( |
| 1448 'testCompletion_ifStmt_unionType_nonStrict', |
| 1449 ''' |
1068 class A { a() => null; x() => null} | 1450 class A { a() => null; x() => null} |
1069 class B { a() => null; y() => null} | 1451 class B { a() => null; y() => null} |
1070 void main() { | 1452 void main() { |
1071 var x; | 1453 var x; |
1072 var c; | 1454 var c; |
1073 if(c) { | 1455 if(c) { |
1074 x = new A(); | 1456 x = new A(); |
1075 } else { | 1457 } else { |
1076 x = new B(); | 1458 x = new B(); |
1077 } | 1459 } |
1078 x.!1; | 1460 x.!1; |
1079 }''', <String>["1+a", "1+x", "1+y"], failingTests: '1'); | 1461 }''', |
| 1462 <String>["1+a", "1+x", "1+y"], |
| 1463 failingTests: '1'); |
1080 | 1464 |
1081 buildTests('testCompletion_ifStmt_unionType_strict', ''' | 1465 buildTests( |
| 1466 'testCompletion_ifStmt_unionType_strict', |
| 1467 ''' |
1082 class A { a() => null; x() => null} | 1468 class A { a() => null; x() => null} |
1083 class B { a() => null; y() => null} | 1469 class B { a() => null; y() => null} |
1084 void main() { | 1470 void main() { |
1085 var x; | 1471 var x; |
1086 var c; | 1472 var c; |
1087 if(c) { | 1473 if(c) { |
1088 x = new A(); | 1474 x = new A(); |
1089 } else { | 1475 } else { |
1090 x = new B(); | 1476 x = new B(); |
1091 } | 1477 } |
1092 x.!1; | 1478 x.!1; |
1093 }''', <String>["1+a", "1-x", "1-y"], failingTests: '1'); | 1479 }''', |
| 1480 <String>["1+a", "1-x", "1-y"], |
| 1481 failingTests: '1'); |
1094 | 1482 |
1095 buildTests('testCompletion_import', ''' | 1483 buildTests( |
1096 import '!1';''', <String>["1+dart:!", "1+package:!"]); | 1484 'testCompletion_import', |
| 1485 ''' |
| 1486 import '!1';''', |
| 1487 <String>["1+dart:!", "1+package:!"]); |
1097 | 1488 |
1098 buildTests('testCompletion_import_dart', ''' | 1489 buildTests( |
| 1490 'testCompletion_import_dart', |
| 1491 ''' |
1099 import 'dart:math | 1492 import 'dart:math |
1100 import 'dart:_chrome | 1493 import 'dart:_chrome |
1101 import 'dart:_collection.dev | 1494 import 'dart:_collection.dev |
1102 import 'dart:!1''', <String>[ | 1495 import 'dart:!1''', |
1103 "1+dart:core", | 1496 <String>[ |
1104 "1+dart:math", | 1497 "1+dart:core", |
1105 "1-dart:_chrome", | 1498 "1+dart:math", |
1106 "1-dart:_collection.dev" | 1499 "1-dart:_chrome", |
1107 ], failingTests: '1'); | 1500 "1-dart:_collection.dev" |
| 1501 ], |
| 1502 failingTests: '1'); |
1108 | 1503 |
1109 buildTests('testCompletion_import_hasStringLiteral_noSemicolon', ''' | 1504 buildTests( |
| 1505 'testCompletion_import_hasStringLiteral_noSemicolon', |
| 1506 ''' |
1110 import '!1' | 1507 import '!1' |
1111 | 1508 |
1112 class A {}''', <String>["1+dart:!", "1+package:!"]); | 1509 class A {}''', |
| 1510 <String>["1+dart:!", "1+package:!"]); |
1113 | 1511 |
1114 buildTests('testCompletion_import_noSpace', ''' | 1512 buildTests( |
1115 import!1''', <String>["1+ 'dart:!';", "1+ 'package:!';"], failingTests: '1'); | 1513 'testCompletion_import_noSpace', |
| 1514 ''' |
| 1515 import!1''', |
| 1516 <String>["1+ 'dart:!';", "1+ 'package:!';"], |
| 1517 failingTests: '1'); |
1116 | 1518 |
1117 buildTests('testCompletion_import_noStringLiteral', ''' | 1519 buildTests( |
1118 import !1;''', <String>["1+'dart:!'", "1+'package:!'"], failingTests: '1'); | 1520 'testCompletion_import_noStringLiteral', |
| 1521 ''' |
| 1522 import !1;''', |
| 1523 <String>["1+'dart:!'", "1+'package:!'"], |
| 1524 failingTests: '1'); |
1119 | 1525 |
1120 buildTests('testCompletion_import_noStringLiteral_noSemicolon', ''' | 1526 buildTests( |
| 1527 'testCompletion_import_noStringLiteral_noSemicolon', |
| 1528 ''' |
1121 import !1 | 1529 import !1 |
1122 | 1530 |
1123 class A {}''', <String>["1+'dart:!';", "1+'package:!';"], failingTests: '1'); | 1531 class A {}''', |
| 1532 <String>["1+'dart:!';", "1+'package:!';"], |
| 1533 failingTests: '1'); |
1124 | 1534 |
1125 buildTests('testCompletion_incompleteClassMember', ''' | 1535 buildTests( |
| 1536 'testCompletion_incompleteClassMember', |
| 1537 ''' |
1126 class A { | 1538 class A { |
1127 Str!1 | 1539 Str!1 |
1128 final f = null; | 1540 final f = null; |
1129 }''', <String>["1+String", "1-bool"]); | 1541 }''', |
| 1542 <String>["1+String", "1-bool"]); |
1130 | 1543 |
1131 buildTests('testCompletion_incompleteClosure_parameterType', ''' | 1544 buildTests( |
| 1545 'testCompletion_incompleteClosure_parameterType', |
| 1546 ''' |
1132 f1(cb(String s)) {} | 1547 f1(cb(String s)) {} |
1133 f2(String s) {} | 1548 f2(String s) {} |
1134 main() { | 1549 main() { |
1135 f1((Str!1)); | 1550 f1((Str!1)); |
1136 f2((Str!2)); | 1551 f2((Str!2)); |
1137 }''', <String>["1+String", "1-bool", "2+String", "2-bool"]); | 1552 }''', |
| 1553 <String>["1+String", "1-bool", "2+String", "2-bool"]); |
1138 | 1554 |
1139 buildTests('testCompletion_inPeriodPeriod', ''' | 1555 buildTests( |
| 1556 'testCompletion_inPeriodPeriod', |
| 1557 ''' |
1140 main(String str) { | 1558 main(String str) { |
1141 1 < str.!1.length; | 1559 1 < str.!1.length; |
1142 1 + str.!2.length; | 1560 1 + str.!2.length; |
1143 1 + 2 * str.!3.length; | 1561 1 + 2 * str.!3.length; |
1144 }''', <String>["1+codeUnits", "2+codeUnits", "3+codeUnits"], | 1562 }''', |
| 1563 <String>["1+codeUnits", "2+codeUnits", "3+codeUnits"], |
1145 failingTests: '123'); | 1564 failingTests: '123'); |
1146 | 1565 |
1147 // no checks, but no exceptions | 1566 // no checks, but no exceptions |
1148 buildTests('testCompletion_instanceCreation_unresolved', ''' | 1567 buildTests( |
| 1568 'testCompletion_instanceCreation_unresolved', |
| 1569 ''' |
1149 class A { | 1570 class A { |
1150 } | 1571 } |
1151 main() { | 1572 main() { |
1152 new NoSuchClass(!1); | 1573 new NoSuchClass(!1); |
1153 new A.noSuchConstructor(!2); | 1574 new A.noSuchConstructor(!2); |
1154 }''', <String>["1+int", "2+int"]); | 1575 }''', |
| 1576 <String>["1+int", "2+int"]); |
1155 | 1577 |
1156 buildTests('testCompletion_import_lib', ''' | 1578 buildTests( |
1157 import '!1''', <String>["1+my_lib.dart"], | 1579 'testCompletion_import_lib', |
1158 extraFiles: <String, String>{"/my_lib.dart": ""}, failingTests: '1'); | 1580 ''' |
| 1581 import '!1''', |
| 1582 <String>["1+my_lib.dart"], |
| 1583 extraFiles: <String, String>{"/my_lib.dart": ""}, |
| 1584 failingTests: '1'); |
1159 | 1585 |
1160 buildTests('testCompletion_is', ''' | 1586 buildTests( |
| 1587 'testCompletion_is', |
| 1588 ''' |
1161 class MyClass {} | 1589 class MyClass {} |
1162 main(p) { | 1590 main(p) { |
1163 var isVariable; | 1591 var isVariable; |
1164 if (p is MyCla!1) {} | 1592 if (p is MyCla!1) {} |
1165 var v1 = p is MyCla!2; | 1593 var v1 = p is MyCla!2; |
1166 var v2 = p is !3; | 1594 var v2 = p is !3; |
1167 var v2 = p is!4; | 1595 var v2 = p is!4; |
1168 }''', <String>[ | 1596 }''', |
1169 "1+MyClass", | 1597 <String>[ |
1170 "2+MyClass", | 1598 "1+MyClass", |
1171 "3+MyClass", | 1599 "2+MyClass", |
1172 "3-v1", | 1600 "3+MyClass", |
1173 "4+is", | 1601 "3-v1", |
1174 "4-isVariable" | 1602 "4+is", |
1175 ], failingTests: '4'); | 1603 "4-isVariable" |
| 1604 ], |
| 1605 failingTests: '4'); |
1176 | 1606 |
1177 buildTests('testCompletion_is_asIdentifierStart', ''' | 1607 buildTests( |
| 1608 'testCompletion_is_asIdentifierStart', |
| 1609 ''' |
1178 main(p) { | 1610 main(p) { |
1179 var isVisible; | 1611 var isVisible; |
1180 var v1 = is!1; | 1612 var v1 = is!1; |
1181 var v2 = is!2 | 1613 var v2 = is!2 |
1182 }''', <String>["1+isVisible", "2+isVisible"]); | 1614 }''', |
| 1615 <String>["1+isVisible", "2+isVisible"]); |
1183 | 1616 |
1184 buildTests('testCompletion_is_asPrefixedIdentifierStart', ''' | 1617 buildTests( |
| 1618 'testCompletion_is_asPrefixedIdentifierStart', |
| 1619 ''' |
1185 class A { | 1620 class A { |
1186 var isVisible; | 1621 var isVisible; |
1187 } | 1622 } |
1188 | 1623 |
1189 main(A p) { | 1624 main(A p) { |
1190 var v1 = p.is!1; | 1625 var v1 = p.is!1; |
1191 var v2 = p.is!2 | 1626 var v2 = p.is!2 |
1192 }''', <String>["1+isVisible", "2+isVisible"]); | 1627 }''', |
| 1628 <String>["1+isVisible", "2+isVisible"]); |
1193 | 1629 |
1194 buildTests('testCompletion_is_incompleteStatement1', ''' | 1630 buildTests( |
| 1631 'testCompletion_is_incompleteStatement1', |
| 1632 ''' |
1195 class MyClass {} | 1633 class MyClass {} |
1196 main(p) { | 1634 main(p) { |
1197 var justSomeVar; | 1635 var justSomeVar; |
1198 var v = p is !1 | 1636 var v = p is !1 |
1199 }''', <String>["1+MyClass", "1-justSomeVar"]); | 1637 }''', |
| 1638 <String>["1+MyClass", "1-justSomeVar"]); |
1200 | 1639 |
1201 buildTests('testCompletion_is_incompleteStatement2', ''' | 1640 buildTests( |
| 1641 'testCompletion_is_incompleteStatement2', |
| 1642 ''' |
1202 class MyClass {} | 1643 class MyClass {} |
1203 main(p) { | 1644 main(p) { |
1204 var isVariable; | 1645 var isVariable; |
1205 var v = p is!1 | 1646 var v = p is!1 |
1206 }''', <String>["1+is", "1-isVariable"], failingTests: '1'); | 1647 }''', |
| 1648 <String>["1+is", "1-isVariable"], |
| 1649 failingTests: '1'); |
1207 | 1650 |
1208 buildTests('testCompletion_keyword_in', ''' | 1651 buildTests( |
1209 class Foo { int input = 7; mth() { if (in!1) {}}}''', <String>["1+input"]); | 1652 'testCompletion_keyword_in', |
| 1653 ''' |
| 1654 class Foo { int input = 7; mth() { if (in!1) {}}}''', |
| 1655 <String>["1+input"]); |
1210 | 1656 |
1211 buildTests('testCompletion_keyword_syntheticIdentifier', ''' | 1657 buildTests( |
| 1658 'testCompletion_keyword_syntheticIdentifier', |
| 1659 ''' |
1212 main() { | 1660 main() { |
1213 var caseVar; | 1661 var caseVar; |
1214 var otherVar; | 1662 var otherVar; |
1215 var v = case!1 | 1663 var v = case!1 |
1216 }''', <String>["1+caseVar", "1-otherVar"]); | 1664 }''', |
| 1665 <String>["1+caseVar", "1-otherVar"]); |
1217 | 1666 |
1218 buildTests('testCompletion_libraryIdentifier_atEOF', ''' | 1667 buildTests( |
1219 library int.!1''', <String>["1-parse", "1-bool"]); | 1668 'testCompletion_libraryIdentifier_atEOF', |
| 1669 ''' |
| 1670 library int.!1''', |
| 1671 <String>["1-parse", "1-bool"]); |
1220 | 1672 |
1221 buildTests('testCompletion_libraryIdentifier_notEOF', ''' | 1673 buildTests( |
1222 library int.!1''', <String>["1-parse", "1-bool"]); | 1674 'testCompletion_libraryIdentifier_notEOF', |
| 1675 ''' |
| 1676 library int.!1''', |
| 1677 <String>["1-parse", "1-bool"]); |
1223 | 1678 |
1224 buildTests('testCompletion_methodRef_asArg_incompatibleFunctionType', ''' | 1679 buildTests( |
| 1680 'testCompletion_methodRef_asArg_incompatibleFunctionType', |
| 1681 ''' |
1225 foo( f(int p) ) {} | 1682 foo( f(int p) ) {} |
1226 class Functions { | 1683 class Functions { |
1227 static myFuncInt(int p) {} | 1684 static myFuncInt(int p) {} |
1228 static myFuncDouble(double p) {} | 1685 static myFuncDouble(double p) {} |
1229 } | 1686 } |
1230 bar(p) {} | 1687 bar(p) {} |
1231 main(p) { | 1688 main(p) { |
1232 foo( Functions.!1; ); | 1689 foo( Functions.!1; ); |
1233 }''', <String>[ | 1690 }''', |
1234 "1+myFuncInt" /*":" + ProposalKind.METHOD_NAME*/, | 1691 <String>[ |
1235 "1-myFuncDouble" /*":" + ProposalKind.METHOD_NAME*/ | 1692 "1+myFuncInt" /*":" + ProposalKind.METHOD_NAME*/, |
1236 ], failingTests: '1'); | 1693 "1-myFuncDouble" /*":" + ProposalKind.METHOD_NAME*/ |
| 1694 ], |
| 1695 failingTests: '1'); |
1237 | 1696 |
1238 buildTests('testCompletion_methodRef_asArg_notFunctionType', ''' | 1697 buildTests( |
| 1698 'testCompletion_methodRef_asArg_notFunctionType', |
| 1699 ''' |
1239 foo( f(int p) ) {} | 1700 foo( f(int p) ) {} |
1240 class Functions { | 1701 class Functions { |
1241 static myFunc(int p) {} | 1702 static myFunc(int p) {} |
1242 } | 1703 } |
1243 bar(p) {} | 1704 bar(p) {} |
1244 main(p) { | 1705 main(p) { |
1245 foo( (int p) => Functions.!1; ); | 1706 foo( (int p) => Functions.!1; ); |
1246 }''', <String>[ | 1707 }''', |
1247 "1+myFunc" /*":" + ProposalKind.METHOD*/, | 1708 <String>[ |
1248 "1-myFunc" /*":" + ProposalKind.METHOD_NAME*/ | 1709 "1+myFunc" /*":" + ProposalKind.METHOD*/, |
1249 ], failingTests: '1'); | 1710 "1-myFunc" /*":" + ProposalKind.METHOD_NAME*/ |
| 1711 ], |
| 1712 failingTests: '1'); |
1250 | 1713 |
1251 buildTests('testCompletion_methodRef_asArg_ofFunctionType', ''' | 1714 buildTests( |
| 1715 'testCompletion_methodRef_asArg_ofFunctionType', |
| 1716 ''' |
1252 foo( f(int p) ) {} | 1717 foo( f(int p) ) {} |
1253 class Functions { | 1718 class Functions { |
1254 static int myFunc(int p) {} | 1719 static int myFunc(int p) {} |
1255 } | 1720 } |
1256 main(p) { | 1721 main(p) { |
1257 foo(Functions.!1); | 1722 foo(Functions.!1); |
1258 }''', <String>[ | 1723 }''', |
| 1724 <String>[ |
1259 "1+myFunc" /*":" + ProposalKind.METHOD*/, | 1725 "1+myFunc" /*":" + ProposalKind.METHOD*/, |
1260 "1+myFunc" /*":" + ProposalKind.METHOD_NAME*/ | 1726 "1+myFunc" /*":" + ProposalKind.METHOD_NAME*/ |
1261 ]); | 1727 ]); |
1262 | 1728 |
1263 buildTests('testCompletion_namedArgument_alreadyUsed', ''' | 1729 buildTests( |
1264 func({foo}) {} main() { func(foo: 0, fo!1); }''', <String>["1-foo"]); | 1730 'testCompletion_namedArgument_alreadyUsed', |
| 1731 ''' |
| 1732 func({foo}) {} main() { func(foo: 0, fo!1); }''', |
| 1733 <String>["1-foo"]); |
1265 | 1734 |
1266 buildTests('testCompletion_namedArgument_constructor', ''' | 1735 buildTests( |
| 1736 'testCompletion_namedArgument_constructor', |
| 1737 ''' |
1267 class A {A({foo, bar}) {}} main() { new A(fo!1); }''', | 1738 class A {A({foo, bar}) {}} main() { new A(fo!1); }''', |
1268 <String>["1+foo", "1-bar"], failingTests: '1'); | 1739 <String>["1+foo", "1-bar"], |
| 1740 failingTests: '1'); |
1269 | 1741 |
1270 buildTests('testCompletion_namedArgument_empty', ''' | 1742 buildTests( |
1271 func({foo, bar}) {} main() { func(!1); }''', <String>[ | 1743 'testCompletion_namedArgument_empty', |
1272 "1+foo" /*":" + ProposalKind.NAMED_ARGUMENT*/, | 1744 ''' |
1273 "1-foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/ | 1745 func({foo, bar}) {} main() { func(!1); }''', |
1274 ], failingTests: '1'); | 1746 <String>[ |
| 1747 "1+foo" /*":" + ProposalKind.NAMED_ARGUMENT*/, |
| 1748 "1-foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/ |
| 1749 ], |
| 1750 failingTests: '1'); |
1275 | 1751 |
1276 buildTests('testCompletion_namedArgument_function', ''' | 1752 buildTests( |
| 1753 'testCompletion_namedArgument_function', |
| 1754 ''' |
1277 func({foo, bar}) {} main() { func(fo!1); }''', | 1755 func({foo, bar}) {} main() { func(fo!1); }''', |
1278 <String>["1+foo", "1-bar"], failingTests: '1'); | 1756 <String>["1+foo", "1-bar"], |
| 1757 failingTests: '1'); |
1279 | 1758 |
1280 buildTests('testCompletion_namedArgument_notNamed', ''' | 1759 buildTests( |
1281 func([foo]) {} main() { func(fo!1); }''', <String>["1-foo"]); | 1760 'testCompletion_namedArgument_notNamed', |
| 1761 ''' |
| 1762 func([foo]) {} main() { func(fo!1); }''', |
| 1763 <String>["1-foo"]); |
1282 | 1764 |
1283 buildTests('testCompletion_namedArgument_unresolvedFunction', ''' | 1765 buildTests( |
1284 main() { func(fo!1); }''', <String>["1-foo"]); | 1766 'testCompletion_namedArgument_unresolvedFunction', |
| 1767 ''' |
| 1768 main() { func(fo!1); }''', |
| 1769 <String>["1-foo"]); |
1285 | 1770 |
1286 buildTests('testCompletion_newMemberType1', ''' | 1771 buildTests( |
| 1772 'testCompletion_newMemberType1', |
| 1773 ''' |
1287 class Collection{}class List extends Collection{}class Foo { !1 }''', | 1774 class Collection{}class List extends Collection{}class Foo { !1 }''', |
1288 <String>["1+Collection", "1+List"]); | 1775 <String>["1+Collection", "1+List"]); |
1289 | 1776 |
1290 buildTests('testCompletion_newMemberType2', ''' | 1777 buildTests( |
| 1778 'testCompletion_newMemberType2', |
| 1779 ''' |
1291 class Collection{}class List extends Collection{}class Foo {!1}''', | 1780 class Collection{}class List extends Collection{}class Foo {!1}''', |
1292 <String>["1+Collection", "1+List"]); | 1781 <String>["1+Collection", "1+List"]); |
1293 | 1782 |
1294 buildTests('testCompletion_newMemberType3', ''' | 1783 buildTests( |
| 1784 'testCompletion_newMemberType3', |
| 1785 ''' |
1295 class Collection{}class List extends Collection{}class Foo {L!1}''', | 1786 class Collection{}class List extends Collection{}class Foo {L!1}''', |
1296 <String>["1-Collection", "1+List"]); | 1787 <String>["1-Collection", "1+List"]); |
1297 | 1788 |
1298 buildTests('testCompletion_newMemberType4', ''' | 1789 buildTests( |
| 1790 'testCompletion_newMemberType4', |
| 1791 ''' |
1299 class Collection{}class List extends Collection{}class Foo {C!1}''', | 1792 class Collection{}class List extends Collection{}class Foo {C!1}''', |
1300 <String>["1+Collection", "1-List"]); | 1793 <String>["1+Collection", "1-List"]); |
1301 | 1794 |
1302 buildTests('testCompletion_positionalArgument_constructor', ''' | 1795 buildTests( |
| 1796 'testCompletion_positionalArgument_constructor', |
| 1797 ''' |
1303 class A { | 1798 class A { |
1304 A([foo, bar]); | 1799 A([foo, bar]); |
1305 } | 1800 } |
1306 main() { | 1801 main() { |
1307 new A(!1); | 1802 new A(!1); |
1308 new A(0, !2); | 1803 new A(0, !2); |
1309 }''', <String>[ | 1804 }''', |
1310 "1+foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/, | 1805 <String>[ |
1311 "1-bar", | 1806 "1+foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/, |
1312 "2-foo", | 1807 "1-bar", |
1313 "2+bar" /*":" | 1808 "2-foo", |
| 1809 "2+bar" /*":" |
1314 + ProposalKind.OPTIONAL_ARGUMENT*/ | 1810 + ProposalKind.OPTIONAL_ARGUMENT*/ |
1315 ], failingTests: '12'); | 1811 ], |
| 1812 failingTests: '12'); |
1316 | 1813 |
1317 buildTests('testCompletion_positionalArgument_function', ''' | 1814 buildTests( |
| 1815 'testCompletion_positionalArgument_function', |
| 1816 ''' |
1318 func([foo, bar]) {} | 1817 func([foo, bar]) {} |
1319 main() { | 1818 main() { |
1320 func(!1); | 1819 func(!1); |
1321 func(0, !2); | 1820 func(0, !2); |
1322 }''', <String>[ | 1821 }''', |
1323 "1+foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/, | 1822 <String>[ |
1324 "1-bar", | 1823 "1+foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/, |
1325 "2-foo", | 1824 "1-bar", |
1326 "2+bar" /*":" | 1825 "2-foo", |
| 1826 "2+bar" /*":" |
1327 + ProposalKind.OPTIONAL_ARGUMENT*/ | 1827 + ProposalKind.OPTIONAL_ARGUMENT*/ |
1328 ], failingTests: '12'); | 1828 ], |
| 1829 failingTests: '12'); |
1329 | 1830 |
1330 buildTests('testCompletion_preferStaticType', ''' | 1831 buildTests( |
| 1832 'testCompletion_preferStaticType', |
| 1833 ''' |
1331 class A { | 1834 class A { |
1332 foo() {} | 1835 foo() {} |
1333 } | 1836 } |
1334 class B extends A { | 1837 class B extends A { |
1335 bar() {} | 1838 bar() {} |
1336 } | 1839 } |
1337 main() { | 1840 main() { |
1338 A v = new B(); | 1841 A v = new B(); |
1339 v.!1 | 1842 v.!1 |
1340 }''', <String>[ | 1843 }''', |
1341 "1+foo", | 1844 <String>[ |
1342 "1-bar,potential=false,declaringType=B", | 1845 "1+foo", |
1343 "1+bar,potential=true,declaringType=B" | 1846 "1-bar,potential=false,declaringType=B", |
1344 ], failingTests: '1'); | 1847 "1+bar,potential=true,declaringType=B" |
| 1848 ], |
| 1849 failingTests: '1'); |
1345 | 1850 |
1346 buildTests('testCompletion_privateElement_sameLibrary_constructor', ''' | 1851 buildTests( |
| 1852 'testCompletion_privateElement_sameLibrary_constructor', |
| 1853 ''' |
1347 class A { | 1854 class A { |
1348 A._c(); | 1855 A._c(); |
1349 A.c(); | 1856 A.c(); |
1350 } | 1857 } |
1351 main() { | 1858 main() { |
1352 new A.!1 | 1859 new A.!1 |
1353 }''', <String>["1+_c", "1+c"]); | 1860 }''', |
| 1861 <String>["1+_c", "1+c"]); |
1354 | 1862 |
1355 buildTests('testCompletion_privateElement_sameLibrary_member', ''' | 1863 buildTests( |
| 1864 'testCompletion_privateElement_sameLibrary_member', |
| 1865 ''' |
1356 class A { | 1866 class A { |
1357 _m() {} | 1867 _m() {} |
1358 m() {} | 1868 m() {} |
1359 } | 1869 } |
1360 main(A a) { | 1870 main(A a) { |
1361 a.!1 | 1871 a.!1 |
1362 }''', <String>["1+_m", "1+m"]); | 1872 }''', |
| 1873 <String>["1+_m", "1+m"]); |
1363 | 1874 |
1364 buildTests('testCompletion_propertyAccess_whenClassTarget', ''' | 1875 buildTests( |
| 1876 'testCompletion_propertyAccess_whenClassTarget', |
| 1877 ''' |
1365 class A { | 1878 class A { |
1366 static int FIELD; | 1879 static int FIELD; |
1367 int field; | 1880 int field; |
1368 } | 1881 } |
1369 main() { | 1882 main() { |
1370 A.!1 | 1883 A.!1 |
1371 }''', <String>["1+FIELD", "1-field"]); | 1884 }''', |
| 1885 <String>["1+FIELD", "1-field"]); |
1372 | 1886 |
1373 buildTests('testCompletion_propertyAccess_whenClassTarget_excludeSuper', ''' | 1887 buildTests( |
| 1888 'testCompletion_propertyAccess_whenClassTarget_excludeSuper', |
| 1889 ''' |
1374 class A { | 1890 class A { |
1375 static int FIELD_A; | 1891 static int FIELD_A; |
1376 static int methodA() {} | 1892 static int methodA() {} |
1377 } | 1893 } |
1378 class B extends A { | 1894 class B extends A { |
1379 static int FIELD_B; | 1895 static int FIELD_B; |
1380 static int methodB() {} | 1896 static int methodB() {} |
1381 } | 1897 } |
1382 main() { | 1898 main() { |
1383 B.!1; | 1899 B.!1; |
1384 }''', <String>["1+FIELD_B", "1-FIELD_A", "1+methodB", "1-methodA"], | 1900 }''', |
| 1901 <String>["1+FIELD_B", "1-FIELD_A", "1+methodB", "1-methodA"], |
1385 failingTests: '1'); | 1902 failingTests: '1'); |
1386 | 1903 |
1387 buildTests('testCompletion_propertyAccess_whenInstanceTarget', ''' | 1904 buildTests( |
| 1905 'testCompletion_propertyAccess_whenInstanceTarget', |
| 1906 ''' |
1388 class A { | 1907 class A { |
1389 static int FIELD; | 1908 static int FIELD; |
1390 int fieldA; | 1909 int fieldA; |
1391 } | 1910 } |
1392 class B { | 1911 class B { |
1393 A a; | 1912 A a; |
1394 } | 1913 } |
1395 class C extends A { | 1914 class C extends A { |
1396 int fieldC; | 1915 int fieldC; |
1397 } | 1916 } |
1398 main(B b, C c) { | 1917 main(B b, C c) { |
1399 b.a.!1; | 1918 b.a.!1; |
1400 c.!2; | 1919 c.!2; |
1401 }''', <String>["1-FIELD", "1+fieldA", "2+fieldC", "2+fieldA"]); | 1920 }''', |
| 1921 <String>["1-FIELD", "1+fieldA", "2+fieldC", "2+fieldA"]); |
1402 | 1922 |
1403 buildTests('testCompletion_return_withIdentifierPrefix', ''' | 1923 buildTests( |
1404 f() { var vvv = 42; return v!1 }''', <String>["1+vvv"]); | 1924 'testCompletion_return_withIdentifierPrefix', |
| 1925 ''' |
| 1926 f() { var vvv = 42; return v!1 }''', |
| 1927 <String>["1+vvv"]); |
1405 | 1928 |
1406 buildTests('testCompletion_return_withoutExpression', ''' | 1929 buildTests( |
1407 f() { var vvv = 42; return !1 }''', <String>["1+vvv"]); | 1930 'testCompletion_return_withoutExpression', |
| 1931 ''' |
| 1932 f() { var vvv = 42; return !1 }''', |
| 1933 <String>["1+vvv"]); |
1408 | 1934 |
1409 buildTests('testCompletion_staticField1', ''' | 1935 buildTests( |
| 1936 'testCompletion_staticField1', |
| 1937 ''' |
1410 class num{}class Sunflower {static final n!2um MAX_D = 300;nu!3m xc, yc;Sun!4flo
wer() {x!Xc = y!Yc = MA!1 }}''', | 1938 class num{}class Sunflower {static final n!2um MAX_D = 300;nu!3m xc, yc;Sun!4flo
wer() {x!Xc = y!Yc = MA!1 }}''', |
1411 <String>["1+MAX_D", "X+xc", "Y+yc", "2+num", "3+num", "4+Sunflower"]); | 1939 <String>["1+MAX_D", "X+xc", "Y+yc", "2+num", "3+num", "4+Sunflower"]); |
1412 | 1940 |
1413 buildTests('testCompletion_super_superType', ''' | 1941 buildTests( |
| 1942 'testCompletion_super_superType', |
| 1943 ''' |
1414 class A { | 1944 class A { |
1415 var fa; | 1945 var fa; |
1416 ma() {} | 1946 ma() {} |
1417 } | 1947 } |
1418 class B extends A { | 1948 class B extends A { |
1419 var fb; | 1949 var fb; |
1420 mb() {} | 1950 mb() {} |
1421 main() { | 1951 main() { |
1422 super.!1 | 1952 super.!1 |
1423 } | 1953 } |
1424 }''', <String>["1+fa", "1-fb", "1+ma", "1-mb"]); | 1954 }''', |
| 1955 <String>["1+fa", "1-fb", "1+ma", "1-mb"]); |
1425 | 1956 |
1426 buildTests('testCompletion_superConstructorInvocation_noNamePrefix', ''' | 1957 buildTests( |
| 1958 'testCompletion_superConstructorInvocation_noNamePrefix', |
| 1959 ''' |
1427 class A { | 1960 class A { |
1428 A.fooA(); | 1961 A.fooA(); |
1429 A.fooB(); | 1962 A.fooB(); |
1430 A.bar(); | 1963 A.bar(); |
1431 } | 1964 } |
1432 class B extends A { | 1965 class B extends A { |
1433 B() : super.!1 | 1966 B() : super.!1 |
1434 }''', <String>["1+fooA", "1+fooB", "1+bar"], failingTests: '1'); | 1967 }''', |
| 1968 <String>["1+fooA", "1+fooB", "1+bar"], |
| 1969 failingTests: '1'); |
1435 | 1970 |
1436 buildTests('testCompletion_superConstructorInvocation_withNamePrefix', ''' | 1971 buildTests( |
| 1972 'testCompletion_superConstructorInvocation_withNamePrefix', |
| 1973 ''' |
1437 class A { | 1974 class A { |
1438 A.fooA(); | 1975 A.fooA(); |
1439 A.fooB(); | 1976 A.fooB(); |
1440 A.bar(); | 1977 A.bar(); |
1441 } | 1978 } |
1442 class B extends A { | 1979 class B extends A { |
1443 B() : super.f!1 | 1980 B() : super.f!1 |
1444 }''', <String>["1+fooA", "1+fooB", "1-bar"], failingTests: '1'); | 1981 }''', |
| 1982 <String>["1+fooA", "1+fooB", "1-bar"], |
| 1983 failingTests: '1'); |
1445 | 1984 |
1446 buildTests('testCompletion_this_bad_inConstructorInitializer', ''' | 1985 buildTests( |
| 1986 'testCompletion_this_bad_inConstructorInitializer', |
| 1987 ''' |
1447 class A { | 1988 class A { |
1448 var f; | 1989 var f; |
1449 A() : f = this.!1; | 1990 A() : f = this.!1; |
1450 }''', <String>["1-toString"], failingTests: '1'); | 1991 }''', |
| 1992 <String>["1-toString"], |
| 1993 failingTests: '1'); |
1451 | 1994 |
1452 buildTests('testCompletion_this_bad_inFieldDeclaration', ''' | 1995 buildTests( |
| 1996 'testCompletion_this_bad_inFieldDeclaration', |
| 1997 ''' |
1453 class A { | 1998 class A { |
1454 var f = this.!1; | 1999 var f = this.!1; |
1455 }''', <String>["1-toString"], failingTests: '1'); | 2000 }''', |
| 2001 <String>["1-toString"], |
| 2002 failingTests: '1'); |
1456 | 2003 |
1457 buildTests('testCompletion_this_bad_inStaticMethod', ''' | 2004 buildTests( |
| 2005 'testCompletion_this_bad_inStaticMethod', |
| 2006 ''' |
1458 class A { | 2007 class A { |
1459 static m() { | 2008 static m() { |
1460 this.!1; | 2009 this.!1; |
1461 } | 2010 } |
1462 }''', <String>["1-toString"], failingTests: '1'); | 2011 }''', |
| 2012 <String>["1-toString"], |
| 2013 failingTests: '1'); |
1463 | 2014 |
1464 buildTests('testCompletion_this_bad_inTopLevelFunction', ''' | 2015 buildTests( |
| 2016 'testCompletion_this_bad_inTopLevelFunction', |
| 2017 ''' |
1465 main() { | 2018 main() { |
1466 this.!1; | 2019 this.!1; |
1467 }''', <String>["1-toString"], failingTests: '1'); | 2020 }''', |
| 2021 <String>["1-toString"], |
| 2022 failingTests: '1'); |
1468 | 2023 |
1469 buildTests('testCompletion_this_bad_inTopLevelVariableDeclaration', ''' | 2024 buildTests( |
1470 var v = this.!1;''', <String>["1-toString"], failingTests: '1'); | 2025 'testCompletion_this_bad_inTopLevelVariableDeclaration', |
| 2026 ''' |
| 2027 var v = this.!1;''', |
| 2028 <String>["1-toString"], |
| 2029 failingTests: '1'); |
1471 | 2030 |
1472 buildTests('testCompletion_this_OK_inConstructorBody', ''' | 2031 buildTests( |
| 2032 'testCompletion_this_OK_inConstructorBody', |
| 2033 ''' |
1473 class A { | 2034 class A { |
1474 var f; | 2035 var f; |
1475 m() {} | 2036 m() {} |
1476 A() { | 2037 A() { |
1477 this.!1; | 2038 this.!1; |
1478 } | 2039 } |
1479 }''', <String>["1+f", "1+m"]); | 2040 }''', |
| 2041 <String>["1+f", "1+m"]); |
1480 | 2042 |
1481 buildTests('testCompletion_this_OK_localAndSuper', ''' | 2043 buildTests( |
| 2044 'testCompletion_this_OK_localAndSuper', |
| 2045 ''' |
1482 class A { | 2046 class A { |
1483 var fa; | 2047 var fa; |
1484 ma() {} | 2048 ma() {} |
1485 } | 2049 } |
1486 class B extends A { | 2050 class B extends A { |
1487 var fb; | 2051 var fb; |
1488 mb() {} | 2052 mb() {} |
1489 main() { | 2053 main() { |
1490 this.!1 | 2054 this.!1 |
1491 } | 2055 } |
1492 }''', <String>["1+fa", "1+fb", "1+ma", "1+mb"]); | 2056 }''', |
| 2057 <String>["1+fa", "1+fb", "1+ma", "1+mb"]); |
1493 | 2058 |
1494 buildTests('testCompletion_topLevelField_init2', ''' | 2059 buildTests( |
| 2060 'testCompletion_topLevelField_init2', |
| 2061 ''' |
1495 class DateTime{static var JUN;}final num M = Dat!1eTime.JUN;''', | 2062 class DateTime{static var JUN;}final num M = Dat!1eTime.JUN;''', |
1496 <String>["1+DateTime", "1-void"]); | 2063 <String>["1+DateTime", "1-void"]); |
1497 | 2064 |
1498 buildTests('testCompletion_while', ''' | 2065 buildTests( |
1499 class Foo { int boo = 7; mth() { while (b!1) {} }}''', <String>["1+boo"]); | 2066 'testCompletion_while', |
| 2067 ''' |
| 2068 class Foo { int boo = 7; mth() { while (b!1) {} }}''', |
| 2069 <String>["1+boo"]); |
1500 } | 2070 } |
1501 | 2071 |
1502 void buildLibraryTests() { | 2072 void buildLibraryTests() { |
1503 Map<String, String> sources = new HashMap<String, String>(); | 2073 Map<String, String> sources = new HashMap<String, String>(); |
1504 | 2074 |
1505 buildTests('test_export_ignoreIfThisLibraryExports', ''' | 2075 buildTests( |
| 2076 'test_export_ignoreIfThisLibraryExports', |
| 2077 ''' |
1506 export 'dart:math'; | 2078 export 'dart:math'; |
1507 libFunction() {}; | 2079 libFunction() {}; |
1508 main() { | 2080 main() { |
1509 !1 | 2081 !1 |
1510 }''', <String>["1-cos", "1+libFunction"]); | 2082 }''', |
| 2083 <String>["1-cos", "1+libFunction"]); |
1511 | 2084 |
1512 sources.clear(); | 2085 sources.clear(); |
1513 sources["/lib.dart"] = ''' | 2086 sources["/lib.dart"] = ''' |
1514 library lib; | 2087 library lib; |
1515 export 'dart:math' hide sin; | 2088 export 'dart:math' hide sin; |
1516 libFunction() {};'''; | 2089 libFunction() {};'''; |
1517 buildTests('test_export_showIfImportLibraryWithExport', ''' | 2090 buildTests( |
| 2091 'test_export_showIfImportLibraryWithExport', |
| 2092 ''' |
1518 import 'lib.dart' as p; | 2093 import 'lib.dart' as p; |
1519 main() { | 2094 main() { |
1520 p.!1 | 2095 p.!1 |
1521 }''', <String>["1+cos", "1-sin", "1+libFunction"], | 2096 }''', |
1522 extraFiles: sources, failingTests: '1'); | 2097 <String>["1+cos", "1-sin", "1+libFunction"], |
| 2098 extraFiles: sources, |
| 2099 failingTests: '1'); |
1523 | 2100 |
1524 buildTests('test_importPrefix_hideCombinator', ''' | 2101 buildTests( |
| 2102 'test_importPrefix_hideCombinator', |
| 2103 ''' |
1525 import 'dart:math' as math hide PI; | 2104 import 'dart:math' as math hide PI; |
1526 main() { | 2105 main() { |
1527 math.!1 | 2106 math.!1 |
1528 }''', <String>["1-PI", "1+LN10"], failingTests: '1'); | 2107 }''', |
| 2108 <String>["1-PI", "1+LN10"], |
| 2109 failingTests: '1'); |
1529 | 2110 |
1530 buildTests('test_importPrefix_showCombinator', ''' | 2111 buildTests( |
| 2112 'test_importPrefix_showCombinator', |
| 2113 ''' |
1531 import 'dart:math' as math show PI; | 2114 import 'dart:math' as math show PI; |
1532 main() { | 2115 main() { |
1533 math.!1 | 2116 math.!1 |
1534 }''', <String>["1+PI", "1-LN10"], failingTests: '1'); | 2117 }''', |
| 2118 <String>["1+PI", "1-LN10"], |
| 2119 failingTests: '1'); |
1535 | 2120 |
1536 sources.clear(); | 2121 sources.clear(); |
1537 sources["/lib.dart"] = ''' | 2122 sources["/lib.dart"] = ''' |
1538 library lib | 2123 library lib |
1539 class _A | 2124 class _A |
1540 foo() {} | 2125 foo() {} |
1541 | 2126 |
1542 class A extends _A { | 2127 class A extends _A { |
1543 }'''; | 2128 }'''; |
1544 buildTests('test_memberOfPrivateClass_otherLibrary', ''' | 2129 buildTests( |
| 2130 'test_memberOfPrivateClass_otherLibrary', |
| 2131 ''' |
1545 import 'lib.dart'; | 2132 import 'lib.dart'; |
1546 main(A a) { | 2133 main(A a) { |
1547 a.!1 | 2134 a.!1 |
1548 }''', <String>["1+foo"], extraFiles: sources, failingTests: '1'); | 2135 }''', |
| 2136 <String>["1+foo"], |
| 2137 extraFiles: sources, |
| 2138 failingTests: '1'); |
1549 | 2139 |
1550 sources.clear(); | 2140 sources.clear(); |
1551 sources["/lib.dart"] = ''' | 2141 sources["/lib.dart"] = ''' |
1552 library lib; | 2142 library lib; |
1553 class A { | 2143 class A { |
1554 A.c(); | 2144 A.c(); |
1555 A._c(); | 2145 A._c(); |
1556 }'''; | 2146 }'''; |
1557 buildTests('test_noPrivateElement_otherLibrary_constructor', ''' | 2147 buildTests( |
| 2148 'test_noPrivateElement_otherLibrary_constructor', |
| 2149 ''' |
1558 import 'lib.dart'; | 2150 import 'lib.dart'; |
1559 main() { | 2151 main() { |
1560 new A.!1 | 2152 new A.!1 |
1561 }''', <String>["1-_c", "1+c"], failingTests: '1'); | 2153 }''', |
| 2154 <String>["1-_c", "1+c"], |
| 2155 failingTests: '1'); |
1562 | 2156 |
1563 sources.clear(); | 2157 sources.clear(); |
1564 sources["/lib.dart"] = ''' | 2158 sources["/lib.dart"] = ''' |
1565 library lib; | 2159 library lib; |
1566 class A { | 2160 class A { |
1567 var f; | 2161 var f; |
1568 var _f; | 2162 var _f; |
1569 }'''; | 2163 }'''; |
1570 buildTests('test_noPrivateElement_otherLibrary_member', ''' | 2164 buildTests( |
| 2165 'test_noPrivateElement_otherLibrary_member', |
| 2166 ''' |
1571 import 'lib.dart'; | 2167 import 'lib.dart'; |
1572 main(A a) { | 2168 main(A a) { |
1573 a.!1 | 2169 a.!1 |
1574 }''', <String>["1-_f", "1+f"], | 2170 }''', |
1575 extraFiles: sources, failingTests: '1'); | 2171 <String>["1-_f", "1+f"], |
| 2172 extraFiles: sources, |
| 2173 failingTests: '1'); |
1576 | 2174 |
1577 sources.clear(); | 2175 sources.clear(); |
1578 sources["/firth.dart"] = ''' | 2176 sources["/firth.dart"] = ''' |
1579 library firth; | 2177 library firth; |
1580 class SerializationException { | 2178 class SerializationException { |
1581 const SerializationException(); | 2179 const SerializationException(); |
1582 }'''; | 2180 }'''; |
1583 buildTests('testLibrary001', ''' | 2181 buildTests( |
| 2182 'testLibrary001', |
| 2183 ''' |
1584 import 'firth.dart'; | 2184 import 'firth.dart'; |
1585 main() { | 2185 main() { |
1586 throw new Seria!1lizationException();}''', <String>["1+SerializationException"], | 2186 throw new Seria!1lizationException();}''', |
1587 extraFiles: sources, failingTests: '1'); | 2187 <String>["1+SerializationException"], |
| 2188 extraFiles: sources, |
| 2189 failingTests: '1'); |
1588 | 2190 |
1589 // Type propagation. | 2191 // Type propagation. |
1590 // TODO Include corelib analysis (this works in the editor) | 2192 // TODO Include corelib analysis (this works in the editor) |
1591 buildTests('testLibrary002', | 2193 buildTests( |
| 2194 'testLibrary002', |
1592 '''t2() {var q=[0],z=q.!1length;q.!2clear();}''', | 2195 '''t2() {var q=[0],z=q.!1length;q.!2clear();}''', |
1593 <String>["1+length", "1+isEmpty", "2+clear"], failingTests: '1'); | 2196 <String>["1+length", "1+isEmpty", "2+clear"], |
| 2197 failingTests: '1'); |
1594 | 2198 |
1595 // TODO Include corelib analysis | 2199 // TODO Include corelib analysis |
1596 buildTests('testLibrary003', '''class X{var q; f() {q.!1a!2}}''', <String>[ | 2200 buildTests('testLibrary003', '''class X{var q; f() {q.!1a!2}}''', |
1597 "1+end", | 2201 <String>["1+end", "2+abs", "2-end"], |
1598 "2+abs", | 2202 failingTests: '12'); |
1599 "2-end" | |
1600 ], failingTests: '12'); | |
1601 | 2203 |
1602 // TODO Include corelib analysis | 2204 // TODO Include corelib analysis |
1603 // Resolving dart:html takes between 2.5s and 30s; json, about 0.12s | 2205 // Resolving dart:html takes between 2.5s and 30s; json, about 0.12s |
1604 buildTests('testLibrary004', ''' | 2206 buildTests( |
| 2207 'testLibrary004', |
| 2208 ''' |
1605 library foo; | 2209 library foo; |
1606 import 'dart:convert' as json; | 2210 import 'dart:convert' as json; |
1607 class JsonDecoderX{} | 2211 class JsonDecoderX{} |
1608 f1() {var x=new json.!1} | 2212 f1() {var x=new json.!1} |
1609 f2() {var x=new json.JsonDe!2} | 2213 f2() {var x=new json.JsonDe!2} |
1610 f3() {var x=new json.JsonDecoder!3}''', <String>[ | 2214 f3() {var x=new json.JsonDecoder!3}''', |
| 2215 <String>[ |
1611 "1+JsonDecoder", | 2216 "1+JsonDecoder", |
1612 "1-JsonDecoderX", | 2217 "1-JsonDecoderX", |
1613 "2+JsonDecoder", | 2218 "2+JsonDecoder", |
1614 "2-JsonDecoderX", | 2219 "2-JsonDecoderX", |
1615 "3+JsonDecoder", | 2220 "3+JsonDecoder", |
1616 "3-JsonDecoderX" | 2221 "3-JsonDecoderX" |
1617 ]); | 2222 ]); |
1618 | 2223 |
1619 // TODO Enable after type propagation is implemented. Not yet. | 2224 // TODO Enable after type propagation is implemented. Not yet. |
1620 // TODO Include corelib analysis | 2225 // TODO Include corelib analysis |
1621 buildTests('testLibrary005', | 2226 buildTests('testLibrary005', |
1622 '''var PHI;main(){PHI=5.3;PHI.abs().!1 Object x;}''', <String>[ | 2227 '''var PHI;main(){PHI=5.3;PHI.abs().!1 Object x;}''', <String>["1+abs"], |
1623 "1+abs" | 2228 failingTests: '1'); |
1624 ], failingTests: '1'); | |
1625 | 2229 |
1626 // Exercise import and export handling. | 2230 // Exercise import and export handling. |
1627 // Libraries are defined in partial order of increasing dependency. | 2231 // Libraries are defined in partial order of increasing dependency. |
1628 sources.clear(); | 2232 sources.clear(); |
1629 sources["/exp2a.dart"] = ''' | 2233 sources["/exp2a.dart"] = ''' |
1630 library exp2a; | 2234 library exp2a; |
1631 e2a() {}'''; | 2235 e2a() {}'''; |
1632 sources["/exp1b.dart"] = ''' | 2236 sources["/exp1b.dart"] = ''' |
1633 library exp1b;", | 2237 library exp1b;", |
1634 e1b() {}'''; | 2238 e1b() {}'''; |
1635 sources["/exp1a.dart"] = ''' | 2239 sources["/exp1a.dart"] = ''' |
1636 library exp1a;", | 2240 library exp1a;", |
1637 export 'exp1b.dart';", | 2241 export 'exp1b.dart';", |
1638 e1a() {}'''; | 2242 e1a() {}'''; |
1639 sources["/imp1.dart"] = ''' | 2243 sources["/imp1.dart"] = ''' |
1640 library imp1; | 2244 library imp1; |
1641 export 'exp1a.dart'; | 2245 export 'exp1a.dart'; |
1642 i1() {}'''; | 2246 i1() {}'''; |
1643 sources["/imp2.dart"] = ''' | 2247 sources["/imp2.dart"] = ''' |
1644 library imp2; | 2248 library imp2; |
1645 export 'exp2a.dart'; | 2249 export 'exp2a.dart'; |
1646 i2() {}'''; | 2250 i2() {}'''; |
1647 buildTests('testLibrary006', ''' | 2251 buildTests( |
| 2252 'testLibrary006', |
| 2253 ''' |
1648 import 'imp1.dart'; | 2254 import 'imp1.dart'; |
1649 import 'imp2.dart'; | 2255 import 'imp2.dart'; |
1650 main() {!1 | 2256 main() {!1 |
1651 i1(); | 2257 i1(); |
1652 i2(); | 2258 i2(); |
1653 e1a(); | 2259 e1a(); |
1654 e1b(); | 2260 e1b(); |
1655 e2a(); | 2261 e2a(); |
1656 }''', <String>["1+i1", "1+i2", "1+e1a", "1+e2a", "1+e1b"], | 2262 }''', |
1657 extraFiles: sources, failingTests: '1'); | 2263 <String>["1+i1", "1+i2", "1+e1a", "1+e2a", "1+e1b"], |
| 2264 extraFiles: sources, |
| 2265 failingTests: '1'); |
1658 | 2266 |
1659 // Exercise import and export handling. | 2267 // Exercise import and export handling. |
1660 // Libraries are defined in partial order of increasing dependency. | 2268 // Libraries are defined in partial order of increasing dependency. |
1661 sources.clear(); | 2269 sources.clear(); |
1662 sources["/l1.dart"] = ''' | 2270 sources["/l1.dart"] = ''' |
1663 library l1; | 2271 library l1; |
1664 var _l1t; var l1t;'''; | 2272 var _l1t; var l1t;'''; |
1665 buildTests('testLibrary007', ''' | 2273 buildTests( |
| 2274 'testLibrary007', |
| 2275 ''' |
1666 import 'l1.dart'; | 2276 import 'l1.dart'; |
1667 main() { | 2277 main() { |
1668 var x = l!1 | 2278 var x = l!1 |
1669 var y = _!2 | 2279 var y = _!2 |
1670 }''', <String>["1+l1t", "1-_l1t", "2-_l1t"], | 2280 }''', |
1671 extraFiles: sources, failingTests: '1'); | 2281 <String>["1+l1t", "1-_l1t", "2-_l1t"], |
| 2282 extraFiles: sources, |
| 2283 failingTests: '1'); |
1672 | 2284 |
1673 // Check private library exclusion | 2285 // Check private library exclusion |
1674 sources.clear(); | 2286 sources.clear(); |
1675 sources["/public.dart"] = ''' | 2287 sources["/public.dart"] = ''' |
1676 library public; | 2288 library public; |
1677 class NonPrivate { | 2289 class NonPrivate { |
1678 void publicMethod() { | 2290 void publicMethod() { |
1679 } | 2291 } |
1680 }'''; | 2292 }'''; |
1681 sources["/private.dart"] = ''' | 2293 sources["/private.dart"] = ''' |
1682 library _private; | 2294 library _private; |
1683 import 'public.dart'; | 2295 import 'public.dart'; |
1684 class Private extends NonPrivate { | 2296 class Private extends NonPrivate { |
1685 void privateMethod() { | 2297 void privateMethod() { |
1686 } | 2298 } |
1687 }'''; | 2299 }'''; |
1688 buildTests('testLibrary008', ''' | 2300 buildTests( |
| 2301 'testLibrary008', |
| 2302 ''' |
1689 import 'private.dart'; | 2303 import 'private.dart'; |
1690 import 'public.dart'; | 2304 import 'public.dart'; |
1691 class Test { | 2305 class Test { |
1692 void test() { | 2306 void test() { |
1693 NonPrivate x = new NonPrivate(); | 2307 NonPrivate x = new NonPrivate(); |
1694 x.!1 //publicMethod but not privateMethod should appear | 2308 x.!1 //publicMethod but not privateMethod should appear |
1695 } | 2309 } |
1696 }''', <String>["1-privateMethod", "1+publicMethod"], | 2310 }''', |
1697 extraFiles: sources, failingTests: '1'); | 2311 <String>["1-privateMethod", "1+publicMethod"], |
| 2312 extraFiles: sources, |
| 2313 failingTests: '1'); |
1698 | 2314 |
1699 // Exercise library prefixes. | 2315 // Exercise library prefixes. |
1700 sources.clear(); | 2316 sources.clear(); |
1701 sources["/lib.dart"] = ''' | 2317 sources["/lib.dart"] = ''' |
1702 library lib; | 2318 library lib; |
1703 int X = 1; | 2319 int X = 1; |
1704 void m(){} | 2320 void m(){} |
1705 class Y {}'''; | 2321 class Y {}'''; |
1706 buildTests('testLibrary009', ''' | 2322 buildTests( |
| 2323 'testLibrary009', |
| 2324 ''' |
1707 import 'lib.dart' as Q; | 2325 import 'lib.dart' as Q; |
1708 void a() { | 2326 void a() { |
1709 var x = Q.!1 | 2327 var x = Q.!1 |
1710 } | 2328 } |
1711 void b() { | 2329 void b() { |
1712 var x = [Q.!2] | 2330 var x = [Q.!2] |
1713 } | 2331 } |
1714 void c() { | 2332 void c() { |
1715 var x = new List([Q.!3]) | 2333 var x = new List([Q.!3]) |
1716 } | 2334 } |
1717 void d() { | 2335 void d() { |
1718 new Q.!4 | 2336 new Q.!4 |
1719 }''', <String>[ | 2337 }''', |
1720 "1+X", | 2338 <String>[ |
1721 "1+m", | 2339 "1+X", |
1722 "1+Y", | 2340 "1+m", |
1723 "2+X", | 2341 "1+Y", |
1724 "2+m", | 2342 "2+X", |
1725 "2+Y", | 2343 "2+m", |
1726 "3+X", | 2344 "2+Y", |
1727 "3+m", | 2345 "3+X", |
1728 "3+Y", | 2346 "3+m", |
1729 "4+Y", | 2347 "3+Y", |
1730 "4-m", | 2348 "4+Y", |
1731 "4-X" | 2349 "4-m", |
1732 ], extraFiles: sources, failingTests: '1234'); | 2350 "4-X" |
| 2351 ], |
| 2352 extraFiles: sources, |
| 2353 failingTests: '1234'); |
1733 } | 2354 } |
1734 | 2355 |
1735 void buildNumberedTests() { | 2356 void buildNumberedTests() { |
1736 buildTests('test001', ''' | 2357 buildTests( |
| 2358 'test001', |
| 2359 ''' |
1737 void r1(var v) { | 2360 void r1(var v) { |
1738 v.!1toString!2().!3hash!4Code | 2361 v.!1toString!2().!3hash!4Code |
1739 }''', <String>[ | 2362 }''', |
| 2363 <String>[ |
1740 "1+toString", | 2364 "1+toString", |
1741 "1-==", | 2365 "1-==", |
1742 "2+toString", | 2366 "2+toString", |
1743 "3+hashCode", | 2367 "3+hashCode", |
1744 "3+toString", | 2368 "3+toString", |
1745 "4+hashCode", | 2369 "4+hashCode", |
1746 "4-toString" | 2370 "4-toString" |
1747 ]); | 2371 ]); |
1748 | 2372 |
1749 buildTests('test002', ''' | 2373 buildTests( |
| 2374 'test002', |
| 2375 ''' |
1750 void r2(var vim) { | 2376 void r2(var vim) { |
1751 v!1.toString() | 2377 v!1.toString() |
1752 }''', <String>["1+vim"]); | 2378 }''', |
| 2379 <String>["1+vim"]); |
1753 | 2380 |
1754 buildTests('test003', ''' | 2381 buildTests( |
| 2382 'test003', |
| 2383 ''' |
1755 class A { | 2384 class A { |
1756 int a() => 3; | 2385 int a() => 3; |
1757 int b() => this.!1a(); | 2386 int b() => this.!1a(); |
1758 }''', <String>["1+a"]); | 2387 }''', |
| 2388 <String>["1+a"]); |
1759 | 2389 |
1760 buildTests('test004', ''' | 2390 buildTests( |
| 2391 'test004', |
| 2392 ''' |
1761 class A { | 2393 class A { |
1762 int x; | 2394 int x; |
1763 A() : this.!1x = 1; | 2395 A() : this.!1x = 1; |
1764 A.b() : this(); | 2396 A.b() : this(); |
1765 A.c() : this.!2b(); | 2397 A.c() : this.!2b(); |
1766 g() => new A.!3c(); | 2398 g() => new A.!3c(); |
1767 }''', <String>["1+x", "2+b", "3+c"], failingTests: '12'); | 2399 }''', |
| 2400 <String>["1+x", "2+b", "3+c"], |
| 2401 failingTests: '12'); |
1768 | 2402 |
1769 buildTests('test005', ''' | 2403 buildTests( |
| 2404 'test005', |
| 2405 ''' |
1770 class A {} | 2406 class A {} |
1771 void rr(var vim) { | 2407 void rr(var vim) { |
1772 var !1vq = v!2.toString(); | 2408 var !1vq = v!2.toString(); |
1773 var vf; | 2409 var vf; |
1774 v!3.toString(); | 2410 v!3.toString(); |
1775 }''', <String>[ | 2411 }''', |
1776 "1-A", | 2412 <String>[ |
1777 "1-vim", | 2413 "1-A", |
1778 "1+vq", | 2414 "1-vim", |
1779 "1-vf", | 2415 "1+vq", |
1780 "1-this", | 2416 "1-vf", |
1781 "1-void", | 2417 "1-this", |
1782 "1-null", | 2418 "1-void", |
1783 "1-false", | 2419 "1-null", |
1784 "2-A", | 2420 "1-false", |
1785 "2+vim", | 2421 "2-A", |
1786 "2-vf", | 2422 "2+vim", |
1787 "2-vq", | 2423 "2-vf", |
1788 "2-this", | 2424 "2-vq", |
1789 "2-void", | 2425 "2-this", |
1790 "2-null", | 2426 "2-void", |
1791 "2-false", | 2427 "2-null", |
1792 "3+vf", | 2428 "2-false", |
1793 "3+vq", | 2429 "3+vf", |
1794 "3+vim", | 2430 "3+vq", |
1795 "3-A" | 2431 "3+vim", |
1796 ], failingTests: '1'); | 2432 "3-A" |
| 2433 ], |
| 2434 failingTests: '1'); |
1797 | 2435 |
1798 buildTests('test006', ''' | 2436 buildTests( |
| 2437 'test006', |
| 2438 ''' |
1799 void r2(var vim, {va: 2, b: 3}) { | 2439 void r2(var vim, {va: 2, b: 3}) { |
1800 v!1.toString() | 2440 v!1.toString() |
1801 }''', <String>["1+va", "1-b"]); | 2441 }''', |
| 2442 <String>["1+va", "1-b"]); |
1802 | 2443 |
1803 buildTests('test007', ''' | 2444 buildTests( |
| 2445 'test007', |
| 2446 ''' |
1804 void r2(var vim, [va: 2, b: 3]) { | 2447 void r2(var vim, [va: 2, b: 3]) { |
1805 v!1.toString() | 2448 v!1.toString() |
1806 }''', <String>["1+va", "1-b"]); | 2449 }''', |
| 2450 <String>["1+va", "1-b"]); |
1807 | 2451 |
1808 // keywords | 2452 // keywords |
1809 buildTests('test008', ''' | 2453 buildTests( |
| 2454 'test008', |
| 2455 ''' |
1810 !1class Aclass {} | 2456 !1class Aclass {} |
1811 class Bclass !2extends!3 !4Aclass {} | 2457 class Bclass !2extends!3 !4Aclass {} |
1812 !5typedef Ctype = !6Bclass with !7Aclass; | 2458 !5typedef Ctype = !6Bclass with !7Aclass; |
1813 class Dclass extends !8Ctype {} | 2459 class Dclass extends !8Ctype {} |
1814 !9abstract class Eclass implements Dclass,!C Ctype, Bclass {} | 2460 !9abstract class Eclass implements Dclass,!C Ctype, Bclass {} |
1815 class Fclass extends Bclass !Awith !B Eclass {}''', <String>[ | 2461 class Fclass extends Bclass !Awith !B Eclass {}''', |
1816 "1+class", | 2462 <String>[ |
1817 "1-implements", | 2463 "1+class", |
1818 "1-extends", | 2464 "1-implements", |
1819 "1-with", | 2465 "1-extends", |
1820 "2+extends", | 2466 "1-with", |
1821 "3+extends", | 2467 "2+extends", |
1822 "4+Aclass", | 2468 "3+extends", |
1823 "4-Bclass", | 2469 "4+Aclass", |
1824 "5+typedef", | 2470 "4-Bclass", |
1825 "6+Bclass", | 2471 "5+typedef", |
1826 "6-Ctype", | 2472 "6+Bclass", |
1827 "7+Aclass", | 2473 "6-Ctype", |
1828 "7-Bclass", | 2474 "7+Aclass", |
1829 "8+Ctype", | 2475 "7-Bclass", |
1830 "9+abstract", | 2476 "8+Ctype", |
1831 "A+with", | 2477 "9+abstract", |
1832 "B+Eclass", | 2478 "A+with", |
1833 "B-Dclass", | 2479 "B+Eclass", |
1834 "B-Ctype", | 2480 "B-Dclass", |
1835 "C+Bclass", | 2481 "B-Ctype", |
1836 "C-Eclass" | 2482 "C+Bclass", |
1837 ], failingTests: '23467ABC'); | 2483 "C-Eclass" |
| 2484 ], |
| 2485 failingTests: '23467ABC'); |
1838 | 2486 |
1839 // keywords | 2487 // keywords |
1840 buildTests('test009', ''' | 2488 buildTests( |
| 2489 'test009', |
| 2490 ''' |
1841 typedef !1dy!2namic TestFn1(); | 2491 typedef !1dy!2namic TestFn1(); |
1842 typedef !3vo!4id TestFn2(); | 2492 typedef !3vo!4id TestFn2(); |
1843 typ!7edef !5n!6''', <String>[ | 2493 typ!7edef !5n!6''', |
1844 "1+void", | 2494 <String>[ |
1845 "1+TestFn2", | 2495 "1+void", |
1846 "2+dynamic", | 2496 "1+TestFn2", |
1847 "2-void", | 2497 "2+dynamic", |
1848 "3+dynamic", | 2498 "2-void", |
1849 "4+void", | 2499 "3+dynamic", |
1850 "4-dynamic", | 2500 "4+void", |
1851 "5+TestFn2", | 2501 "4-dynamic", |
1852 "6+num", | 2502 "5+TestFn2", |
1853 "7+typedef" | 2503 "6+num", |
1854 ], failingTests: '1234'); | 2504 "7+typedef" |
| 2505 ], |
| 2506 failingTests: '1234'); |
1855 | 2507 |
1856 buildTests('test010', ''' | 2508 buildTests( |
| 2509 'test010', |
| 2510 ''' |
1857 class test !8<!1t !2 !3extends String,!4 List,!5 !6>!7 {} | 2511 class test !8<!1t !2 !3extends String,!4 List,!5 !6>!7 {} |
1858 class tezetst !9<!BString,!C !DList>!A {}''', <String>[ | 2512 class tezetst !9<!BString,!C !DList>!A {}''', |
1859 "1-String", | 2513 <String>[ |
1860 "1-List", | 2514 "1-String", |
1861 "1-test", | 2515 "1-List", |
1862 "2-String", | 2516 "1-test", |
1863 "2-test", | 2517 "2-String", |
1864 "3+extends", | 2518 "2-test", |
1865 "4-tezetst", | 2519 "3+extends", |
1866 "4-test", | 2520 "4-tezetst", |
1867 "5-String", | 2521 "4-test", |
1868 "6-List", | 2522 "5-String", |
1869 "7-List", | 2523 "6-List", |
1870 "8-List", | 2524 "7-List", |
1871 "9-String", | 2525 "8-List", |
1872 "A-String", | 2526 "9-String", |
1873 "B-String", | 2527 "A-String", |
1874 "C-List", | 2528 "B-String", |
1875 "C-tezetst", | 2529 "C-List", |
1876 "D-List", | 2530 "C-tezetst", |
1877 "D-test" | 2531 "D-List", |
1878 ], failingTests: '23'); | 2532 "D-test" |
| 2533 ], |
| 2534 failingTests: '23'); |
1879 | 2535 |
1880 // name generation with conflicts | 2536 // name generation with conflicts |
1881 buildTests('test011', '''r2(var object, Object object1, Object !1);''', | 2537 buildTests('test011', '''r2(var object, Object object1, Object !1);''', |
1882 <String>["1+object2"], failingTests: '1'); | 2538 <String>["1+object2"], |
| 2539 failingTests: '1'); |
1883 | 2540 |
1884 // reserved words | 2541 // reserved words |
1885 buildTests('test012', ''' | 2542 buildTests( |
| 2543 'test012', |
| 2544 ''' |
1886 class X { | 2545 class X { |
1887 f() { | 2546 f() { |
1888 g(!1var!2 z) {!3true.!4toString();}; | 2547 g(!1var!2 z) {!3true.!4toString();}; |
1889 } | 2548 } |
1890 }''', <String>[ | 2549 }''', |
1891 "1+var", | 2550 <String>[ |
1892 "1+dynamic", | 2551 "1+var", |
1893 "1-f", | 2552 "1+dynamic", |
1894 "2+var", | 2553 "1-f", |
1895 "2-dynamic", | 2554 "2+var", |
1896 "3+false", | 2555 "2-dynamic", |
1897 "3+true", | 2556 "3+false", |
1898 "4+toString" | 2557 "3+true", |
1899 ], failingTests: '123'); | 2558 "4+toString" |
| 2559 ], |
| 2560 failingTests: '123'); |
1900 | 2561 |
1901 // conditions & operators | 2562 // conditions & operators |
1902 buildTests('test013', ''' | 2563 buildTests( |
| 2564 'test013', |
| 2565 ''' |
1903 class Q { | 2566 class Q { |
1904 bool x; | 2567 bool x; |
1905 List zs; | 2568 List zs; |
1906 int k; | 2569 int k; |
1907 var a; | 2570 var a; |
1908 mth() { | 2571 mth() { |
1909 while (!1x !9); | 2572 while (!1x !9); |
1910 do{} while(!2x !8); | 2573 do{} while(!2x !8); |
1911 for(z in !3zs) {} | 2574 for(z in !3zs) {} |
1912 switch(!4k) {case 1:{!0}} | 2575 switch(!4k) {case 1:{!0}} |
1913 try { | 2576 try { |
1914 } on !5Object catch(a){} | 2577 } on !5Object catch(a){} |
1915 if (!7x !6) {} else {}; | 2578 if (!7x !6) {} else {}; |
1916 } | 2579 } |
1917 }''', <String>[ | 2580 }''', |
1918 "1+x", | 2581 <String>[ |
1919 "2+x", | 2582 "1+x", |
1920 "3+zs", | 2583 "2+x", |
1921 "4+k", | 2584 "3+zs", |
1922 "5+Q", | 2585 "4+k", |
1923 "5-a", | 2586 "5+Q", |
1924 "6+==", | 2587 "5-a", |
1925 "7+x", | 2588 "6+==", |
1926 "8+==", | 2589 "7+x", |
1927 "9+==", | 2590 "8+==", |
1928 "0+k" | 2591 "9+==", |
1929 ], failingTests: '689'); | 2592 "0+k" |
| 2593 ], |
| 2594 failingTests: '689'); |
1930 | 2595 |
1931 // keywords | 2596 // keywords |
1932 buildTests('test014', ''' | 2597 buildTests( |
| 2598 'test014', |
| 2599 ''' |
1933 class Q { | 2600 class Q { |
1934 bool x; | 2601 bool x; |
1935 List zs; | 2602 List zs; |
1936 int k; | 2603 int k; |
1937 !Dvar a; | 2604 !Dvar a; |
1938 !Evoid mth() { | 2605 !Evoid mth() { |
1939 !1while (z) { !Gcontinue; }; | 2606 !1while (z) { !Gcontinue; }; |
1940 !2do{ !Hbreak; } !3while(x); | 2607 !2do{ !Hbreak; } !3while(x); |
1941 !4for(z !5in zs) {} | 2608 !4for(z !5in zs) {} |
1942 !6for (int i; i < 3; i++); | 2609 !6for (int i; i < 3; i++); |
1943 !7switch(k) {!8case 1:{} !9default:{}} | 2610 !7switch(k) {!8case 1:{} !9default:{}} |
1944 !Atry { | 2611 !Atry { |
1945 } !Bon Object !Ccatch(a){} | 2612 } !Bon Object !Ccatch(a){} |
1946 !Fassert true; | 2613 !Fassert true; |
1947 !Jif (x) {} !Kelse {}; | 2614 !Jif (x) {} !Kelse {}; |
1948 !Lreturn; | 2615 !Lreturn; |
1949 } | 2616 } |
1950 }''', <String>[ | 2617 }''', |
1951 "1+while", | 2618 <String>[ |
1952 "2+do", | 2619 "1+while", |
1953 "3+while", | 2620 "2+do", |
1954 "4+for (!)", | 2621 "3+while", |
1955 "5+in", | 2622 "4+for (!)", |
1956 "6+for (!)", | 2623 "5+in", |
1957 "7+switch", | 2624 "6+for (!)", |
1958 "8+case", | 2625 "7+switch", |
1959 "9+default", | 2626 "8+case", |
1960 "A+try", | 2627 "9+default", |
1961 "B+on", | 2628 "A+try", |
1962 "C+catch", | 2629 "B+on", |
1963 "D+var", | 2630 "C+catch", |
1964 "E+void", | 2631 "D+var", |
1965 "F+assert", | 2632 "E+void", |
1966 "G+continue", | 2633 "F+assert", |
1967 "H+break", | 2634 "G+continue", |
1968 "J+if", | 2635 "H+break", |
1969 "K+else", | 2636 "J+if", |
1970 "L+return" | 2637 "K+else", |
1971 ], failingTests: '35BCHK'); | 2638 "L+return" |
| 2639 ], |
| 2640 failingTests: '35BCHK'); |
1972 | 2641 |
1973 // operators in function | 2642 // operators in function |
1974 buildTests('test015', '''f(a,b,c) => a + b * c !1;''', <String>["1+=="], | 2643 buildTests('test015', '''f(a,b,c) => a + b * c !1;''', <String>["1+=="], |
1975 failingTests: '1'); | 2644 failingTests: '1'); |
1976 | 2645 |
1977 // operators in return | 2646 // operators in return |
1978 buildTests('test016', | 2647 buildTests( |
1979 '''class X {dynamic f(a,b,c) {return a + b * c !1;}}''', <String>[ | 2648 'test016', |
1980 "1+==" | 2649 '''class X {dynamic f(a,b,c) {return a + b * c !1;}}''', |
1981 ], failingTests: '1'); | 2650 <String>["1+=="], |
| 2651 failingTests: '1'); |
1982 | 2652 |
1983 // keywords | 2653 // keywords |
1984 buildTests('test017', ''' | 2654 buildTests( |
| 2655 'test017', |
| 2656 ''' |
1985 !1!2import 'x' !5as r; | 2657 !1!2import 'x' !5as r; |
1986 !3export '!8uri' !6hide Q !7show X; | 2658 !3export '!8uri' !6hide Q !7show X; |
1987 !4part 'x';''', <String>[ | 2659 !4part 'x';''', |
1988 "1+library", | 2660 <String>[ |
1989 "2+import '!';", | 2661 "1+library", |
1990 "3+export", | 2662 "2+import '!';", |
1991 "4+part", | 2663 "3+export", |
1992 "5+as", | 2664 "4+part", |
1993 "6+hide", | 2665 "5+as", |
1994 "7+show", | 2666 "6+hide", |
1995 "8-null" | 2667 "7+show", |
1996 ], failingTests: '567'); | 2668 "8-null" |
| 2669 ], |
| 2670 failingTests: '567'); |
1997 | 2671 |
1998 // keywords | 2672 // keywords |
1999 buildTests('test018', '''!1part !2of foo;''', <String>["1+part", "2+of"], | 2673 buildTests('test018', '''!1part !2of foo;''', <String>["1+part", "2+of"], |
2000 failingTests: '2'); | 2674 failingTests: '2'); |
2001 | 2675 |
2002 buildTests('test019', ''' | 2676 buildTests( |
| 2677 'test019', |
| 2678 ''' |
2003 var truefalse = 0; | 2679 var truefalse = 0; |
2004 var falsetrue = 1; | 2680 var falsetrue = 1; |
2005 main() { | 2681 main() { |
2006 var foo = true!1 | 2682 var foo = true!1 |
2007 }''', <String>["1+true", "1+truefalse", "1-falsetrue"]); | 2683 }''', |
| 2684 <String>["1+true", "1+truefalse", "1-falsetrue"]); |
2008 | 2685 |
2009 buildTests('test020', '''var x = null.!1''', <String>["1+toString"], | 2686 buildTests('test020', '''var x = null.!1''', <String>["1+toString"], |
2010 failingTests: '1'); | 2687 failingTests: '1'); |
2011 | 2688 |
2012 buildTests('test021', '''var x = .!1''', <String>["1-toString"]); | 2689 buildTests('test021', '''var x = .!1''', <String>["1-toString"]); |
2013 | 2690 |
2014 buildTests('test022', '''var x = .!1;''', <String>["1-toString"]); | 2691 buildTests('test022', '''var x = .!1;''', <String>["1-toString"]); |
2015 | 2692 |
2016 buildTests('test023', ''' | 2693 buildTests( |
| 2694 'test023', |
| 2695 ''' |
2017 class Map{getKeys(){}} | 2696 class Map{getKeys(){}} |
2018 class X { | 2697 class X { |
2019 static x1(Map m) { | 2698 static x1(Map m) { |
2020 m.!1getKeys; | 2699 m.!1getKeys; |
2021 } | 2700 } |
2022 x2(Map m) { | 2701 x2(Map m) { |
2023 m.!2getKeys; | 2702 m.!2getKeys; |
2024 } | 2703 } |
2025 }''', <String>["1+getKeys", "2+getKeys"]); | 2704 }''', |
| 2705 <String>["1+getKeys", "2+getKeys"]); |
2026 | 2706 |
2027 // Note lack of semicolon following completion location | 2707 // Note lack of semicolon following completion location |
2028 buildTests('test024', ''' | 2708 buildTests( |
| 2709 'test024', |
| 2710 ''' |
2029 class List{factory List.from(Iterable other) {}} | 2711 class List{factory List.from(Iterable other) {}} |
2030 class F { | 2712 class F { |
2031 f() { | 2713 f() { |
2032 new List.!1 | 2714 new List.!1 |
2033 } | 2715 } |
2034 }''', <String>["1+from"]); | 2716 }''', |
| 2717 <String>["1+from"]); |
2035 | 2718 |
2036 buildTests('test025', ''' | 2719 buildTests( |
| 2720 'test025', |
| 2721 ''' |
2037 class R { | 2722 class R { |
2038 static R _m; | 2723 static R _m; |
2039 static R m; | 2724 static R m; |
2040 f() { | 2725 f() { |
2041 var a = !1m; | 2726 var a = !1m; |
2042 var b = _!2m; | 2727 var b = _!2m; |
2043 var c = !3g(); | 2728 var c = !3g(); |
2044 } | 2729 } |
2045 static g() { | 2730 static g() { |
2046 var a = !4m; | 2731 var a = !4m; |
(...skipping 11 matching lines...) Expand all Loading... |
2058 static g() { | 2743 static g() { |
2059 var q = R._!Am; | 2744 var q = R._!Am; |
2060 var g = R.!Bm; | 2745 var g = R.!Bm; |
2061 var h = R.!Cg(); | 2746 var h = R.!Cg(); |
2062 } | 2747 } |
2063 h() { | 2748 h() { |
2064 var q = R._!Dm; | 2749 var q = R._!Dm; |
2065 var g = R.!Em; | 2750 var g = R.!Em; |
2066 var h = R.!Fg(); | 2751 var h = R.!Fg(); |
2067 } | 2752 } |
2068 }''', <String>[ | 2753 }''', |
| 2754 <String>[ |
2069 "1+m", | 2755 "1+m", |
2070 "2+_m", | 2756 "2+_m", |
2071 "3+g", | 2757 "3+g", |
2072 "4+m", | 2758 "4+m", |
2073 "5+_m", | 2759 "5+_m", |
2074 "6+g", | 2760 "6+g", |
2075 "7-g", | 2761 "7-g", |
2076 "8-m", | 2762 "8-m", |
2077 "9-_m", | 2763 "9-_m", |
2078 "A+_m", | 2764 "A+_m", |
2079 "B+m", | 2765 "B+m", |
2080 "C+g", | 2766 "C+g", |
2081 "D+_m", | 2767 "D+_m", |
2082 "E+m", | 2768 "E+m", |
2083 "F+g" | 2769 "F+g" |
2084 ]); | 2770 ]); |
2085 | 2771 |
2086 buildTests('test026', '''var aBcD; var x=ab!1''', <String>["1+aBcD"]); | 2772 buildTests('test026', '''var aBcD; var x=ab!1''', <String>["1+aBcD"]); |
2087 | 2773 |
2088 buildTests( | 2774 buildTests( |
2089 'test027', '''m(){try{}catch(eeee,ssss){s!1}''', <String>["1+ssss"]); | 2775 'test027', '''m(){try{}catch(eeee,ssss){s!1}''', <String>["1+ssss"]); |
2090 | 2776 |
2091 buildTests('test028', '''m(){var isX=3;if(is!1)''', <String>["1+isX"]); | 2777 buildTests('test028', '''m(){var isX=3;if(is!1)''', <String>["1+isX"]); |
2092 | 2778 |
2093 buildTests('test029', '''m(){[1].forEach((x)=>!1x);}''', <String>["1+x"]); | 2779 buildTests('test029', '''m(){[1].forEach((x)=>!1x);}''', <String>["1+x"]); |
2094 | 2780 |
2095 buildTests('test030', '''n(){[1].forEach((x){!1});}''', <String>["1+x"]); | 2781 buildTests('test030', '''n(){[1].forEach((x){!1});}''', <String>["1+x"]); |
2096 | 2782 |
2097 buildTests('test031', | 2783 buildTests( |
| 2784 'test031', |
2098 '''class Caster {} m() {try {} on Cas!1ter catch (CastBlock) {!2}}''', | 2785 '''class Caster {} m() {try {} on Cas!1ter catch (CastBlock) {!2}}''', |
2099 <String>["1+Caster", "1-CastBlock", "2+Caster", "2+CastBlock"]); | 2786 <String>["1+Caster", "1-CastBlock", "2+Caster", "2+CastBlock"]); |
2100 | 2787 |
2101 buildTests('test032', ''' | 2788 buildTests( |
| 2789 'test032', |
| 2790 ''' |
2102 const ONE = 1; | 2791 const ONE = 1; |
2103 const ICHI = 10; | 2792 const ICHI = 10; |
2104 const UKSI = 100; | 2793 const UKSI = 100; |
2105 const EIN = 1000; | 2794 const EIN = 1000; |
2106 m() { | 2795 m() { |
2107 int x; | 2796 int x; |
2108 switch (x) { | 2797 switch (x) { |
2109 case !3ICHI: | 2798 case !3ICHI: |
2110 case UKSI: | 2799 case UKSI: |
2111 case EIN!2: | 2800 case EIN!2: |
2112 case ONE!1: return; | 2801 case ONE!1: return; |
2113 default: return; | 2802 default: return; |
2114 } | 2803 } |
2115 }''', <String>[ | 2804 }''', |
| 2805 <String>[ |
2116 "1+ONE", | 2806 "1+ONE", |
2117 "1-UKSI", | 2807 "1-UKSI", |
2118 "2+EIN", | 2808 "2+EIN", |
2119 "2-ICHI", | 2809 "2-ICHI", |
2120 "3+ICHI", | 2810 "3+ICHI", |
2121 "3+UKSI", | 2811 "3+UKSI", |
2122 "3+EIN", | 2812 "3+EIN", |
2123 "3+ONE" | 2813 "3+ONE" |
2124 ]); | 2814 ]); |
2125 | 2815 |
2126 buildTests('test033', | 2816 buildTests( |
| 2817 'test033', |
2127 '''class A{}class B extends A{b(){}}class C implements A {c(){}}class X{
x(){A f;f.!1}}''', | 2818 '''class A{}class B extends A{b(){}}class C implements A {c(){}}class X{
x(){A f;f.!1}}''', |
2128 <String>["1+b", "1-c"], failingTests: '1'); | 2819 <String>["1+b", "1-c"], |
| 2820 failingTests: '1'); |
2129 | 2821 |
2130 // TODO(scheglov) decide what to do with Type for untyped field (not | 2822 // TODO(scheglov) decide what to do with Type for untyped field (not |
2131 // supported by the new store) | 2823 // supported by the new store) |
2132 // test analysis of untyped fields and top-level vars | 2824 // test analysis of untyped fields and top-level vars |
2133 buildTests('test034', ''' | 2825 buildTests( |
| 2826 'test034', |
| 2827 ''' |
2134 var topvar; | 2828 var topvar; |
2135 class Top {top(){}} | 2829 class Top {top(){}} |
2136 class Left extends Top {left(){}} | 2830 class Left extends Top {left(){}} |
2137 class Right extends Top {right(){}} | 2831 class Right extends Top {right(){}} |
2138 t1() { | 2832 t1() { |
2139 topvar = new Left(); | 2833 topvar = new Left(); |
2140 } | 2834 } |
2141 t2() { | 2835 t2() { |
2142 topvar = new Right(); | 2836 topvar = new Right(); |
2143 } | 2837 } |
2144 class A { | 2838 class A { |
2145 var field; | 2839 var field; |
2146 a() { | 2840 a() { |
2147 field = new Left(); | 2841 field = new Left(); |
2148 } | 2842 } |
2149 b() { | 2843 b() { |
2150 field = new Right(); | 2844 field = new Right(); |
2151 } | 2845 } |
2152 test() { | 2846 test() { |
2153 topvar.!1top(); | 2847 topvar.!1top(); |
2154 field.!2top(); | 2848 field.!2top(); |
2155 } | 2849 } |
2156 }''', <String>["1+top", "2+top"], failingTests: '12'); | 2850 }''', |
| 2851 <String>["1+top", "2+top"], |
| 2852 failingTests: '12'); |
2157 | 2853 |
2158 // test analysis of untyped fields and top-level vars | 2854 // test analysis of untyped fields and top-level vars |
2159 buildTests('test035', '''class Y {final x='hi';mth() {x.!1length;}}''', | 2855 buildTests('test035', '''class Y {final x='hi';mth() {x.!1length;}}''', |
2160 <String>["1+length"]); | 2856 <String>["1+length"]); |
2161 | 2857 |
2162 // TODO(scheglov) decide what to do with Type for untyped field (not | 2858 // TODO(scheglov) decide what to do with Type for untyped field (not |
2163 // supported by the new store) | 2859 // supported by the new store) |
2164 // test analysis of untyped fields and top-level vars | 2860 // test analysis of untyped fields and top-level vars |
2165 buildTests('test036', ''' | 2861 buildTests( |
| 2862 'test036', |
| 2863 ''' |
2166 class A1 { | 2864 class A1 { |
2167 var field; | 2865 var field; |
2168 A1() : field = 0; | 2866 A1() : field = 0; |
2169 q() { | 2867 q() { |
2170 A1 a = new A1(); | 2868 A1 a = new A1(); |
2171 a.field.!1 | 2869 a.field.!1 |
2172 } | 2870 } |
2173 } | 2871 } |
2174 main() { | 2872 main() { |
2175 A1 a = new A1(); | 2873 A1 a = new A1(); |
2176 a.field.!2 | 2874 a.field.!2 |
2177 }''', <String>["1+round", "2+round"], failingTests: '12'); | 2875 }''', |
| 2876 <String>["1+round", "2+round"], |
| 2877 failingTests: '12'); |
2178 | 2878 |
2179 buildTests('test037', ''' | 2879 buildTests( |
| 2880 'test037', |
| 2881 ''' |
2180 class HttpServer{} | 2882 class HttpServer{} |
2181 class HttpClient{} | 2883 class HttpClient{} |
2182 main() { | 2884 main() { |
2183 new HtS!1 | 2885 new HtS!1 |
2184 }''', <String>["1+HttpServer", "1-HttpClient"], failingTests: '1'); | 2886 }''', |
| 2887 <String>["1+HttpServer", "1-HttpClient"], |
| 2888 failingTests: '1'); |
2185 | 2889 |
2186 buildTests('test038', ''' | 2890 buildTests( |
| 2891 'test038', |
| 2892 ''' |
2187 class X { | 2893 class X { |
2188 x(){} | 2894 x(){} |
2189 } | 2895 } |
2190 class Y { | 2896 class Y { |
2191 y(){} | 2897 y(){} |
2192 } | 2898 } |
2193 class A<Z extends X> { | 2899 class A<Z extends X> { |
2194 Y ay; | 2900 Y ay; |
2195 Z az; | 2901 Z az; |
2196 A(this.ay, this.az) { | 2902 A(this.ay, this.az) { |
2197 ay.!1y; | 2903 ay.!1y; |
2198 az.!2x; | 2904 az.!2x; |
2199 } | 2905 } |
2200 }''', <String>["1+y", "1-x", "2+x", "2-y"], failingTests: '2'); | 2906 }''', |
| 2907 <String>["1+y", "1-x", "2+x", "2-y"], |
| 2908 failingTests: '2'); |
2201 | 2909 |
2202 // test analysis of untyped fields and top-level vars | 2910 // test analysis of untyped fields and top-level vars |
2203 buildTests('test039', '''class X{}var x = null as !1X;''', <String>[ | 2911 buildTests('test039', '''class X{}var x = null as !1X;''', |
2204 "1+X", | 2912 <String>["1+X", "1-void"]); |
2205 "1-void" | |
2206 ]); | |
2207 | 2913 |
2208 // test arg lists with named params | 2914 // test arg lists with named params |
2209 buildTests('test040', '''m(){f(a, b, {x1, x2, y}) {};f(1, 2, !1)!2;}''', | 2915 buildTests('test040', '''m(){f(a, b, {x1, x2, y}) {};f(1, 2, !1)!2;}''', |
2210 <String>["1+x1", "2-x2"], failingTests: '1'); | 2916 <String>["1+x1", "2-x2"], |
| 2917 failingTests: '1'); |
2211 | 2918 |
2212 // test arg lists with named params | 2919 // test arg lists with named params |
2213 buildTests('test041', '''m(){f(a, b, {x1, x2, y}) {};f(1, 2, !1''', | 2920 buildTests('test041', '''m(){f(a, b, {x1, x2, y}) {};f(1, 2, !1''', |
2214 <String>["1+x1", "1+x2", "1+y"], failingTests: '1'); | 2921 <String>["1+x1", "1+x2", "1+y"], |
| 2922 failingTests: '1'); |
2215 | 2923 |
2216 // test arg lists with named params | 2924 // test arg lists with named params |
2217 buildTests('test042', '''m(){f(a, b, {x1, x2, y}) {};f(1, 2, !1;!2''', | 2925 buildTests('test042', '''m(){f(a, b, {x1, x2, y}) {};f(1, 2, !1;!2''', |
2218 <String>["1+x1", "1+x2", "2-y"], failingTests: '1'); | 2926 <String>["1+x1", "1+x2", "2-y"], |
| 2927 failingTests: '1'); |
2219 } | 2928 } |
2220 | 2929 |
2221 void buildOtherTests() { | 2930 void buildOtherTests() { |
2222 buildTests('test_classMembers_inGetter', | 2931 buildTests('test_classMembers_inGetter', |
2223 '''class A { var fff; get z {ff!1}}''', <String>["1+fff"]); | 2932 '''class A { var fff; get z {ff!1}}''', <String>["1+fff"]); |
2224 | 2933 |
2225 buildTests('testSingle', | 2934 buildTests( |
2226 '''class A {int x; !2mth() {int y = this.x;}}class B{}''', <String>[ | 2935 'testSingle', |
2227 "2+B" | 2936 '''class A {int x; !2mth() {int y = this.x;}}class B{}''', |
2228 ]); | 2937 <String>["2+B"]); |
2229 } | 2938 } |
2230 | 2939 |
2231 /** | 2940 /** |
2232 * Generate a set of completion tests based on the given [originalSource]. | 2941 * Generate a set of completion tests based on the given [originalSource]. |
2233 * | 2942 * |
2234 * The source string has completion points embedded in it, which are | 2943 * The source string has completion points embedded in it, which are |
2235 * identified by '!X' where X is a single character. Each X is matched to | 2944 * identified by '!X' where X is a single character. Each X is matched to |
2236 * positive or negative results in the array of [validationStrings]. | 2945 * positive or negative results in the array of [validationStrings]. |
2237 * Validation strings contain the name of a prediction with a two character | 2946 * Validation strings contain the name of a prediction with a two character |
2238 * prefix. The first character of the prefix corresponds to an X in the | 2947 * prefix. The first character of the prefix corresponds to an X in the |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2285 } else { | 2994 } else { |
2286 ++expectedPassCount; | 2995 ++expectedPassCount; |
2287 tester(testName, () { | 2996 tester(testName, () { |
2288 CompletionTestCase test = new CompletionTestCase(); | 2997 CompletionTestCase test = new CompletionTestCase(); |
2289 return test.runTest(spec, extraFiles); | 2998 return test.runTest(spec, extraFiles); |
2290 }); | 2999 }); |
2291 } | 3000 } |
2292 } | 3001 } |
2293 } | 3002 } |
2294 } | 3003 } |
OLD | NEW |