| Index: pkg/analysis_server/test/services/completion/dart/inherited_computer_test.dart
|
| diff --git a/pkg/analysis_server/test/services/completion/dart/inherited_computer_test.dart b/pkg/analysis_server/test/services/completion/dart/inherited_computer_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a3aa409f90e3059f3562b093fae98b55825e2fca
|
| --- /dev/null
|
| +++ b/pkg/analysis_server/test/services/completion/dart/inherited_computer_test.dart
|
| @@ -0,0 +1,77 @@
|
| +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +library test.services.completion.inherited_computer_test;
|
| +
|
| +import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol
|
| + show Element, ElementKind;
|
| +import 'package:analysis_server/plugin/protocol/protocol.dart'
|
| + hide Element, ElementKind;
|
| +import 'package:analysis_server/src/provisional/completion/completion_dart.dart';
|
| +import 'package:analysis_server/src/services/completion/dart_completion_manager.dart'
|
| + hide DartCompletionContributor;
|
| +import 'package:analysis_server/src/services/completion/dart/inherited_contributor.dart';
|
| +import 'package:test_reflective_loader/test_reflective_loader.dart';
|
| +import 'package:unittest/unittest.dart';
|
| +
|
| +import '../../../utils.dart';
|
| +import 'dart_completion_contributor_test.dart';
|
| +
|
| +main() {
|
| + initializeTestEnvironment();
|
| + defineReflectiveTests(InheritedContributorTest);
|
| +}
|
| +
|
| +@reflectiveTest
|
| +class InheritedContributorTest extends DartCompletionContributorTest {
|
| + @override
|
| + DartCompletionContributor createContributor() {
|
| + return new InheritedContributor();
|
| + }
|
| +
|
| + test_fromMultipleSuperclasses() async {
|
| + addTestSource(r'''
|
| +class A {
|
| + notSuggested() => null;
|
| + A suggested1(int x) => null;
|
| + B suggested2(String y) => null;
|
| +}
|
| +class B extends A {
|
| + B suggested2(String y) => null;
|
| + C suggested3([String z]) => null;
|
| +}
|
| +class C extends B {
|
| + sugg^
|
| +}
|
| +''');
|
| + await computeSuggestions();
|
| + _assertOverride(
|
| + '@override\n A suggested1(int x) {\n // TODO: implement suggested1\n return null;\n }');
|
| + _assertOverride(
|
| + '''@override\n B suggested2(String y) {\n // TODO: implement suggested2\n return null;\n }''');
|
| + _assertOverride(
|
| + '''@override\n C suggested3([String z]) {\n // TODO: implement suggested3\n return null;\n }''');
|
| + assertNotSuggested(
|
| + '''@override\n notSuggested() {\n // TODO: implement notSuggested\n return null;\n }''');
|
| + }
|
| +
|
| + CompletionSuggestion _assertOverride(String completion) {
|
| + CompletionSuggestion cs = getSuggest(
|
| + completion: completion,
|
| + csKind: CompletionSuggestionKind.IDENTIFIER,
|
| + elemKind: null);
|
| + if (cs == null) {
|
| + failedCompletion('expected $completion', suggestions);
|
| + }
|
| + expect(cs.kind, equals(CompletionSuggestionKind.IDENTIFIER));
|
| + expect(cs.relevance, equals(DART_RELEVANCE_HIGH));
|
| + expect(cs.importUri, null);
|
| +// expect(cs.selectionOffset, equals(completion.length));
|
| +// expect(cs.selectionLength, equals(0));
|
| + expect(cs.isDeprecated, isFalse);
|
| + expect(cs.isPotential, isFalse);
|
| + expect(cs.element, isNotNull);
|
| + return cs;
|
| + }
|
| +}
|
|
|