Skip to content

Commit 867d653

Browse files
pqcommit-bot@chromium.org
authored andcommitted
enum constant and named cons test cases
Verifies that our client algorithm addresses issues seen in IntelliJ (#40620) and worked around in VSCode (Dart-Code/Dart-Code@ea7443d) 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>
1 parent 01e079e commit 867d653

1 file changed

Lines changed: 50 additions & 1 deletion

File tree

pkg/analysis_server/test/client/completion_driver_test.dart

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class CompletionWithSuggestionsTest extends AbstractCompletionDriverTest {
227227
@override
228228
String get testFilePath => '$projectPath/lib/test.dart';
229229

230-
Future<void> test_project_filterImports() async {
230+
Future<void> test_project_filterImports_defaultConstructor() async {
231231
await addProjectFile('lib/a.dart', r'''
232232
class A {}
233233
''');
@@ -249,6 +249,55 @@ void main() {
249249
kind: CompletionSuggestionKind.INVOCATION);
250250
}
251251

252+
/// see: https://github.com/dart-lang/sdk/issues/40620
253+
Future<void> test_project_filterImports_enumValues() async {
254+
await addProjectFile('lib/a.dart', r'''
255+
enum E {
256+
e,
257+
}
258+
''');
259+
260+
await addProjectFile('lib/b.dart', r'''
261+
export 'a.dart';
262+
''');
263+
264+
await addTestFile('''
265+
import 'a.dart';
266+
void main() {
267+
^
268+
}
269+
''');
270+
expectSuggestion(
271+
completion: 'E.e',
272+
element: ElementKind.ENUM_CONSTANT,
273+
kind: CompletionSuggestionKind.INVOCATION);
274+
}
275+
276+
/// see: https://github.com/dart-lang/sdk/issues/40620
277+
Future<void> test_project_filterImports_namedConstructors() async {
278+
await addProjectFile('lib/a.dart', r'''
279+
class A {
280+
A.a();
281+
}
282+
''');
283+
284+
await addProjectFile('lib/b.dart', r'''
285+
export 'a.dart';
286+
''');
287+
288+
await addTestFile('''
289+
import 'a.dart';
290+
void main() {
291+
^
292+
}
293+
''');
294+
295+
expectSuggestion(
296+
completion: 'A.a',
297+
element: ElementKind.CONSTRUCTOR,
298+
kind: CompletionSuggestionKind.INVOCATION);
299+
}
300+
252301
Future<void> test_project_filterMultipleImports() async {
253302
await addProjectFile('lib/a.dart', r'''
254303
class A {}

0 commit comments

Comments
 (0)