Skip to content

Commit c371785

Browse files
pqCommit Queue
authored and
Commit Queue
committed
[wildcards] legacy navigation tests
See: #56567 Change-Id: I0abf861903e440f3bc6162e671c71d134786e8d4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382280 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Phil Quitslund <[email protected]>
1 parent a4a146d commit c371785

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

pkg/analysis_server/test/analysis/get_navigation_test.dart

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,22 @@ final b = new Foo.named(); // 0
134134
expect(target.length, 5);
135135
}
136136

137+
Future<void> test_field_underscore() async {
138+
addTestFile('''
139+
class C {
140+
int _ = 0;
141+
}
142+
143+
f() {
144+
C()._;
145+
}
146+
''');
147+
await waitForTasksFinished();
148+
await _getNavigation(search: '_;');
149+
assertHasRegion('_;');
150+
assertHasTarget('_ = 0');
151+
}
152+
137153
Future<void> test_fieldType() async {
138154
// This test mirrors test_navigation() from
139155
// test/integration/analysis/get_navigation_test.dart
@@ -336,6 +352,17 @@ void f(A a) {
336352
}
337353
}
338354

355+
Future<void> test_parameter_wildcard() async {
356+
addTestFile('''
357+
var _ = 0;
358+
f(int _) { }
359+
''');
360+
await waitForTasksFinished();
361+
await _getNavigation(search: '_)');
362+
assertHasRegion('_)');
363+
assertHasTarget('_)');
364+
}
365+
339366
Future<void> test_partDirective() async {
340367
var partFile = newFile(
341368
'$testPackageLibPath/a.dart',
@@ -394,6 +421,40 @@ part of 'a.dart';
394421
assertHasFileTarget(partOfFile.path, 0, 0);
395422
}
396423

424+
Future<void> test_prefix_wildcard() async {
425+
addTestFile('''
426+
import 'dart:io' as _;
427+
''');
428+
await waitForTasksFinished();
429+
await _getNavigation(search: '_');
430+
assertHasRegion('_');
431+
assertHasTarget('_');
432+
}
433+
434+
Future<void> test_topLevelVariable_underscore() async {
435+
addTestFile('''
436+
var _ = 0;
437+
438+
f(int _) {
439+
_;
440+
}
441+
''');
442+
await waitForTasksFinished();
443+
await _getNavigation(search: '_;');
444+
assertHasRegion('_;');
445+
assertHasTarget('_ = 0');
446+
}
447+
448+
Future<void> test_typeParameter_wildcard() async {
449+
addTestFile('''
450+
class C<_> {}
451+
''');
452+
await waitForTasksFinished();
453+
await _getNavigation(search: '_');
454+
assertHasRegion('_');
455+
assertHasTarget('_');
456+
}
457+
397458
Future<void> test_zeroLength_end() async {
398459
addTestFile('''
399460
void f() {

0 commit comments

Comments
 (0)