Stop using main in test code in more places, part 3

Change-Id: Ia35343f4d79037875fe154a38a3adcf8117d9369
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243881
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Brian Wilkerson 2022-05-06 22:34:50 +00:00 committed by Commit Bot
parent 1f42a21c2c
commit 45d8c7ee4b
52 changed files with 245 additions and 235 deletions

View file

@ -28,7 +28,7 @@ class GetErrorsTest extends PubPackageAnalysisServerTest {
Future<void> test_afterAnalysisComplete() async {
newFile(testFilePath, '''
main() {
void f() {
print(42)
}
''');
@ -74,7 +74,7 @@ class A {}
Future<void> test_hasErrors() async {
newFile(testFilePath, '''
main() {
void f() {
print(42)
}
''');
@ -112,7 +112,7 @@ main() {
Future<void> test_noErrors() async {
newFile(testFilePath, '''
main() {
void f() {
print(42);
}
''');

View file

@ -29,7 +29,7 @@ class GetNavigationTest extends AbstractNavigationTest {
Future<void> test_beforeAnalysisComplete() async {
addTestFile('''
main() {
void f() {
var test = 0;
print(test);
}
@ -42,7 +42,7 @@ main() {
Future<void> test_comment_outsideReference() async {
addTestFile('''
/// Returns a [String].
String main() {
String f() {
}''');
await waitForTasksFinished();
await _getNavigation(search: 'Returns', length: 1);
@ -52,7 +52,7 @@ String main() {
Future<void> test_comment_reference() async {
addTestFile('''
/// Returns a [String].
String main() {
String f() {
}''');
await waitForTasksFinished();
await _getNavigation(search: '[String', length: 1);
@ -67,7 +67,7 @@ String main() {
/// {@tool dartpad}
/// ** See code in $examplePath **
/// {@end-tool}
String main() {
String f() {
}''');
await waitForTasksFinished();
await _getNavigation(search: examplePath, length: 1);
@ -148,7 +148,7 @@ class Bar {
@FailingTest(reason: 'requires infrastructure rewriting')
Future<void> test_fileOutsideOfRoot() async {
var file = newFile('/outside.dart', '''
main() {
void f() {
var test = 0;
print(test);
}
@ -162,7 +162,7 @@ main() {
addTestFile('''
import 'dart:math';
main() {
void f() {
}''');
await waitForTasksFinished();
await _getNavigation(offset: 0, length: 17);
@ -176,7 +176,7 @@ main() {
addTestFile('''
import 'dart:math';
main() {
void f() {
}''');
await waitForTasksFinished();
await _getNavigation(offset: 7, length: 11);
@ -194,7 +194,7 @@ import 'foo.dart'
if (dart.library.io) 'io.dart'
if (dart.library.html) 'html.dart';
main() {
void f() {
}''');
await waitForTasksFinished();
@ -240,7 +240,7 @@ main() {
Future<void> test_multipleRegions() async {
addTestFile('''
main() {
void f() {
var aaa = 1;
var bbb = 2;
var ccc = 3;
@ -316,7 +316,7 @@ void f(A a) {
Future<void> test_zeroLength_end() async {
addTestFile('''
main() {
void f() {
var test = 0;
print(test);
}
@ -329,7 +329,7 @@ main() {
Future<void> test_zeroLength_start() async {
addTestFile('''
main() {
void f() {
var test = 0;
print(test);
}

View file

@ -51,7 +51,7 @@ class MyClass {
/// MyClass constructor doc
MyClass(String name, {int length}) {}
}
main() {
void f() {
var a = new MyClass("Danny", /*^*/);
}
''');
@ -78,7 +78,7 @@ class MyClass {
return new MyClass._();
}
}
main() {
void f() {
var a = new MyClass("Danny", /*^*/);
}
''');
@ -101,7 +101,7 @@ class MyClass {
/// MyClass.foo constructor doc
MyClass.foo(String name, {int length}) {}
}
main() {
void f() {
var a = new MyClass.foo("Danny", /*^*/);
}
''');
@ -120,7 +120,7 @@ main() {
Future<void> test_does_not_walk_up_over_closure() async {
newFile(testFilePath, '''
one(String name, int length) {}
main() {
void f() {
one("Danny", () {
/*^*/
});
@ -169,7 +169,7 @@ a() {}
newFile(testFilePath, '''
/// f doc
int Function(String) f(String s) => (int i) => int.parse(s) + i;
main() {
void f() {
print(f('3'/*^*/)(2));
}
''');
@ -187,13 +187,13 @@ main() {
newFile('$testPackageLibPath/other.dart', '''
/// one doc
one(String name, int length) {}
main() {
void f() {
one("Danny", /*^*/);
}
''');
newFile(testFilePath, '''
import 'other.dart';
main() {
void f() {
one("Danny", /*^*/);
}
''');
@ -215,7 +215,7 @@ main() {
newFile(testFilePath, '''
/// one doc
one(String name, int length) {}
main() {
void f() {
one("Danny", (((1 * 2/*^*/))));
}
''');
@ -237,7 +237,7 @@ main() {
newFile(testFilePath, '''
/// one doc
one(String name, {int length}) {}
main() {
void f() {
one("Danny", /*^*/);
}
''');
@ -257,7 +257,7 @@ main() {
newFile(testFilePath, '''
/// one doc
one(String name, {int length = 1}) {}
main() {
void f() {
one("Danny", /*^*/);
}
''');
@ -279,7 +279,7 @@ main() {
newFile(testFilePath, '''
/// one doc
one(String name, {String email = "a@b.c"}) {}
main() {
void f() {
one("Danny", /*^*/);
}
''');
@ -304,7 +304,7 @@ main() {
one(String one) {}
/// two doc
String two(String two) { return ""; }
main() {
void f() {
one(two(/*^*/));
}
''');
@ -325,7 +325,7 @@ main() {
one(String one) {}
/// two doc
String two(String two) { return ""; }
main() {
void f() {
one(two(),/*^*/);
}
''');
@ -342,7 +342,7 @@ main() {
Future<void> test_function_no_dart_doc() async {
newFile(testFilePath, '''
one(String name, int length) {}
main() {
void f() {
one("Danny", /*^*/);
}
''');
@ -364,7 +364,7 @@ main() {
newFile(testFilePath, '''
/// one doc
one(String name, [int length]) {}
main() {
void f() {
one("Danny", /*^*/);
}
''');
@ -386,7 +386,7 @@ main() {
newFile(testFilePath, '''
/// one doc
one(String name, [int length = 11]) {}
main() {
void f() {
one("Danny", /*^*/);
}
''');
@ -408,7 +408,7 @@ main() {
newFile(testFilePath, '''
/// one doc
one(String name, int length) {}
main() {
void f() {
one("Danny", /*^*/);
}
''');
@ -430,7 +430,7 @@ main() {
newFile(testFilePath, '''
/// one doc
one() {}
main() {
void f() {
one(/*^*/);
}
''');
@ -471,7 +471,7 @@ class MyClass {
/// MyClass instance method
myMethod(String name, {int length}) {}
}
main() {
void f() {
var a = new MyClass("Danny");
a.myMethod("Danny", /*^*/);
}
@ -497,7 +497,7 @@ class MyClass {
/// MyClass static method
static void myStaticMethod(String name, {int length}) {}
}
main() {
void f() {
MyClass.myStaticMethod("Danny", /*^*/);
}
''');

View file

@ -26,7 +26,7 @@ class AnalysisOptionsFileNotificationTest extends PubPackageAnalysisServerTest {
Map<File, List<AnalysisError>> filesErrors = {};
final testSource = '''
main() {
void f() {
var x = '';
int y = x; // Not assignable in strong-mode
print(y);
@ -65,7 +65,7 @@ analyzer:
''');
addTestFile('''
main() {
void f() {
String unused = "";
}
''');
@ -90,7 +90,7 @@ analyzer:
''');
addTestFile('''
main() {
void f() {
String unused = "";
}
''');

View file

@ -347,7 +347,7 @@ linter:
var otherFile = newFile('/other.dart', 'UnknownType V;');
addTestFile('''
import '/other.dart';
main() {
void f() {
print(V);
}
''');

View file

@ -271,7 +271,7 @@ void f() {}
class A {
}
@A()
main() {
void f() {
}
''');
await prepareNavigation();
@ -291,7 +291,7 @@ class MyAnnotation {
import 'my_annotation.dart' as man;
@man.MyAnnotation()
@man.MyAnnotation.named()
main() {
void f() {
}
''');
await prepareNavigation();
@ -314,7 +314,7 @@ class A {
const A.named(p);
}
@A.named(0)
main() {
void f() {
}
''');
await prepareNavigation();
@ -334,7 +334,7 @@ class A {
const A();
}
@A()
main() {
void f() {
}
''');
await prepareNavigation();
@ -346,7 +346,7 @@ main() {
addTestFile('''
const myan = new Object();
@myan // ref
main() {
void f() {
}
''');
await prepareNavigation();
@ -362,7 +362,7 @@ const myan = new Object();
addTestFile('''
import 'mayn.dart' as man;
@man.myan // ref
main() {
void f() {
}
''');
await prepareNavigation();
@ -888,7 +888,7 @@ class A {
Future<void> test_identifier_resolved() async {
addTestFile('''
class AAA {}
main() {
void f() {
AAA aaa = null;
print(aaa);
}
@ -896,12 +896,12 @@ main() {
await prepareNavigation();
assertHasRegionTarget('AAA aaa', 'AAA {}');
assertHasRegionTarget('aaa);', 'aaa = null');
assertHasRegionTarget('main() {', 'main() {');
assertHasRegionTarget('f() {', 'f() {');
}
Future<void> test_identifier_unresolved() async {
addTestFile('''
main() {
void f() {
print(vvv);
}
''');
@ -911,7 +911,7 @@ main() {
Future<void> test_identifier_whenStrayImportDirective() async {
addTestFile('''
main() {
void f() {
int aaa = 42;
print(aaa);
}
@ -942,7 +942,7 @@ class SecondClass {
addTestFile('''
class A {
}
main() {
void f() {
new A();
}
''');
@ -955,7 +955,7 @@ main() {
addTestFile('''
class A {}
class B<T> {}
main() {
void f() {
new B<A>();
}
''');
@ -975,7 +975,7 @@ main() {
class A {
A.named() {}
}
main() {
void f() {
new A.named();
}
''');
@ -996,7 +996,7 @@ class A {}
class B<T> {
B.named() {}
}
main() {
void f() {
new B<A>.named();
}
''');
@ -1020,7 +1020,7 @@ main() {
class A {
A() {}
}
main() {
void f() {
new A();
}
''');
@ -1035,7 +1035,7 @@ class A {}
class B<T> {
B() {}
}
main() {
void f() {
new B<A>();
}
''');
@ -1053,7 +1053,7 @@ main() {
Future<void> test_instanceCreation_withImportPrefix_named() async {
addTestFile('''
import 'dart:async' as ppp;
main() {
void f() {
new ppp.Future.value(42);
}
''');
@ -1081,7 +1081,7 @@ library my.lib;
addTestFile('''
import 'libA.dart';
import 'libB.dart';
main() {
void f() {
TEST;
}
''');
@ -1111,7 +1111,7 @@ class A {
A operator *(other) => null;
A operator /(other) => null;
}
main() {
void f() {
var a = new A();
a - 1;
a + 2;
@ -1149,7 +1149,7 @@ class B {
A operator [](index) => null;
operator []=(index, A value) {}
}
main() {
void f() {
var b = new B();
b[0] // [];
b[1] = 1; // []=;
@ -1399,7 +1399,7 @@ class B extends A {
Future<void> test_targetElement() async {
addTestFile('''
class AAA {}
main() {
void f() {
AAA aaa = null;
}
''');
@ -1432,7 +1432,7 @@ void f(A a) {}
Future<void> test_type_dynamic() async {
addTestFile('''
main() {
void f() {
dynamic v = null;
}
''');
@ -1442,7 +1442,7 @@ main() {
Future<void> test_type_void() async {
addTestFile('''
void main() {
void f() {
}
''');
await prepareNavigation();

View file

@ -96,7 +96,7 @@ class AnalysisNotificationOccurrencesTest extends PubPackageAnalysisServerTest {
Future<void> test_afterAnalysis() async {
addTestFile('''
main() {
void f() {
var vvv = 42;
print(vvv);
}
@ -222,7 +222,7 @@ void f(E e) {
class A {
int fff;
A(this.fff); // constructor
main() {
void f() {
fff = 42;
print(fff); // print
}
@ -248,7 +248,7 @@ class A {
Future<void> test_localVariable() async {
addTestFile('''
main() {
void f() {
var vvv = 42;
vvv += 5;
print(vvv);
@ -268,7 +268,7 @@ main() {
class A<T> {
T fff;
}
main() {
void f() {
var a = new A<int>();
var b = new A<String>();
a.fff = 1;
@ -287,7 +287,7 @@ main() {
class A<T> {
T mmm() {}
}
main() {
void f() {
var a = new A<int>();
var b = new A<String>();
a.mmm(); // a
@ -350,7 +350,7 @@ class B extends A {
Future<void> test_topLevelVariable() async {
addTestFile('''
var VVV = 1;
main() {
void f() {
VVV = 2;
print(VVV);
}
@ -364,7 +364,7 @@ main() {
Future<void> test_type_class() async {
addTestFile('''
main() {
void f() {
int a = 1;
int b = 2;
int c = 3;
@ -383,7 +383,7 @@ int VVV = 4;
Future<void> test_type_dynamic() async {
addTestFile('''
main() {
void f() {
dynamic a = 1;
dynamic b = 2;
}
@ -396,11 +396,11 @@ dynamic V = 3;
Future<void> test_type_void() async {
addTestFile('''
void main() {
void f() {
}
''');
await prepareOccurrences();
var offset = findOffset('void main()');
var offset = findOffset('void f()');
findRegion(offset, 'void'.length, false);
}
}

View file

@ -97,14 +97,14 @@ void f(int _) {}
var foo = newFile('$workspaceRootPath/foo/lib/foo.dart', r'''
import 'package:aaa/aaa.dart';
void main() {
void g() {
f();
}
''');
var bar = newFile('$workspaceRootPath/bar/lib/bar.dart', r'''
import 'package:aaa/aaa.dart';
void main() {
void g() {
f();
}
''');
@ -206,7 +206,7 @@ void main() {
// add an overlay
await handleSuccessfulRequest(
AnalysisUpdateContentParams({
testFile.path: AddContentOverlay('main() {} main() {}'),
testFile.path: AddContentOverlay('void f() {} void f() {}'),
}).toRequest('0'),
);
await waitForTasksFinished();
@ -215,7 +215,7 @@ void main() {
await handleSuccessfulRequest(
AnalysisUpdateContentParams({
testFile.path: ChangeContentOverlay([
SourceEdit(0, 4, 'main'),
SourceEdit(5, 1, 'f'),
]),
}).toRequest('0'),
);
@ -233,7 +233,7 @@ void main() {
// add an overlay
await handleSuccessfulRequest(
AnalysisUpdateContentParams({
testFile.path: AddContentOverlay('main() {} main() {}'),
testFile.path: AddContentOverlay('void f() {} void f() {}'),
}).toRequest('0'),
);
await waitForTasksFinished();
@ -242,7 +242,7 @@ void main() {
await handleSuccessfulRequest(
AnalysisUpdateContentParams({
testFile.path: ChangeContentOverlay([
SourceEdit(0, 4, 'main'),
SourceEdit(5, 1, 'f'),
]),
}).toRequest('0'),
);

View file

@ -1525,7 +1525,7 @@ class A {}
//
addTestFile('''
import 'package:pkgA/libA.dart';
main() {
void f() {
new A();
}
''');
@ -1548,7 +1548,7 @@ class A {}
''');
newFile('$pkgA/lib/libB.dart', '''
import 'package:pkgA/libA.dart';
main() {
void f() {
new A();
}
''');

View file

@ -18,7 +18,7 @@ void main() {
class DiagnosticDomainTest extends PubPackageAnalysisServerTest {
Future<void> test_getDiagnostics() async {
newPubspecYamlFile(testPackageRootPath, 'name: project');
newFile('$testPackageLibPath/test.dart', 'main() {}');
newFile('$testPackageLibPath/test.dart', 'void f() {}');
await setRoots(included: [workspaceRootPath], excluded: []);
await server.onAnalysisComplete;

View file

@ -50,7 +50,7 @@ class AssistsTest extends PubPackageAnalysisServerTest {
var change = plugin.PrioritizedSourceChange(
5,
SourceChange(message, edits: <SourceFileEdit>[
SourceFileEdit('', 0, edits: <SourceEdit>[SourceEdit(0, 0, 'x')])
SourceFileEdit('', 5, edits: <SourceEdit>[SourceEdit(5, 0, 'x')])
]));
var result =
plugin.EditGetAssistsResult(<plugin.PrioritizedSourceChange>[change]);
@ -58,10 +58,10 @@ class AssistsTest extends PubPackageAnalysisServerTest {
info: Future.value(result.toResponse('-', 1))
};
addTestFile('main() {}');
addTestFile('void f() {}');
await waitForTasksFinished();
await prepareAssists('in(');
_assertHasChange(message, 'xmain() {}');
await prepareAssists('f(');
_assertHasChange(message, 'void xf() {}');
}
Future<void> test_invalidFilePathFormat_notAbsolute() async {
@ -88,14 +88,14 @@ class AssistsTest extends PubPackageAnalysisServerTest {
Future<void> test_removeTypeAnnotation() async {
addTestFile('''
main() {
void f() {
int v = 1;
}
''');
await waitForTasksFinished();
await prepareAssists('v =');
_assertHasChange('Remove type annotation', '''
main() {
void f() {
var v = 1;
}
''');
@ -103,14 +103,14 @@ main() {
Future<void> test_splitVariableDeclaration() async {
addTestFile('''
main() {
void f() {
int v = 1;
}
''');
await waitForTasksFinished();
await prepareAssists('v =');
_assertHasChange('Split variable declaration', '''
main() {
void f() {
int v;
v = 1;
}
@ -119,7 +119,7 @@ main() {
Future<void> test_surroundWithIf() async {
addTestFile('''
main() {
void f() {
print(1);
print(2);
}
@ -129,7 +129,7 @@ main() {
var length = findOffset('}') - offset;
await prepareAssistsAt(offset, length);
_assertHasChange("Surround with 'if'", '''
main() {
void f() {
if (condition) {
print(1);
print(2);

View file

@ -50,7 +50,7 @@ class FixesTest extends PubPackageAnalysisServerTest {
Future<void> test_fixUndefinedClass() async {
addTestFile('''
main() {
void f() {
Completer<String> x = null;
print(x);
}
@ -79,9 +79,9 @@ main() {
info: Future.value(result.toResponse('-', 1))
};
addTestFile('main() {}');
addTestFile('void f() {}');
await waitForTasksFinished();
var errorFixes = await _getFixesAt(testFile, 'in(');
var errorFixes = await _getFixesAt(testFile, 'f(');
expect(errorFixes, hasLength(1));
}
@ -133,7 +133,7 @@ bar() {
Future<void> test_overlayOnlyFile() async {
await _addOverlay(testFile.path, '''
main() {
void f() {
print(1)
}
''');
@ -174,7 +174,7 @@ dependencies:
// Configure the test file.
final file =
newFile('$workspaceRootPath/aaa/main.dart', 'main() { new Foo(); }');
newFile('$workspaceRootPath/aaa/main.dart', 'void f() { new Foo(); }');
await waitForTasksFinished();

View file

@ -43,7 +43,7 @@ fun(firstParam, secondParam, thirdParam, fourthParam) {
Future<void> test_format_noOp() async {
// Already formatted source
addTestFile('''
main() {
void f() {
int x = 3;
}
''');
@ -55,7 +55,7 @@ main() {
Future<void> test_format_noSelection() async {
addTestFile('''
main() { int x = 3; }
void f() { int x = 3; }
''');
await waitForTasksFinished();
var formatResult = await _formatAt(0, 0);
@ -65,7 +65,7 @@ main() { int x = 3; }
var edit = formatResult.edits[0];
expect(edit.replacement, equals('''
main() {
void f() {
int x = 3;
}
'''));
@ -75,7 +75,7 @@ main() {
Future<void> test_format_simple() async {
addTestFile('''
main() { int x = 3; }
void f() { int x = 3; }
''');
await waitForTasksFinished();
var formatResult = await _formatAt(0, 3);
@ -85,7 +85,7 @@ main() { int x = 3; }
var edit = formatResult.edits[0];
expect(edit.replacement, equals('''
main() {
void f() {
int x = 3;
}
'''));
@ -95,7 +95,7 @@ main() {
Future<void> test_format_withErrors() async {
addTestFile('''
main() { int x =
void f() { int x =
''');
await waitForTasksFinished();
var request = EditFormatParams(testFile.path, 0, 3).toRequest('0');

View file

@ -43,7 +43,7 @@ class OrganizeDirectivesTest extends PubPackageAnalysisServerTest {
addTestFile('''
import 'dart:async'
main() {}
void f() {}
''');
var request = EditOrganizeDirectivesParams(testFile.path).toRequest('0');
var response = await handleRequest(request);
@ -111,7 +111,7 @@ library lib;
import 'dart:async' as async;
import 'dart:async' as async;
main() {
void f() {
async.Future f;
}
''');
@ -120,7 +120,7 @@ library lib;
import 'dart:async' as async;
main() {
void f() {
async.Future f;
}
''');
@ -135,7 +135,7 @@ import 'dart:math';
import 'dart:convert';
import 'dart:collection';
main() {
void f() {
print(pi);
new HashMap();
}
@ -146,7 +146,7 @@ library lib;
import 'dart:collection';
import 'dart:math';
main() {
void f() {
print(pi);
new HashMap();
}

View file

@ -28,14 +28,14 @@ class PostfixCompletionTest extends PubPackageAnalysisServerTest {
Future<void> test_for() async {
addTestFile('''
main() {
void f() {
[].for
}
''');
await waitForTasksFinished();
await _prepareCompletion('.for');
_assertHasChange('Expand .for', '''
main() {
void f() {
for (var value in []) {
/*caret*/
}

View file

@ -40,7 +40,7 @@ class SortMembersTest extends PubPackageAnalysisServerTest {
Future<void> test_BAD_hasParseError() async {
addTestFile('''
main() {
void f() {
print()
}
''');
@ -136,7 +136,7 @@ import 'aaa/aaa.dart';
part 'bbb/bbb.dart';
part 'aaa/aaa.dart';
main() {
void f() {
}
''');
return _assertSorted(r'''
@ -163,7 +163,7 @@ export 'bbb/bbb.dart';
part 'aaa/aaa.dart';
part 'bbb/bbb.dart';
main() {
void f() {
}
''');
}

View file

@ -50,14 +50,14 @@ class StatementCompletionTest extends PubPackageAnalysisServerTest {
Future<void> test_plainEnterFromStart() async {
addTestFile('''
main() {
void f() {
int v = 1;
}
''');
await waitForTasksFinished();
await _prepareCompletion('v = 1;', atStart: true);
_assertHasChange('Insert a newline at the end of the current line', '''
main() {
void f() {
int v = 1;
/*caret*/
}
@ -66,14 +66,14 @@ main() {
Future<void> test_plainOleEnter() async {
addTestFile('''
main() {
void f() {
int v = 1;
}
''');
await waitForTasksFinished();
await _prepareCompletion('v = 1;', atEnd: true);
_assertHasChange('Insert a newline at the end of the current line', '''
main() {
void f() {
int v = 1;
/*caret*/
}
@ -82,7 +82,7 @@ main() {
Future<void> test_plainOleEnterWithError() async {
addTestFile('''
main() {
void f() {
int v =
}
''');
@ -92,7 +92,7 @@ main() {
_assertHasChange(
'Insert a newline at the end of the current line',
'''
main() {
void f() {
int v =
x
}

View file

@ -22,7 +22,7 @@ class AnalysisErrorIntegrationTest
var packagePath = sourcePath('package');
var filePath = sourcePath('package/lib/test.dart');
var content = '''
main() {
void f() {
print(null) // parse error: missing ';'
}''';
await sendServerSetSubscriptions([ServerService.STATUS]);
@ -39,7 +39,7 @@ main() {
Future<void> test_detect_simple_error() {
var pathname = sourcePath('test.dart');
writeFile(pathname, '''
main() {
void f() {
print(null) // parse error: missing ';'
}''');
standardAnalysisSetup();

View file

@ -18,7 +18,7 @@ class GetErrorsTest extends AbstractAnalysisServerIntegrationTest {
Future<void> test_getErrors() async {
var pathname = sourcePath('test.dart');
var text = r'''
main() {
void f() {
var x // parse error: missing ';'
}''';
writeFile(pathname, text);

View file

@ -36,7 +36,7 @@ void func(int param) {
topLevelVar.add(localVar);
}
main() {
void f() {
// comment
func(35);
}

View file

@ -41,7 +41,7 @@ function(FunctionTypeAlias parameter) {
int topLevelVariable = 0;
main() {
void f() {
Class<int> localVariable = new Class<int>.constructor(); // usage
function(() => localVariable.field);
localVariable.method();

View file

@ -19,7 +19,7 @@ class OccurrencesTest extends AbstractAnalysisServerIntegrationTest {
Future<void> test_occurrences() async {
var pathname = sourcePath('test.dart');
var text = r'''
main() {
void f() {
int sum = 0;
for (int i = 0; i < 10; i++) {
for (int j = 0; j < i; j++) {

View file

@ -29,7 +29,7 @@ library main;
import 'package:foo/bar.dart'
main() {
void f() {
f();
}
""";

View file

@ -28,7 +28,7 @@ import 'dart:io';
import 'dart:convert';
import 'dart:async';
main() {}''';
void f() {}''';
writeFile(pathname, text);
standardAnalysisSetup();
return analysisFinished.then((_) {

View file

@ -18,7 +18,7 @@ void main() {
class ReanalyzeTest extends AbstractAnalysisServerIntegrationTest {
Future<void> test_reanalyze() {
var pathname = sourcePath('test.dart');
var text = 'main() {}';
var text = 'void f() {}';
writeFile(pathname, text);
standardAnalysisSetup();
return analysisFinished.then((_) {

View file

@ -19,7 +19,7 @@ class UpdateContentTest extends AbstractAnalysisServerIntegrationTest {
Future<void> test_updateContent_list() {
var pathname = sourcePath('test.dart');
var goodText = r'''
main() {
void f() {
print("Hello");
print("World!");
}''';

View file

@ -19,7 +19,7 @@ class UpdateContentTest extends AbstractAnalysisServerIntegrationTest {
Future<void> test_updateContent() async {
var path = sourcePath('test.dart');
var goodText = r'''
main() {
void f() {
print("Hello, world!");
}''';
@ -67,7 +67,7 @@ class Person {
String get name => this._name;
String toString() => "Name: ${name}";
}
void main() {
void f() {
var p = new Person("Skeletor");
p.xname = "Faker";
print(p);
@ -88,7 +88,7 @@ class Person {
String get name => this._name;
String toString() => "Name: ${name}";
}
void main() {
void f() {
var p = new Person("Skeletor");
p.name = "Faker";
print(p);

View file

@ -42,7 +42,7 @@ class GetSuggestionsTest extends AbstractAnalysisServerIntegrationTest {
Future<void> test_getSuggestions() async {
setTestSource('test.dart', r'''
String test = '';
main() {
void f() {
test.^
}
''');
@ -63,7 +63,7 @@ main() {
Future<void> test_getSuggestions_onlyOverlay() async {
setTestSource('test.dart', r'''
String test = '';
main() {
void f() {
test.^
}
''');
@ -86,7 +86,7 @@ main() {
Future<void> test_getSuggestions_onlyOverlay_noWait() async {
setTestSource('test.dart', r'''
String test = '';
main() {
void f() {
test.^
}
''');

View file

@ -78,7 +78,7 @@ class AnalysisGetImportElementsIntegrationTest
}
Future<void> test_importElements_definingUnit() async {
writeFile(pathname, 'main() {}');
writeFile(pathname, 'void f() {}');
standardAnalysisSetup();
await analysisFinished;
var provider = PhysicalResourceProvider.INSTANCE;
@ -105,7 +105,7 @@ class AnalysisGetImportElementsIntegrationTest
var libName = sourcePath('lib.dart');
writeFile(libName, '''
part 'test.dart';
main() {}
void f() {}
''');
writeFile(pathname, '''
part of 'lib.dart';

View file

@ -60,7 +60,7 @@ void f() {
}
Future<void> test_lints() async {
newFile(mainFilePath, '''main() async => await 1;''');
newFile(mainFilePath, '''void f() async => await 1;''');
newFile(analysisOptionsPath, '''
linter:
rules:
@ -74,8 +74,8 @@ linter:
final diagnostic = diagnostics.first;
expect(diagnostic.code, equals('await_only_futures'));
expect(diagnostic.range.start.line, equals(0));
expect(diagnostic.range.start.character, equals(16));
expect(diagnostic.range.start.character, equals(18));
expect(diagnostic.range.end.line, equals(0));
expect(diagnostic.range.end.character, equals(21));
expect(diagnostic.range.end.character, equals(23));
}
}

View file

@ -20,7 +20,7 @@ class FindElementReferencesTest extends AbstractAnalysisServerIntegrationTest {
Future<void> test_badTarget() async {
var text = r'''
main() {
void f() {
if /* target */ (true) {
print('Hello');
}
@ -38,7 +38,7 @@ main() {
Future<void> test_findReferences() async {
var text = r'''
main() {
void f() {
foo /* target */ ('Hello');
}
@ -56,7 +56,7 @@ foo(String str) {}
expect(result.location.file, pathname);
expect(result.isPotential, isFalse);
expect(result.kind.name, SearchResultKind.INVOCATION.name);
expect(result.path.first.name, 'main');
expect(result.path.first.name, 'f');
}
Future<List<SearchResult>?> _findElementReferences(String text) async {

View file

@ -22,7 +22,7 @@ class GetTypeHierarchyTest extends AbstractAnalysisServerIntegrationTest {
Future getTypeHierarchy_badTarget() async {
var text = r'''
main() {
void f() {
if /* target */ (true) {
print('Hello');
}

View file

@ -121,7 +121,7 @@ class BazelChangesTest extends AbstractAnalysisServerIntegrationTest {
writeFile(testFile, r'''
import 'generated.dart';
void main() { my_fun(); }
void f() { my_fun(); }
''');
standardAnalysisSetup();

View file

@ -54,7 +54,7 @@ class OptionsPackagesIntegrationTest
var pathname = sourcePath('test.dart');
writeFile(pathname, '''
import 'package:foo/foo.dart';
void main() {
void f() {
my_foo;
}
''');

View file

@ -50,7 +50,7 @@ class SetSubscriptionsTest extends AbstractAnalysisServerIntegrationTest {
var pathname = sourcePath('test.dart');
writeFile(pathname, '''
main() {
void f() {
var x;
}''');
standardAnalysisSetup(subscribeStatus: false);
@ -63,7 +63,7 @@ main() {
// Tickle test.dart just in case analysis has already completed.
writeFile(pathname, '''
main() {
void f() {
var y;
}''');
// Analysis should eventually complete, and we should be notified

View file

@ -37,7 +37,7 @@ class StatusTest extends AbstractAnalysisServerIntegrationTest {
}
});
writeFile(sourcePath('test.dart'), '''
main() {
void f() {
var x;
}''');
standardAnalysisSetup();

View file

@ -19,7 +19,7 @@ void main() {
class CancelRequestTest extends AbstractLspAnalysisServerTest {
Future<void> test_cancel() async {
final content = '''
main() {
void f() {
InOtherF^
}
''';

View file

@ -16,7 +16,7 @@ void main() {
@reflectiveTest
class ClosingLabelsTest extends AbstractLspAnalysisServerTest {
Future<void> test_afterChange() async {
final initialContent = 'main() {}';
final initialContent = 'void f() {}';
final updatedContent = '''
Widget build(BuildContext context) {
return new Row( // Row 1:9

View file

@ -324,11 +324,11 @@ Future foo;''';
//
// Expect only the only one nearest to the start of the range to be returned.
const content = '''
main() {
var a = [];
print(a!!);^
}
''';
void f() {
var a = [];
print(a!!);^
}
''';
newFile(mainFilePath, withoutMarkers(content));
await initialize(
@ -621,7 +621,7 @@ class A {
Future<void>
test_snippets_extractVariable_functionTypeNestedParameters() async {
const content = '''
main() {
void f() {
useFunction(te^st);
}
@ -629,7 +629,7 @@ useFunction(int g(a, b)) {}
''';
const expectedContent = r'''
main() {
void f() {
${1:int Function(dynamic a, dynamic b)} ${2:test};
useFunction(test);
}

View file

@ -35,14 +35,14 @@ class ConvertGetterToMethodCodeActionsTest extends AbstractCodeActionsTest {
Future<void> test_refactor() async {
const content = '''
int get ^test => 42;
main() {
void f() {
var a = test;
var b = test;
}
''';
const expectedContent = '''
int test() => 42;
main() {
void f() {
var a = test();
var b = test();
}
@ -67,14 +67,14 @@ class ConvertMethodToGetterCodeActionsTest extends AbstractCodeActionsTest {
Future<void> test_refactor() async {
const content = '''
int ^test() => 42;
main() {
void f() {
var a = test();
var b = test();
}
''';
const expectedContent = '''
int get test => 42;
main() {
void f() {
var a = test;
var b = test;
}
@ -132,13 +132,13 @@ class ExtractMethodRefactorCodeActionsTest extends AbstractCodeActionsTest {
Future<void> test_appliesCorrectEdits() async {
const content = '''
main() {
void f() {
print('Test!');
[[print('Test!');]]
}
''';
const expectedContent = '''
main() {
void f() {
print('Test!');
newMethod();
}
@ -161,13 +161,13 @@ void newMethod() {
Future<void> test_cancelsInProgress() async {
const content = '''
main() {
void f() {
print('Test!');
[[print('Test!');]]
}
''';
const expectedContent = '''
main() {
void f() {
print('Test!');
newMethod();
}
@ -215,7 +215,7 @@ void newMethod() {
Future<void> test_contentModified() async {
const content = '''
main() {
void f() {
print('Test!');
[[print('Test!');]]
}
@ -239,7 +239,7 @@ main() {
Future<void> test_filtersCorrectly() async {
const content = '''
main() {
void f() {
print('Test!');
[[print('Test!');]]
}
@ -287,7 +287,7 @@ main() {
Future<void> test_generatesNames() async {
const content = '''
Object main() {
Object F() {
return Container([[Text('Test!')]]);
}
@ -295,7 +295,7 @@ Object Container(Object text) => null;
Object Text(Object text) => null;
''';
const expectedContent = '''
Object main() {
Object F() {
return Container(text());
}
@ -320,7 +320,7 @@ Object Text(Object text) => null;
const content = '''
import 'dart:convert';
^
main() {}
void f() {}
''';
newFile(mainFilePath, content);
await initialize();
@ -333,13 +333,13 @@ main() {}
Future<void> test_progress_clientProvided() async {
const content = '''
main() {
void f() {
print('Test!');
[[print('Test!');]]
}
''';
const expectedContent = '''
main() {
void f() {
print('Test!');
newMethod();
}
@ -369,13 +369,13 @@ void newMethod() {
Future<void> test_progress_notSupported() async {
const content = '''
main() {
void f() {
print('Test!');
[[print('Test!');]]
}
''';
const expectedContent = '''
main() {
void f() {
print('Test!');
newMethod();
}
@ -405,13 +405,13 @@ void newMethod() {
Future<void> test_progress_serverGenerated() async {
const content = '''
main() {
void f() {
print('Test!');
[[print('Test!');]]
}
''';
const expectedContent = '''
main() {
void f() {
print('Test!');
newMethod();
}
@ -520,14 +520,14 @@ class ExtractVariableRefactorCodeActionsTest extends AbstractCodeActionsTest {
Future<void> test_appliesCorrectEdits() async {
const content = '''
main() {
void f() {
foo([[1 + 2]]);
}
void foo(int arg) {}
''';
const expectedContent = '''
main() {
void f() {
var arg = 1 + 2;
foo(arg);
}
@ -548,7 +548,7 @@ void foo(int arg) {}
Future<void> test_doesNotCreateNameConflicts() async {
const content = '''
main() {
void f() {
var arg = "test";
foo([[1 + 2]]);
}
@ -556,7 +556,7 @@ main() {
void foo(int arg) {}
''';
const expectedContent = '''
main() {
void f() {
var arg = "test";
var arg2 = 1 + 2;
foo(arg2);
@ -663,7 +663,7 @@ class NewWidget extends StatelessWidget {
const content = '''
import 'dart:convert';
^
main() {}
void f() {}
''';
newFile(mainFilePath, content);
await initialize();
@ -692,7 +692,7 @@ class InlineLocalVariableRefactorCodeActionsTest
Future<void> test_appliesCorrectEdits() async {
const content = '''
void main() {
void f() {
var a^ = 1;
print(a);
print(a);
@ -700,7 +700,7 @@ void main() {
}
''';
const expectedContent = '''
void main() {
void f() {
print(1);
print(1);
print(1);

View file

@ -22,7 +22,7 @@ class DefinitionTest extends AbstractLspAnalysisServerTest {
final mainContents = '''
import 'referenced.dart';
main() {
void f() {
fo^o();
}
''';
@ -64,7 +64,7 @@ class DefinitionTest extends AbstractLspAnalysisServerTest {
/// Te^st
///
/// References [String].
main() {}
void f() {}
''';
await initialize();
@ -144,7 +144,7 @@ class A {
final mainContents = '''
import 'referenced.dart';
main() {
void f() {
Icons.[[ad^d]]();
}
''';
@ -187,7 +187,7 @@ class A {
final mainContents = '''
import 'referenced.dart';
main() {
void f() {
[[fo^o]]();
}
''';
@ -238,7 +238,7 @@ class A {
final mainContents = '''
import 'lib.dart';
main() {
void f() {
Icons.[[ad^d]]();
}
''';

View file

@ -177,7 +177,7 @@ void f() {
@deprecated
int? dep;
void main() => print(dep);
void f() => print(dep);
''');
final diagnosticsUpdate = waitForDiagnostics(mainFileUri);
@ -196,7 +196,7 @@ void f() {
@deprecated
int? dep;
void main() => print(dep);
void f() => print(dep);
''');
final diagnosticsUpdate = waitForDiagnostics(mainFileUri);
@ -210,7 +210,7 @@ void f() {
Future<void> test_diagnosticTag_unnecessary() async {
newFile(mainFilePath, '''
void main() {
void f() {
return;
print('unreachable');
}

View file

@ -41,7 +41,7 @@ class DocumentHighlightsTest extends AbstractLspAnalysisServerTest {
}
Future<void> test_localVariable() => _testMarkedContent('''
main() {
void f() {
var [[f^oo]] = 1;
print([[foo]]);
[[foo]] = 2;
@ -60,19 +60,19 @@ class DocumentHighlightsTest extends AbstractLspAnalysisServerTest {
}
Future<void> test_noResult() => _testMarkedContent('''
main() {
void f() {
// This one is in a ^ comment!
}
''');
Future<void> test_onlySelf() => _testMarkedContent('''
main() {
void f() {
[[prin^t]]();
}
''');
Future<void> test_shadow_inner() => _testMarkedContent('''
main() {
void f() {
var foo = 1;
func() {
var [[fo^o]] = 2;
@ -82,7 +82,7 @@ class DocumentHighlightsTest extends AbstractLspAnalysisServerTest {
''');
Future<void> test_shadow_outer() => _testMarkedContent('''
main() {
void f() {
var [[foo]] = 1;
func() {
var foo = 2;
@ -94,7 +94,7 @@ class DocumentHighlightsTest extends AbstractLspAnalysisServerTest {
Future<void> test_topLevelVariable() => _testMarkedContent('''
String [[foo]] = 'bar';
main() {
void f() {
print([[foo]]);
[[fo^o]] = 2;
}

View file

@ -199,7 +199,7 @@ class FoldingTest extends AbstractLspAnalysisServerTest {
/// This is not the file header[[
/// It's just a comment]]
main() {}
void f() {}
''';
final ranges = rangesFromMarkers(content);

View file

@ -212,7 +212,7 @@ void f()
Future<void> test_formatRange_expandsLeadingWhitespaceToNearestLine() async {
const contents = '''
void main()
void f()
{
[[ print('test'); // line 2
@ -221,7 +221,7 @@ void main()
}
''';
const expected = '''
void main()
void f()
{
print('test'); // line 2
@ -355,12 +355,12 @@ int b;
Future<void> test_lineLength_outsideWorkspaceFolders() async {
const contents = '''
main() {
void f() {
print('123456789 ''123456789 ''123456789 ');
}
''';
const expectedContents = '''
main() {
void f() {
print(
'123456789 '
'123456789 '
@ -385,12 +385,12 @@ main() {
Future<void> test_lineLength_workspaceFolderSpecified() async {
const contents = '''
main() {
void f() {
print('123456789 ''123456789 ''123456789 ');
}
''';
const expectedContents = '''
main() {
void f() {
print(
'123456789 '
'123456789 '
@ -415,12 +415,12 @@ main() {
Future<void> test_lineLength_workspaceFolderUnspecified() async {
const contents = '''
main() {
void f() {
print('123456789 ''123456789 ''123456789 ');
}
''';
const expectedContents = '''
main() {
void f() {
print(
'123456789 '
'123456789 '

View file

@ -229,7 +229,7 @@ Type: `String`
Foo(String arg1, String arg2, [String arg3]);
}
main() {
void f() {
var a = Fo^o();
}
''';
@ -254,7 +254,7 @@ Type: `String`
Foo(String a, String b);
}
main() {
void f() {
var a = Fo^o();
}
''';

View file

@ -20,7 +20,7 @@ class ReferencesTest extends AbstractLspAnalysisServerTest {
final mainContents = '''
import 'referenced.dart';
main() {
void f() {
[[foo]]();
}
''';
@ -68,7 +68,7 @@ class ReferencesTest extends AbstractLspAnalysisServerTest {
final mainContents = '''
import 'referenced.dart';
main() {
void f() {
[[foo]]();
}
''';

View file

@ -62,7 +62,7 @@ class RenameTest extends AbstractLspAnalysisServerTest {
Future<void> test_prepare_invalidRenameLocation() async {
const content = '''
main() {
void f() {
// comm^ent
}
''';
@ -96,7 +96,7 @@ class RenameTest extends AbstractLspAnalysisServerTest {
Future<void> test_prepare_variable() async {
const content = '''
main() {
void f() {
var variable = 0;
print([[vari^able]]);
}
@ -401,7 +401,7 @@ class RenameTest extends AbstractLspAnalysisServerTest {
Future<void> test_rename_invalidRenameLocation() {
const content = '''
main() {
void f() {
// comm^ent
}
''';
@ -591,13 +591,13 @@ class RenameTest extends AbstractLspAnalysisServerTest {
Future<void> test_rename_variable() {
const content = '''
main() {
void f() {
var variable = 0;
print([[vari^able]]);
}
''';
const expectedContent = '''
main() {
void f() {
var foo = 0;
print(foo);
}

View file

@ -268,7 +268,7 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
static String myStaticField = 'StaticFieldVal';
}
main() {
void f() {
final a = MyClass();
print(a.myField);
MyClass.myStaticField = 'a';
@ -293,7 +293,9 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
_Token('myStaticField', SemanticTokenTypes.property,
[SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
_Token("'StaticFieldVal'", SemanticTokenTypes.string),
_Token('main', SemanticTokenTypes.function,
_Token(
'void', SemanticTokenTypes.keyword, [SemanticTokenModifiers('void')]),
_Token('f', SemanticTokenTypes.function,
[SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
_Token('final', SemanticTokenTypes.keyword),
_Token('a', SemanticTokenTypes.variable,
@ -331,7 +333,7 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
static set myStaticSetter(String staticV) {};
}
main() {
void f() {
final a = MyClass();
print(a.myGetter);
a.mySetter = 'a';
@ -377,7 +379,9 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
_Token('String', SemanticTokenTypes.class_),
_Token('staticV', SemanticTokenTypes.parameter,
[SemanticTokenModifiers.declaration]),
_Token('main', SemanticTokenTypes.function,
_Token(
'void', SemanticTokenTypes.keyword, [SemanticTokenModifiers('void')]),
_Token('f', SemanticTokenTypes.function,
[SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
_Token('final', SemanticTokenTypes.keyword),
_Token('a', SemanticTokenTypes.variable,
@ -414,7 +418,7 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
}
}
main() {
void f() {
final a = MyClass();
a.myMethod();
MyClass.myStaticMethod();
@ -445,7 +449,9 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
_Token('myStaticMethod', SemanticTokenTypes.method,
[SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
_Token('// static method comment', SemanticTokenTypes.comment),
_Token('main', SemanticTokenTypes.function,
_Token(
'void', SemanticTokenTypes.keyword, [SemanticTokenModifiers('void')]),
_Token('f', SemanticTokenTypes.function,
[SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
_Token('final', SemanticTokenTypes.keyword),
_Token('a', SemanticTokenTypes.variable,
@ -670,7 +676,7 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
// "control" keywords should be tagged with a modifier so the client
// can color them differently to other keywords.
final content = r'''
void main() async {
void f() async {
var a = new Object();
await null;
if (false) {
@ -683,7 +689,7 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
final expected = [
_Token('void', SemanticTokenTypes.keyword,
[CustomSemanticTokenModifiers.void_]),
_Token('main', SemanticTokenTypes.function,
_Token('f', SemanticTokenTypes.function,
[SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
_Token('async', SemanticTokenTypes.keyword,
[CustomSemanticTokenModifiers.control]),
@ -774,14 +780,16 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
Future<void> test_local() async {
final content = '''
main() {
void f() {
func(String a) => print(a);
final funcTearOff = func;
}
''';
final expected = [
_Token('main', SemanticTokenTypes.function,
_Token(
'void', SemanticTokenTypes.keyword, [SemanticTokenModifiers('void')]),
_Token('f', SemanticTokenTypes.function,
[SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
_Token('func', SemanticTokenTypes.function,
[SemanticTokenModifiers.declaration]),
@ -1187,7 +1195,7 @@ const string3 = 'unicode \u1234\u123499\u{123456}\u{12345699}';
final funcTearOff = func;
void main() {
void f() {
strings;
func;
abc;
@ -1228,7 +1236,7 @@ const string3 = 'unicode \u1234\u123499\u{123456}\u{12345699}';
_Token('func', SemanticTokenTypes.function),
_Token('void', SemanticTokenTypes.keyword,
[CustomSemanticTokenModifiers.void_]),
_Token('main', SemanticTokenTypes.function,
_Token('f', SemanticTokenTypes.function,
[SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
_Token('strings', SemanticTokenTypes.property),
_Token('func', SemanticTokenTypes.function),
@ -1250,7 +1258,7 @@ const string3 = 'unicode \u1234\u123499\u{123456}\u{12345699}';
// clients other grammars would show through, losing the benefit from having
// resolved the code).
final content = '''
main() {
void f() {
int a;
a.foo().bar.baz();
@ -1260,7 +1268,9 @@ const string3 = 'unicode \u1234\u123499\u{123456}\u{12345699}';
''';
final expected = [
_Token('main', SemanticTokenTypes.function,
_Token(
'void', SemanticTokenTypes.keyword, [SemanticTokenModifiers('void')]),
_Token('f', SemanticTokenTypes.function,
[SemanticTokenModifiers.declaration, SemanticTokenModifiers.static]),
_Token('int', SemanticTokenTypes.class_),
_Token('a', SemanticTokenTypes.variable,

View file

@ -419,7 +419,7 @@ class A {
Future<void> test_LABEL() async {
await resolveTestCode('''
main() {
void f() {
myLabel:
while (true) {
break myLabel;
@ -433,7 +433,7 @@ myLabel:
{
var location = element.location!;
expect(location.file, testFile);
expect(location.offset, 9);
expect(location.offset, 11);
expect(location.length, 'myLabel'.length);
expect(location.startLine, 2);
expect(location.startColumn, 1);

View file

@ -227,7 +227,7 @@ enum B {
Future<void> test_localVariable() async {
addTestFile('''
class A {
main() {
void f() {
var foo = 42;
}
}
@ -239,7 +239,7 @@ class A {
Future<void> test_localVariable_forIn() async {
addTestFile('''
class A {
main() {
void f() {
for (int foo in []) {
}
}

View file

@ -28,16 +28,16 @@ class GetTypeHierarchyTest extends PubPackageAnalysisServerTest {
Future<void> test_bad_function() async {
addTestFile('''
main() {
void f() {
}
''');
var items = await _getTypeHierarchyOrNull('main() {');
var items = await _getTypeHierarchyOrNull('f() {');
expect(items, isNull);
}
Future<void> test_bad_noElement() async {
addTestFile('''
main() {
void f() {
/* target */
}
''');