| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 library test.services.completion.inherited_computer_test; | |
| 6 | |
| 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; | |
| 8 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | |
| 9 import 'package:analysis_server/src/services/completion/inherited_contributor.da
rt'; | |
| 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; | |
| 11 import 'package:unittest/src/matcher/core_matchers.dart'; | |
| 12 import 'package:unittest/unittest.dart'; | |
| 13 | |
| 14 import '../../utils.dart'; | |
| 15 import 'completion_test_util.dart'; | |
| 16 | |
| 17 main() { | |
| 18 initializeTestEnvironment(); | |
| 19 // defineReflectiveTests(InheritedContributorTest); | |
| 20 } | |
| 21 | |
| 22 @reflectiveTest | |
| 23 class InheritedContributorTest extends AbstractCompletionTest { | |
| 24 @override | |
| 25 void setUpContributor() { | |
| 26 contributor = new NewCompletionWrapper(new InheritedContributor()); | |
| 27 } | |
| 28 | |
| 29 test_fromMultipleSuperclasses() { | |
| 30 addTestSource(r''' | |
| 31 class A { | |
| 32 notSuggested() => null; | |
| 33 A suggested1(int x) => null; | |
| 34 B suggested2(String y) => null; | |
| 35 } | |
| 36 class B extends A { | |
| 37 B suggested2(String y) => null; | |
| 38 C suggested3([String z]) => null; | |
| 39 } | |
| 40 class C extends B { | |
| 41 sugg^ | |
| 42 } | |
| 43 '''); | |
| 44 computeFast(); | |
| 45 return computeFull((bool result) { | |
| 46 _assertOverride( | |
| 47 '@override\n A suggested1(int x) {\n // TODO: implement suggested1
\n return null;\n }'); | |
| 48 _assertOverride( | |
| 49 '''@override\n B suggested2(String y) {\n // TODO: implement sugge
sted2\n return null;\n }'''); | |
| 50 _assertOverride( | |
| 51 '''@override\n C suggested3([String z]) {\n // TODO: implement sug
gested3\n return null;\n }'''); | |
| 52 assertNotSuggested( | |
| 53 '''@override\n notSuggested() {\n // TODO: implement notSuggested\
n return null;\n }'''); | |
| 54 }); | |
| 55 } | |
| 56 | |
| 57 CompletionSuggestion _assertOverride(String completion) { | |
| 58 CompletionSuggestion cs = getSuggest( | |
| 59 completion: completion, | |
| 60 csKind: CompletionSuggestionKind.IDENTIFIER, | |
| 61 elemKind: null); | |
| 62 if (cs == null) { | |
| 63 failedCompletion('expected $completion', request.suggestions); | |
| 64 } | |
| 65 expect(cs.kind, equals(CompletionSuggestionKind.IDENTIFIER)); | |
| 66 expect(cs.relevance, equals(DART_RELEVANCE_HIGH)); | |
| 67 expect(cs.importUri, null); | |
| 68 // expect(cs.selectionOffset, equals(completion.length)); | |
| 69 expect(cs.selectionLength, equals(0)); | |
| 70 expect(cs.isDeprecated, isFalse); | |
| 71 expect(cs.isPotential, isFalse); | |
| 72 expect(cs.element, isNotNull); | |
| 73 return cs; | |
| 74 } | |
| 75 } | |
| OLD | NEW |