blob: fd10530909ff0895822eafefb83efa91de27d207 [file] [log] [blame]
// Copyright (c) 2020, 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.
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../completion_contributor_util.dart';
void main() {
defineReflectiveSuite(() {
defineReflectiveTests(DeprecatedMemberRelevanceTest);
});
}
@reflectiveTest
class DeprecatedMemberRelevanceTest extends DartCompletionManagerTest {
Future<void> test_deprecated() async {
addTestSource('''
class A {
void a1() { }
@deprecated
void a2() { }
}
void main() {
var a = A();
a.^
}
''');
await computeSuggestions();
expect(
suggestionWith(
completion: 'a2',
element: ElementKind.METHOD,
kind: CompletionSuggestionKind.INVOCATION)
.relevance,
lessThan(suggestionWith(
completion: 'a1',
element: ElementKind.METHOD,
kind: CompletionSuggestionKind.INVOCATION)
.relevance));
}
}