| 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.toplevel; | 5 library test.services.completion.toplevel; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; | 8 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; |
| 9 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; | 9 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; |
| 10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 expect(suggestion.parameterNames, hasLength(2)); | 471 expect(suggestion.parameterNames, hasLength(2)); |
| 472 expect(suggestion.parameterNames[0], 'x'); | 472 expect(suggestion.parameterNames[0], 'x'); |
| 473 expect(suggestion.parameterTypes[0], 'dynamic'); | 473 expect(suggestion.parameterTypes[0], 'dynamic'); |
| 474 expect(suggestion.parameterNames[1], 'y'); | 474 expect(suggestion.parameterNames[1], 'y'); |
| 475 expect(suggestion.parameterTypes[1], 'int'); | 475 expect(suggestion.parameterTypes[1], 'int'); |
| 476 expect(suggestion.requiredParameterCount, 2); | 476 expect(suggestion.requiredParameterCount, 2); |
| 477 expect(suggestion.hasNamedParameters, false); | 477 expect(suggestion.hasNamedParameters, false); |
| 478 }); | 478 }); |
| 479 } | 479 } |
| 480 | 480 |
| 481 test_mixin_ordering() { |
| 482 // TODO(paulberry): The mixins are visited in the correct order, so we see |
| 483 // M2.m() before M1.m(), as we should. But the second (shadowed) result |
| 484 // isn't being thrown out as it should. |
| 485 addSource('/libA.dart', ''' |
| 486 class B {} |
| 487 class M1 { |
| 488 void m() {} |
| 489 } |
| 490 class M2 { |
| 491 void m() {} |
| 492 } |
| 493 '''); |
| 494 addTestSource(''' |
| 495 import '/libA.dart'; |
| 496 class C extends B with M1, M2 { |
| 497 void f() { |
| 498 ^ |
| 499 } |
| 500 } |
| 501 '''); |
| 502 return computeFull((bool result) { |
| 503 assertSuggestMethod('m', 'M2', 'void'); |
| 504 }); |
| 505 } |
| 506 |
| 481 /** | 507 /** |
| 482 * Ensure that completions in one context don't appear in another | 508 * Ensure that completions in one context don't appear in another |
| 483 */ | 509 */ |
| 484 test_multiple_contexts() { | 510 test_multiple_contexts() { |
| 485 | 511 |
| 486 // Create a 2nd context with source | 512 // Create a 2nd context with source |
| 487 var context2 = AnalysisEngine.instance.createAnalysisContext(); | 513 var context2 = AnalysisEngine.instance.createAnalysisContext(); |
| 488 context2.sourceFactory = | 514 context2.sourceFactory = |
| 489 new SourceFactory([AbstractContextTest.SDK_RESOLVER, resourceResolver]); | 515 new SourceFactory([AbstractContextTest.SDK_RESOLVER, resourceResolver]); |
| 490 String content2 = 'class ClassFromAnotherContext { }'; | 516 String content2 = 'class ClassFromAnotherContext { }'; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 | 614 |
| 589 @override | 615 @override |
| 590 test_partFile_TypeName2() { | 616 test_partFile_TypeName2() { |
| 591 return super.test_partFile_TypeName2().then((_) { | 617 return super.test_partFile_TypeName2().then((_) { |
| 592 expect( | 618 expect( |
| 593 request.cache.importKey, | 619 request.cache.importKey, |
| 594 'library libA;import "/testB.dart";part "/testA.dart";'); | 620 'library libA;import "/testB.dart";part "/testA.dart";'); |
| 595 }); | 621 }); |
| 596 } | 622 } |
| 597 } | 623 } |
| OLD | NEW |