| 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.services.completion.util; | 5 library test.services.completion.util; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart' as protocol | 9 import 'package:analysis_server/src/protocol.dart' as protocol |
| 10 show Element, ElementKind; | 10 show Element, ElementKind; |
| (...skipping 2267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2278 assertNotSuggested('foo'); | 2278 assertNotSuggested('foo'); |
| 2279 assertNotSuggested('F1'); | 2279 assertNotSuggested('F1'); |
| 2280 assertNotSuggested('F2'); | 2280 assertNotSuggested('F2'); |
| 2281 assertNotSuggested('T1'); | 2281 assertNotSuggested('T1'); |
| 2282 assertNotSuggested('T2'); | 2282 assertNotSuggested('T2'); |
| 2283 }); | 2283 }); |
| 2284 } | 2284 } |
| 2285 | 2285 |
| 2286 test_InterpolationExpression() { | 2286 test_InterpolationExpression() { |
| 2287 // SimpleIdentifier InterpolationExpression StringInterpolation | 2287 // SimpleIdentifier InterpolationExpression StringInterpolation |
| 2288 addTestSource('main() {String name; print("hello \$^");}'); | 2288 addSource('/testA.dart', ''' |
| 2289 int T1; |
| 2290 F1() { } |
| 2291 typedef D1(); |
| 2292 class C1 {C1(this.x) { } int x;}'''); |
| 2293 addTestSource(''' |
| 2294 import "/testA.dart"; |
| 2295 int T2; |
| 2296 F2() { } |
| 2297 typedef D2(); |
| 2298 class C2 { } |
| 2299 main() {String name; print("hello \$^");}'''); |
| 2289 computeFast(); | 2300 computeFast(); |
| 2290 return computeFull((bool result) { | 2301 return computeFull((bool result) { |
| 2291 expect(request.replacementOffset, completionOffset); | 2302 expect(request.replacementOffset, completionOffset); |
| 2292 expect(request.replacementLength, 0); | 2303 expect(request.replacementLength, 0); |
| 2304 assertNotSuggested('Object'); |
| 2305 // TODO(danrubel) should return top level var rather than getter |
| 2306 if (computer is ImportedComputer) { |
| 2307 //assertSuggestImportedTopLevelVar('T1', 'int'); |
| 2308 assertSuggestGetter('T1', 'int'); |
| 2309 } |
| 2310 assertSuggestImportedFunction('F1', null); |
| 2311 assertNotSuggested('D1'); |
| 2312 assertNotSuggested('C1'); |
| 2313 assertSuggestLocalTopLevelVar('T2', 'int'); |
| 2314 assertSuggestLocalFunction('F2', null); |
| 2315 assertNotSuggested('D2'); |
| 2316 assertNotSuggested('C2'); |
| 2293 assertSuggestLocalVariable('name', 'String'); | 2317 assertSuggestLocalVariable('name', 'String'); |
| 2294 assertSuggestImportedClass('Object'); | |
| 2295 }); | 2318 }); |
| 2296 } | 2319 } |
| 2297 | 2320 |
| 2298 test_InterpolationExpression_block() { | 2321 test_InterpolationExpression_block() { |
| 2299 // SimpleIdentifier InterpolationExpression StringInterpolation | 2322 // SimpleIdentifier InterpolationExpression StringInterpolation |
| 2323 addSource('/testA.dart', ''' |
| 2324 int T1; |
| 2325 F1() { } |
| 2326 typedef D1(); |
| 2327 class C1 {C1(this.x) { } int x;}'''); |
| 2328 addTestSource(''' |
| 2329 import "/testA.dart"; |
| 2330 int T2; |
| 2331 F2() { } |
| 2332 typedef D2(); |
| 2333 class C2 { } |
| 2334 main() {String name; print("hello \${^}");}'''); |
| 2335 computeFast(); |
| 2336 return computeFull((bool result) { |
| 2337 expect(request.replacementOffset, completionOffset); |
| 2338 expect(request.replacementLength, 0); |
| 2339 assertSuggestImportedClass('Object'); |
| 2340 // TODO(danrubel) should return top level var rather than getter |
| 2341 if (computer is ImportedComputer) { |
| 2342 //assertSuggestImportedTopLevelVar('T1', 'int'); |
| 2343 assertSuggestGetter('T1', 'int'); |
| 2344 } |
| 2345 assertSuggestImportedFunction('F1', null); |
| 2346 assertSuggestImportedFunctionTypeAlias('D1', null); |
| 2347 assertSuggestImportedClass('C1'); |
| 2348 assertSuggestLocalTopLevelVar('T2', 'int'); |
| 2349 assertSuggestLocalFunction('F2', null); |
| 2350 assertSuggestLocalFunctionTypeAlias('D2', null); |
| 2351 assertSuggestLocalClass('C2'); |
| 2352 assertSuggestLocalVariable('name', 'String'); |
| 2353 }); |
| 2354 } |
| 2355 |
| 2356 test_InterpolationExpression_block2() { |
| 2357 // SimpleIdentifier InterpolationExpression StringInterpolation |
| 2300 addTestSource('main() {String name; print("hello \${n^}");}'); | 2358 addTestSource('main() {String name; print("hello \${n^}");}'); |
| 2301 computeFast(); | 2359 computeFast(); |
| 2302 return computeFull((bool result) { | 2360 return computeFull((bool result) { |
| 2303 assertSuggestLocalVariable('name', 'String'); | 2361 assertSuggestLocalVariable('name', 'String'); |
| 2304 // top level results are partially filtered | 2362 // top level results are partially filtered |
| 2305 //assertSuggestImportedClass('Object'); | 2363 //assertSuggestImportedClass('Object'); |
| 2306 }); | 2364 }); |
| 2307 } | 2365 } |
| 2308 | 2366 |
| 2309 test_InterpolationExpression_prefix_selector() { | 2367 test_InterpolationExpression_prefix_selector() { |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3196 assertNotSuggested('bar2'); | 3254 assertNotSuggested('bar2'); |
| 3197 assertNotSuggested('_B'); | 3255 assertNotSuggested('_B'); |
| 3198 assertSuggestLocalClass('Y'); | 3256 assertSuggestLocalClass('Y'); |
| 3199 assertSuggestLocalClass('C'); | 3257 assertSuggestLocalClass('C'); |
| 3200 assertSuggestLocalVariable('f', null); | 3258 assertSuggestLocalVariable('f', null); |
| 3201 assertNotSuggested('x'); | 3259 assertNotSuggested('x'); |
| 3202 assertNotSuggested('e'); | 3260 assertNotSuggested('e'); |
| 3203 }); | 3261 }); |
| 3204 } | 3262 } |
| 3205 } | 3263 } |
| OLD | NEW |