Skip to content

Commit 622c9b5

Browse files
pqCommit Queue
authored andcommitted
[wildcards] LSP definition tests
See: #55681 Change-Id: I733947154352f887896e48b96ead34d8e8159fb5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381307 Commit-Queue: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 6413386 commit 622c9b5

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

pkg/analysis_server/test/lsp/definition_test.dart

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,33 @@ class A {
239239
await testContents(contents);
240240
}
241241

242+
Future<void> test_constructor_redirectingSuper_wildcards() async {
243+
var contents = '''
244+
class A {
245+
final int x, y;
246+
A(this.[!x!], [this.y = 0]);
247+
}
248+
249+
class C extends A {
250+
final int c;
251+
C(this.c, super.^_);
252+
}
253+
''';
254+
255+
await testContents(contents);
256+
}
257+
258+
Future<void> test_constructor_thisReference_wildcards() async {
259+
var contents = '''
260+
class A {
261+
final int [!_!];
262+
A(this.^_);
263+
}
264+
''';
265+
266+
await testContents(contents);
267+
}
268+
242269
Future<void> test_constructorNamed() async {
243270
var contents = '''
244271
f() {
@@ -307,6 +334,17 @@ class [!A!] {
307334
);
308335
}
309336

337+
Future<void> test_field_underscore() async {
338+
var contents = '''
339+
class A {
340+
int [!_!] = 1;
341+
int f() => _^;
342+
}
343+
''';
344+
345+
await testContents(contents);
346+
}
347+
310348
Future<void> test_fieldFormalParam() async {
311349
var contents = '''
312350
class A {
@@ -663,6 +701,17 @@ class A {}
663701
expect(getTextForRange(macroContent, location.targetSelectionRange), 'foo');
664702
}
665703

704+
Future<void> test_method_underscore() async {
705+
var contents = '''
706+
class A {
707+
int [!_!]() => 1;
708+
int f() => _^();
709+
}
710+
''';
711+
712+
await testContents(contents);
713+
}
714+
666715
Future<void> test_nonDartFile() async {
667716
newFile(pubspecFilePath, simplePubspecContent);
668717
await initialize();
@@ -747,6 +796,15 @@ class B extends A {
747796
await testContents(contents);
748797
}
749798

799+
Future<void> test_topLevelVariable_underscore() async {
800+
var contents = '''
801+
int [!_!] = 0;
802+
int f = ^_;
803+
''';
804+
805+
await testContents(contents);
806+
}
807+
750808
Future<void> test_type() async {
751809
var contents = '''
752810
f() {

0 commit comments

Comments
 (0)