enum constant and named cons test cases

Verifies that our client algorithm addresses issues seen in IntelliJ (https://github.com/dart-lang/sdk/issues/40620) and worked around in VSCode (ea7443dab3)

Change-Id: I2029d89559625ff666c947186d90484794f6b38b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135721
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
pq 2020-02-13 21:24:48 +00:00 committed by commit-bot@chromium.org
parent 01e079eff1
commit 867d6537df

View file

@ -227,7 +227,7 @@ class CompletionWithSuggestionsTest extends AbstractCompletionDriverTest {
@override
String get testFilePath => '$projectPath/lib/test.dart';
Future<void> test_project_filterImports() async {
Future<void> test_project_filterImports_defaultConstructor() async {
await addProjectFile('lib/a.dart', r'''
class A {}
''');
@ -249,6 +249,55 @@ void main() {
kind: CompletionSuggestionKind.INVOCATION);
}
/// see: https://github.com/dart-lang/sdk/issues/40620
Future<void> test_project_filterImports_enumValues() async {
await addProjectFile('lib/a.dart', r'''
enum E {
e,
}
''');
await addProjectFile('lib/b.dart', r'''
export 'a.dart';
''');
await addTestFile('''
import 'a.dart';
void main() {
^
}
''');
expectSuggestion(
completion: 'E.e',
element: ElementKind.ENUM_CONSTANT,
kind: CompletionSuggestionKind.INVOCATION);
}
/// see: https://github.com/dart-lang/sdk/issues/40620
Future<void> test_project_filterImports_namedConstructors() async {
await addProjectFile('lib/a.dart', r'''
class A {
A.a();
}
''');
await addProjectFile('lib/b.dart', r'''
export 'a.dart';
''');
await addTestFile('''
import 'a.dart';
void main() {
^
}
''');
expectSuggestion(
completion: 'A.a',
element: ElementKind.CONSTRUCTOR,
kind: CompletionSuggestionKind.INVOCATION);
}
Future<void> test_project_filterMultipleImports() async {
await addProjectFile('lib/a.dart', r'''
class A {}