Version 2.11.0-270.0.dev
Merge commit '56947222ccac62022c8b5b3945d678dc4ef44188' into 'dev'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5e40af4..2611829 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,8 +4,14 @@
#### `dart:io`
-* `HttpRequest` will now correctly follow HTTP 308 redirects
- (`HttpStatus.permanentRedirect`).
+* `HttpRequest` will now correctly follow HTTP 308 redirects
+ (`HttpStatus.permanentRedirect`).
+
+#### `dart:isolate`
+
+* Added `debugName` positional parameter to `ReceivePort` and `RawReceivePort`
+ constructors, a name which can be associated with the port and displayed in
+ tooling.
### Dart VM
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart
index 773eab0..649597a 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart
@@ -142,17 +142,16 @@
return tokens.length;
}
var argumentIndex = int.parse(token.lexeme);
- var reference = PositionalParameterReference(argumentIndex);
token = _expect(index + 3, [_TokenKind.closeSquareBracket]);
if (token == null) {
// The error has already been reported.
return tokens.length;
}
- accessors.add(ArgumentAccessor(reference));
+ accessors.add(TypeArgumentAccessor(argumentIndex));
return index + 4;
} else {
errorReporter.reportErrorForOffset(TransformSetErrorCode.unknownAccessor,
- token.offset, token.length, [identifier]);
+ token.offset + delta, token.length, [identifier]);
return tokens.length;
}
}
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart
index bad163e..a525413 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart
@@ -196,9 +196,9 @@
/// Return the offset of the first character in the [string], exclusive of any
/// surrounding quotes.
int _offsetOfString(YamlScalar string) {
- // TODO(brianwilkerson) We add 1 to account for the quotes around the
- // string, but quotes aren't required, so we need to use the style of the
- // [string] is to get the right offset.
+ if (string.style == ScalarStyle.PLAIN) {
+ return string.span.start.offset;
+ }
return string.span.start.offset + 1;
}
@@ -333,8 +333,8 @@
/// resulting change, or `null` if the [node] does not represent a valid
/// add-type-parameter change.
AddTypeParameter _translateAddTypeParameterChange(YamlMap node) {
- _reportUnsupportedKeys(
- node, const {_indexKey, _kindKey, _nameKey, _argumentValueKey});
+ _reportUnsupportedKeys(node,
+ const {_extendsKey, _indexKey, _kindKey, _nameKey, _argumentValueKey});
var index = _translateInteger(node.valueAt(_indexKey),
ErrorContext(key: _indexKey, parentNode: node));
var name = _translateString(
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index 235e17f..8d42a9b7 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -170,6 +170,7 @@
}
Future<ResolvedUnitResult> resolveFile(String path) async {
+ path = convertPath(path);
return contextFor(path).currentSession.getResolvedUnit(path);
}
diff --git a/pkg/analysis_server/test/abstract_single_unit.dart b/pkg/analysis_server/test/abstract_single_unit.dart
index 7b1c442..b0ff7f7 100644
--- a/pkg/analysis_server/test/abstract_single_unit.dart
+++ b/pkg/analysis_server/test/abstract_single_unit.dart
@@ -130,12 +130,12 @@
return super.newFile(path, content: content);
}
- Future<void> resolveTestUnit(String code) async {
+ Future<void> resolveTestCode(String code) async {
addTestSource(code);
- await resolveTestUnit2();
+ await resolveTestFile();
}
- Future<void> resolveTestUnit2() async {
+ Future<void> resolveTestFile() async {
testAnalysisResult = await session.getResolvedUnit(testFile);
testUnit = testAnalysisResult.unit;
if (verifyNoTestUnitErrors) {
diff --git a/pkg/analysis_server/test/plugin/protocol_dart_test.dart b/pkg/analysis_server/test/plugin/protocol_dart_test.dart
index f00057a..2fdf1c5 100644
--- a/pkg/analysis_server/test/plugin/protocol_dart_test.dart
+++ b/pkg/analysis_server/test/plugin/protocol_dart_test.dart
@@ -105,7 +105,7 @@
}
Future<void> test_fromElement_CLASS() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
@deprecated
abstract class _A {}
class B<K, V> {}''');
@@ -143,7 +143,7 @@
}
Future<void> test_fromElement_CONSTRUCTOR() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
const A.myConstructor(int a, [String b]);
}''');
@@ -169,7 +169,7 @@
Future<void> test_fromElement_CONSTRUCTOR_required_parameters_1() async {
writeTestPackageConfig(meta: true);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
class A {
const A.myConstructor(int a, {int b, @required int c});
@@ -185,7 +185,7 @@
/// Verify parameter re-ordering for required params
Future<void> test_fromElement_CONSTRUCTOR_required_parameters_2() async {
writeTestPackageConfig(meta: true);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
class A {
const A.myConstructor(int a, {int b, @required int d, @required int c});
@@ -203,7 +203,7 @@
Future<void> test_fromElement_CONSTRUCTOR_required_parameters_3() async {
writeTestPackageConfig(meta: true);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
class A {
const A.myConstructor(int a, {int b, @required int d, @required int c, int a});
@@ -230,7 +230,7 @@
}
Future<void> test_fromElement_ENUM() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
@deprecated
enum _E1 { one, two }
enum E2 { three, four }''');
@@ -268,7 +268,7 @@
}
Future<void> test_fromElement_ENUM_CONSTANT() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
@deprecated
enum _E1 { one, two }
enum E2 { three, four }''');
@@ -353,7 +353,7 @@
}
Future<void> test_fromElement_FIELD() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static const myField = 42;
}''');
@@ -376,7 +376,7 @@
}
Future<void> test_fromElement_FUNCTION_TYPE_ALIAS() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef int F<T>(String x);
''');
engine.FunctionTypeAliasElement engineElement =
@@ -400,7 +400,7 @@
}
Future<void> test_fromElement_FUNCTION_TYPE_ALIAS_genericTypeAlias() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef F<T> = int Function(String x);
''');
engine.FunctionTypeAliasElement engineElement =
@@ -425,7 +425,7 @@
Future<void> test_fromElement_GETTER() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
String get myGetter => 42;
}''');
@@ -449,7 +449,7 @@
}
Future<void> test_fromElement_LABEL() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
myLabel:
while (true) {
@@ -475,7 +475,7 @@
}
Future<void> test_fromElement_METHOD() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static List<String> myMethod(int a, {String b, int c}) {
return null;
@@ -501,7 +501,7 @@
}
Future<void> test_fromElement_MIXIN() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin A {}
''');
{
@@ -525,7 +525,7 @@
}
Future<void> test_fromElement_SETTER() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
set mySetter(String x) {}
}''');
diff --git a/pkg/analysis_server/test/services/completion/postfix/postfix_completion_test.dart b/pkg/analysis_server/test/services/completion/postfix/postfix_completion_test.dart
index da88074..fe4bbb1 100644
--- a/pkg/analysis_server/test/services/completion/postfix/postfix_completion_test.dart
+++ b/pkg/analysis_server/test/services/completion/postfix/postfix_completion_test.dart
@@ -76,7 +76,7 @@
code = code.replaceFirst(key, '', offset);
verifyNoTestUnitErrors = false;
- await resolveTestUnit(code);
+ await resolveTestCode(code);
var context = PostfixCompletionContext(testAnalysisResult, offset, key);
processor = PostfixCompletionProcessor(context);
diff --git a/pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart b/pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart
index cb6d7b5..47f0b08 100644
--- a/pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart
+++ b/pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart
@@ -80,7 +80,7 @@
Future<void> _prepareCompletionAt(int offset, String sourceCode) async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit(sourceCode);
+ await resolveTestCode(sourceCode);
await _computeCompletion(offset);
}
}
diff --git a/pkg/analysis_server/test/services/correction/name_suggestion_test.dart b/pkg/analysis_server/test/services/correction/name_suggestion_test.dart
index c758f82..07e8f81 100644
--- a/pkg/analysis_server/test/services/correction/name_suggestion_test.dart
+++ b/pkg/analysis_server/test/services/correction/name_suggestion_test.dart
@@ -18,7 +18,7 @@
@reflectiveTest
class VariableNameSuggestionTest extends AbstractSingleUnitTest {
Future<void> test_forExpression_cast() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var sortedNodes;
var res = sortedNodes as String;
@@ -31,7 +31,7 @@
}
Future<void> test_forExpression_expectedType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class TreeNode {}
main() {
TreeNode node = null;
@@ -47,7 +47,7 @@
}
Future<void> test_forExpression_expectedType_double() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
double res = 0.0;
}
@@ -67,7 +67,7 @@
}
Future<void> test_forExpression_expectedType_int() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int res = 0;
}
@@ -87,7 +87,7 @@
}
Future<void> test_forExpression_expectedType_String() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
String res = 'abc';
}
@@ -102,7 +102,7 @@
}
Future<void> test_forExpression_inBuildMethod() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
void build() {
List l = new List();
@@ -122,7 +122,7 @@
}
Future<void> test_forExpression_indexExpression_endsWithE() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var topNodes = [0, 1, 2];
print(topNodes[0]);
@@ -136,7 +136,7 @@
Future<void> test_forExpression_instanceCreation() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' as p;
main(p) {
new NoSuchClass();
@@ -164,7 +164,7 @@
}
Future<void> test_forExpression_invocationArgument_named() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo({a, b, c}) {}
main() {
foo(a: 111, c: 333, b: 222);
@@ -189,7 +189,7 @@
}
Future<void> test_forExpression_invocationArgument_optional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo(a, [b = 2, c = 3]) {}
main() {
foo(111, 222, 333);
@@ -214,7 +214,7 @@
}
Future<void> test_forExpression_invocationArgument_positional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo(a, b) {}
main() {
foo(111, 222);
@@ -234,7 +234,7 @@
}
Future<void> test_forExpression_methodInvocation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
var res = p.getSortedNodes();
}
@@ -246,7 +246,7 @@
}
Future<void> test_forExpression_methodInvocation_noPrefix() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
var res = p.sortedNodes();
}
@@ -258,7 +258,7 @@
}
Future<void> test_forExpression_name_get() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
var res = p.get();
}
@@ -270,7 +270,7 @@
}
Future<void> test_forExpression_prefixedIdentifier() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
var res = p.sortedNodes;
}
@@ -285,7 +285,7 @@
}
Future<void> test_forExpression_privateName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
p._name;
p._computeSuffix();
@@ -307,7 +307,7 @@
}
Future<void> test_forExpression_propertyAccess() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
var res = p.q.sortedNodes;
}
@@ -320,7 +320,7 @@
}
Future<void> test_forExpression_simpleName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
var sortedNodes = null;
var res = sortedNodes;
@@ -333,7 +333,7 @@
}
Future<void> test_forExpression_unqualifiedInvocation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
getSortedNodes() => [];
main(p) {
var res = getSortedNodes();
diff --git a/pkg/analysis_server/test/services/correction/status_test.dart b/pkg/analysis_server/test/services/correction/status_test.dart
index 8e2582c..957e9cb 100644
--- a/pkg/analysis_server/test/services/correction/status_test.dart
+++ b/pkg/analysis_server/test/services/correction/status_test.dart
@@ -23,7 +23,7 @@
@reflectiveTest
class RefactoringLocationTest extends AbstractSingleUnitTest {
Future<void> test_createLocation_forElement() async {
- await resolveTestUnit('class MyClass {}');
+ await resolveTestCode('class MyClass {}');
var element = findElement('MyClass');
// check
var location = newLocation_fromElement(element);
@@ -35,7 +35,7 @@
}
Future<void> test_createLocation_forMatch() async {
- await resolveTestUnit('class MyClass {}');
+ await resolveTestCode('class MyClass {}');
var element = findElement('MyClass');
var sourceRange = range.elementName(element);
SearchMatch match = SearchMatchImpl(
@@ -56,7 +56,7 @@
}
Future<void> test_createLocation_forNode() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
}
''');
@@ -69,7 +69,7 @@
}
Future<void> test_createLocation_forUnit() async {
- await resolveTestUnit('');
+ await resolveTestCode('');
var sourceRange = SourceRange(10, 20);
// check
var location = newLocation_fromUnit(testUnit, sourceRange);
diff --git a/pkg/analysis_server/test/services/correction/util_test.dart b/pkg/analysis_server/test/services/correction/util_test.dart
index 7d4eacc..ad29a506 100644
--- a/pkg/analysis_server/test/services/correction/util_test.dart
+++ b/pkg/analysis_server/test/services/correction/util_test.dart
@@ -22,7 +22,7 @@
@reflectiveTest
class UtilTest extends AbstractSingleUnitTest {
Future<void> assert_invertCondition(String expr, String expected) async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int v1, v2, v3, v4, v5;
bool b1, b2, b3, b4, b5;
@@ -43,7 +43,7 @@
}
Future<void> test_addLibraryImports_dart_hasImports_between() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async';
import 'dart:math';
''');
@@ -56,7 +56,7 @@
}
Future<void> test_addLibraryImports_dart_hasImports_first() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:collection';
import 'dart:math';
''');
@@ -69,7 +69,7 @@
}
Future<void> test_addLibraryImports_dart_hasImports_last() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async';
import 'dart:collection';
''');
@@ -82,7 +82,7 @@
}
Future<void> test_addLibraryImports_dart_hasImports_multiple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:collection';
import 'dart:math';
''');
@@ -97,7 +97,7 @@
}
Future<void> test_addLibraryImports_dart_hasImports_multiple_first() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:html';
import 'dart:math';
''');
@@ -112,7 +112,7 @@
}
Future<void> test_addLibraryImports_dart_hasImports_multiple_last() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async';
import 'dart:collection';
''');
@@ -127,7 +127,7 @@
}
Future<void> test_addLibraryImports_dart_hasLibraryDirective() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
library test;
class A {}
@@ -145,7 +145,7 @@
}
Future<void> test_addLibraryImports_dart_noDirectives_hasComment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
/// Comment.
class A {}
@@ -163,7 +163,7 @@
}
Future<void> test_addLibraryImports_dart_noDirectives_hasShebang() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
#!/bin/dart
class A {}
@@ -181,7 +181,7 @@
}
Future<void> test_addLibraryImports_dart_noDirectives_noShebang() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
''');
var newLibrary1 = _getDartSource('dart:math');
@@ -205,7 +205,7 @@
..add(name: 'bbb', rootPath: '$workspaceRootPath/bbb'),
);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async';
import 'package:aaa/aaa.dart';
@@ -230,7 +230,7 @@
..add(name: 'bbb', rootPath: '$workspaceRootPath/bbb'),
);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async';
import 'package:bbb/bbb.dart';
@@ -258,7 +258,7 @@
..add(name: 'ddd', rootPath: '$workspaceRootPath/ddd'),
);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:aaa/aaa.dart';
import 'package:ddd/ddd.dart';
''');
diff --git a/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart b/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
index 36d28f4..2338885 100644
--- a/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
+++ b/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
@@ -128,7 +128,7 @@
}
Future<void> indexTestUnit(String code) async {
- await resolveTestUnit(code);
+ await resolveTestCode(code);
}
Future<void> indexUnit(String file, String code) async {
diff --git a/pkg/analysis_server/test/services/refactoring/move_file_test.dart b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
index 26f8105..5f7b090 100644
--- a/pkg/analysis_server/test/services/refactoring/move_file_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
@@ -30,7 +30,7 @@
addSource(pathB, "import 'test.dart';");
addSource(pathC, '');
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
library lib;
import 'dart:math';
import '22/c.dart';
@@ -191,7 +191,7 @@
import 'test.dart';
''');
await analyzeTestPackageFiles();
- await resolveTestUnit('');
+ await resolveTestCode('');
// perform refactoring
_createRefactoring('/home/test/000/1111/22/new_name.dart');
@@ -210,7 +210,7 @@
import 'sub/folder/test.dart';
''');
await analyzeTestPackageFiles();
- await resolveTestUnit('');
+ await resolveTestCode('');
// perform refactoring
_createRefactoring('/home/test/000/new/folder/name/new_name.dart');
await _assertSuccessfulRefactoring();
@@ -227,7 +227,7 @@
import '22/test.dart';
''');
await analyzeTestPackageFiles();
- await resolveTestUnit('');
+ await resolveTestCode('');
// perform refactoring
_createRefactoring('/home/test/000/1111/new_name.dart');
await _assertSuccessfulRefactoring();
@@ -252,7 +252,7 @@
library lib;
part '1111/22/test.dart';
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
part of lib;
''');
// perform refactoring
@@ -280,7 +280,7 @@
part of lib;
''');
await analyzeTestPackageFiles();
- await resolveTestUnit2();
+ await resolveTestFile();
// perform refactoring
_createRefactoring('/home/test/000/1111/22/new_name.dart');
await _assertSuccessfulRefactoring();
@@ -341,7 +341,7 @@
part of '../a.dart';
''');
await analyzeTestPackageFiles();
- await resolveTestUnit2();
+ await resolveTestFile();
// perform refactoring
_createRefactoring('/home/test/000/1111/22/33/test.dart');
await _assertSuccessfulRefactoring();
@@ -363,7 +363,7 @@
addSource(pathA, '''
part of 'test.dart';
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
part 'a.dart';
''');
// perform refactoring
@@ -386,7 +386,7 @@
addSource(pathA, '''
part of 'test.dart';
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
part 'a.dart';
''');
// perform refactoring
@@ -413,7 +413,7 @@
part of 'a.dart';
''');
await analyzeTestPackageFiles();
- await resolveTestUnit2();
+ await resolveTestFile();
// perform refactoring
_createRefactoring('/home/test/000/1111/22/test.dart');
await _assertSuccessfulRefactoring();
@@ -438,7 +438,7 @@
part of 'a.dart';
''');
await analyzeTestPackageFiles();
- await resolveTestUnit2();
+ await resolveTestFile();
// perform refactoring
_createRefactoring('/home/test/000/1111/test2.dart');
await _assertSuccessfulRefactoring();
diff --git a/pkg/analysis_server/test/services/search/element_visitors_test.dart b/pkg/analysis_server/test/services/search/element_visitors_test.dart
index 11d8bc7..be601d3 100644
--- a/pkg/analysis_server/test/services/search/element_visitors_test.dart
+++ b/pkg/analysis_server/test/services/search/element_visitors_test.dart
@@ -18,7 +18,7 @@
@reflectiveTest
class FindElementByNameOffsetTest extends AbstractSingleUnitTest {
Future<void> test_class() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class AAA {}
class BBB {}
''');
@@ -27,7 +27,7 @@
}
Future<void> test_function() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
void aaa() {}
void bbb() {}
''');
@@ -36,7 +36,7 @@
}
Future<void> test_null() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class AAA {}
class BBB {}
''');
@@ -50,7 +50,7 @@
}
Future<void> test_topLevelVariable() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
int aaa, bbb;
int ccc;
''');
diff --git a/pkg/analysis_server/test/services/search/hierarchy_test.dart b/pkg/analysis_server/test/services/search/hierarchy_test.dart
index f445dcc..4dbec50 100644
--- a/pkg/analysis_server/test/services/search/hierarchy_test.dart
+++ b/pkg/analysis_server/test/services/search/hierarchy_test.dart
@@ -479,6 +479,6 @@
}
Future<void> _indexTestUnit(String code) async {
- await resolveTestUnit(code);
+ await resolveTestCode(code);
}
}
diff --git a/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart b/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart
index 4cbaa050..8b0f30c 100644
--- a/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/import_elements_computer_test.dart
@@ -79,8 +79,7 @@
}
Future<void> test_createEdits_addImport_noPrefix() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -91,7 +90,7 @@
import 'package:pkg/foo.dart' as foo;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['A'])
+ ImportedElements(fooFile.path, '', <String>['A'])
]);
assertChanges('''
import 'package:pkg/foo.dart' as foo;
@@ -100,8 +99,7 @@
}
Future<void> test_createEdits_addImport_prefix() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -112,7 +110,7 @@
import 'package:pkg/foo.dart';
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, 'foo', <String>['A'])
+ ImportedElements(fooFile.path, 'foo', <String>['A'])
]);
assertChanges('''
import 'package:pkg/foo.dart';
@@ -121,8 +119,7 @@
}
Future<void> test_createEdits_addShow_multipleNames() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -134,7 +131,7 @@
import 'package:pkg/foo.dart' as foo;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['A', 'C'])
+ ImportedElements(fooFile.path, '', <String>['A', 'C'])
]);
assertChanges('''
import 'package:pkg/foo.dart' show B, A, C;
@@ -143,8 +140,7 @@
}
Future<void> test_createEdits_addShow_removeHide() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -155,7 +151,7 @@
import 'package:pkg/foo.dart' show A, B hide C, D;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['C'])
+ ImportedElements(fooFile.path, '', <String>['C'])
]);
assertChanges('''
import 'package:pkg/foo.dart' show A, B, C hide D;
@@ -163,8 +159,7 @@
}
Future<void> test_createEdits_addShow_singleName_noPrefix() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -175,7 +170,7 @@
import 'package:pkg/foo.dart' show B;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['A'])
+ ImportedElements(fooFile.path, '', <String>['A'])
]);
assertChanges('''
import 'package:pkg/foo.dart' show B, A;
@@ -183,8 +178,7 @@
}
Future<void> test_createEdits_addShow_singleName_prefix() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -196,7 +190,7 @@
import 'package:pkg/foo.dart' as foo show B;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, 'foo', <String>['A'])
+ ImportedElements(fooFile.path, 'foo', <String>['A'])
]);
assertChanges('''
import 'package:pkg/foo.dart' show C;
@@ -205,8 +199,7 @@
}
Future<void> test_createEdits_alreadyImported_noCombinators() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -217,14 +210,13 @@
import 'package:pkg/foo.dart';
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['A', 'B'])
+ ImportedElements(fooFile.path, '', <String>['A', 'B'])
]);
assertNoChanges();
}
Future<void> test_createEdits_alreadyImported_withPrefix() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -235,14 +227,13 @@
import 'package:pkg/foo.dart' as foo;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, 'foo', <String>['A', 'B'])
+ ImportedElements(fooFile.path, 'foo', <String>['A', 'B'])
]);
assertNoChanges();
}
Future<void> test_createEdits_alreadyImported_withShow() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -253,7 +244,7 @@
import 'package:pkg/foo.dart' show A;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['A'])
+ ImportedElements(fooFile.path, '', <String>['A'])
]);
assertNoChanges();
}
@@ -271,8 +262,7 @@
}
Future<void> test_createEdits_invalidUri() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -283,7 +273,7 @@
import 'pakage:pkg/foo.dart';
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['A'])
+ ImportedElements(fooFile.path, '', <String>['A'])
]);
assertChanges('''
import 'pakage:pkg/foo.dart';
@@ -298,8 +288,7 @@
}
Future<void> test_createEdits_removeHide_firstInCombinator() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -310,7 +299,7 @@
import 'package:pkg/foo.dart' hide A, B, C;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['A'])
+ ImportedElements(fooFile.path, '', <String>['A'])
]);
assertChanges('''
import 'package:pkg/foo.dart' hide B, C;
@@ -318,8 +307,7 @@
}
Future<void> test_createEdits_removeHide_lastInCombinator() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -330,7 +318,7 @@
import 'package:pkg/foo.dart' hide A, B, C;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['C'])
+ ImportedElements(fooFile.path, '', <String>['C'])
]);
assertChanges('''
import 'package:pkg/foo.dart' hide A, B;
@@ -338,8 +326,7 @@
}
Future<void> test_createEdits_removeHide_middleInCombinator() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -350,7 +337,7 @@
import 'package:pkg/foo.dart' hide A, B, C;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['B'])
+ ImportedElements(fooFile.path, '', <String>['B'])
]);
assertChanges('''
import 'package:pkg/foo.dart' hide A, C;
@@ -358,8 +345,7 @@
}
Future<void> test_createEdits_removeHide_multipleCombinators() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -370,7 +356,7 @@
import 'package:pkg/foo.dart' hide A, B, C hide A, B, C;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['B'])
+ ImportedElements(fooFile.path, '', <String>['B'])
]);
assertChanges('''
import 'package:pkg/foo.dart' hide A, C hide A, C;
@@ -378,8 +364,7 @@
}
Future<void> test_createEdits_removeHide_multipleNames() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -390,7 +375,7 @@
import 'package:pkg/foo.dart' hide A, B, C hide D, E, F hide G, H, I;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['A', 'E', 'I'])
+ ImportedElements(fooFile.path, '', <String>['A', 'E', 'I'])
]);
assertChanges('''
import 'package:pkg/foo.dart' hide B, C hide D, F hide G, H;
@@ -398,8 +383,7 @@
}
Future<void> test_createEdits_removeHideCombinator_first() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -410,7 +394,7 @@
import 'package:pkg/foo.dart' hide A hide B hide C;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['A'])
+ ImportedElements(fooFile.path, '', <String>['A'])
]);
assertChanges('''
import 'package:pkg/foo.dart' hide B hide C;
@@ -418,8 +402,7 @@
}
Future<void> test_createEdits_removeHideCombinator_last() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -430,7 +413,7 @@
import 'package:pkg/foo.dart' hide A hide B hide C;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['C'])
+ ImportedElements(fooFile.path, '', <String>['C'])
]);
assertChanges('''
import 'package:pkg/foo.dart' hide A hide B;
@@ -438,8 +421,7 @@
}
Future<void> test_createEdits_removeHideCombinator_middle() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -450,7 +432,7 @@
import 'package:pkg/foo.dart' hide A hide B hide C;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['B'])
+ ImportedElements(fooFile.path, '', <String>['B'])
]);
assertChanges('''
import 'package:pkg/foo.dart' hide A hide C;
@@ -458,8 +440,7 @@
}
Future<void> test_createEdits_removeHideCombinator_only() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -470,7 +451,7 @@
import 'package:pkg/foo.dart' hide A;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['A'])
+ ImportedElements(fooFile.path, '', <String>['A'])
]);
assertChanges('''
import 'package:pkg/foo.dart';
@@ -478,8 +459,7 @@
}
Future<void> test_createEdits_removeHideCombinator_only_multiple() async {
- var fooPath = '$workspaceRootPath/pkg/lib/foo.dart';
- newFile(fooPath, content: '');
+ var fooFile = newFile('$workspaceRootPath/pkg/lib/foo.dart');
writeTestPackageConfig(
config: PackageConfigFileBuilder()
@@ -490,7 +470,7 @@
import 'package:pkg/foo.dart' hide A, B;
''');
await computeChanges(<ImportedElements>[
- ImportedElements(fooPath, '', <String>['A', 'B'])
+ ImportedElements(fooFile.path, '', <String>['A', 'B'])
]);
assertChanges('''
import 'package:pkg/foo.dart';
diff --git a/pkg/analysis_server/test/src/services/completion/dart/feature_computer_test.dart b/pkg/analysis_server/test/src/services/completion/dart/feature_computer_test.dart
index d8b8b06..03c9c87 100644
--- a/pkg/analysis_server/test/src/services/completion/dart/feature_computer_test.dart
+++ b/pkg/analysis_server/test/src/services/completion/dart/feature_computer_test.dart
@@ -26,7 +26,7 @@
fail('Missing node offset marker (^) in content');
}
content = content.substring(0, index) + content.substring(index + 1);
- await resolveTestUnit(content);
+ await resolveTestCode(content);
// TODO(jwren) Consider changing this from the NodeLocator to the optype
// node finding logic to be more consistent with what the user behavior
// here will be.
diff --git a/pkg/analysis_server/test/src/services/correction/assist/add_diagnostic_property_reference_test.dart b/pkg/analysis_server/test/src/services/correction/assist/add_diagnostic_property_reference_test.dart
index 9525059..f9b684c 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/add_diagnostic_property_reference_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/add_diagnostic_property_reference_test.dart
@@ -29,7 +29,7 @@
/// Full coverage in fix/add_diagnostic_property_reference_test.dart
Future<void> test_boolField_debugFillProperties() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -58,7 +58,7 @@
Future<void> test_notAvailable_mixin() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin MyMixin {
String get foo/*caret*/() {}
}
@@ -67,7 +67,7 @@
}
Future<void> test_notAvailable_outsideDiagnosticable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
String get f/*caret*/ => null;
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/add_not_null_assert_test.dart b/pkg/analysis_server/test/src/services/correction/assist/add_not_null_assert_test.dart
index 92c6865..d100c48 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/add_not_null_assert_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/add_not_null_assert_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.ADD_NOT_NULL_ASSERT;
Future<void> test_function_expressionBody_noAssert() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
int double(int x) => x * 2;
''');
// todo (pq): support expression bodies.
@@ -28,7 +28,7 @@
}
Future<void> test_function_noAssert() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo(int x) {
}
''');
@@ -40,7 +40,7 @@
}
Future<void> test_function_withAssert() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo(int x) {
assert(x != null);
}
@@ -49,7 +49,7 @@
}
Future<void> test_function_withAssert2() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo(int x) {
print('foo');
assert(x != null);
@@ -59,7 +59,7 @@
}
Future<void> test_method_noAssert() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
foo(int x) {
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/add_return_type_test.dart b/pkg/analysis_server/test/src/services/correction/assist/add_return_type_test.dart
index 748ec86..c288dd0 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/add_return_type_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/add_return_type_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.ADD_RETURN_TYPE;
Future<void> test_localFunction_block() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
void m() {
/*caret*/f() {
@@ -42,7 +42,7 @@
}
Future<void> test_localFunction_expression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
void m() {
/*caret*/f() => '';
@@ -59,7 +59,7 @@
}
Future<void> test_method_block_noReturn() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/*caret*/m() {
}
@@ -69,7 +69,7 @@
}
Future<void> test_method_block_returnDynamic() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/*caret*/m(p) {
return p;
@@ -86,7 +86,7 @@
}
Future<void> test_method_block_returnNoValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/*caret*/m() {
return;
@@ -103,7 +103,7 @@
}
Future<void> test_method_block_singleReturn() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/*caret*/m() {
return '';
@@ -120,7 +120,7 @@
}
Future<void> test_method_expression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/*caret*/m() => '';
}
@@ -133,7 +133,7 @@
}
Future<void> test_method_getter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
get /*caret*/foo => 0;
}
@@ -146,7 +146,7 @@
}
Future<void> test_method_setter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
set /*caret*/foo(int a) {
if (a == 0) return;
@@ -166,7 +166,7 @@
createAnalysisOptionsFile(lints: [
LintNames.avoid_return_types_on_setters,
]);
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
set /*caret*/foo(int a) {
if (a == 0) return;
@@ -177,7 +177,7 @@
}
Future<void> test_topLevelFunction_block() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
/*caret*/f() {
return '';
}
@@ -190,7 +190,7 @@
}
Future<void> test_topLevelFunction_expression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
/*caret*/f() => '';
''');
await assertHasAssist('''
@@ -201,14 +201,14 @@
Future<void> test_topLevelFunction_expression_noAssistWithLint() async {
createAnalysisOptionsFile(lints: [LintNames.always_declare_return_types]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
/*caret*/f() => '';
''');
await assertNoAssist();
}
Future<void> test_topLevelFunction_getter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
get /*caret*/foo => 0;
''');
await assertHasAssist('''
@@ -217,7 +217,7 @@
}
Future<void> test_topLevelFunction_setter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
set /*caret*/foo(int a) {
if (a == 0) return;
}
@@ -234,7 +234,7 @@
createAnalysisOptionsFile(lints: [
LintNames.avoid_return_types_on_setters,
]);
- await resolveTestUnit('''
+ await resolveTestCode('''
set /*caret*/foo(int a) {
if (a == 0) return;
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart
index 58b7e66..06724fb 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/add_type_annotation_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.ADD_TYPE_ANNOTATION;
Future<void> test_classField_final() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
final f = 0;
}
@@ -36,7 +36,7 @@
Future<void> test_classField_final_noAssistWithLint() async {
createAnalysisOptionsFile(lints: [LintNames.always_specify_types]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/*caret*/final f = 0;
}
@@ -45,7 +45,7 @@
}
Future<void> test_classField_int() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
var f = 0;
}
@@ -58,7 +58,7 @@
}
Future<void> test_declaredIdentifier() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List<String> items) {
for (var item in items) {
}
@@ -85,7 +85,7 @@
import 'dart:collection';
List<HashMap<String, int>> getMap() => null;
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'my_lib.dart';
main() {
for (var map in getMap()) {
@@ -104,7 +104,7 @@
}
Future<void> test_declaredIdentifier_final() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List<String> items) {
for (final item in items) {
}
@@ -119,7 +119,7 @@
}
Future<void> test_declaredIdentifier_generic() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A<T> {
main(List<List<T>> items) {
for (var item in items) {
@@ -138,7 +138,7 @@
}
Future<void> test_declaredIdentifier_hasTypeAnnotation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List<String> items) {
for (String item in items) {
}
@@ -148,7 +148,7 @@
}
Future<void> test_declaredIdentifier_inForEachBody() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List<String> items) {
for (var item in items) {
42;
@@ -160,7 +160,7 @@
Future<void> test_declaredIdentifier_unknownType() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
for (var item in unknownList) {
}
@@ -174,7 +174,7 @@
import 'dart:collection';
HashMap<String, int> getMap() => null;
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'my_lib.dart';
main() {
var v = getMap();
@@ -211,7 +211,7 @@
var appPath = convertPath('/home/test/lib/app.dart');
addSource(appPath, appCode);
await analyzeTestPackageFiles();
- await resolveTestUnit2();
+ await resolveTestFile();
await assertHasAssist('''
part of my_app;
@@ -241,7 +241,7 @@
import '../aa/bbb/lib_a.dart';
MyClass newMyClass() => null;
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'ccc/lib_b.dart';
main() {
var v = newMyClass();
@@ -257,7 +257,7 @@
}
Future<void> test_local_bottom() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = throw 42;
}
@@ -266,7 +266,7 @@
}
Future<void> test_local_Function() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = () => 1;
}
@@ -279,7 +279,7 @@
}
Future<void> test_local_generic_literal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main(List<int> items) {
var v = items;
@@ -296,7 +296,7 @@
}
Future<void> test_local_generic_local() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A<T> {
main(List<T> items) {
var v = items;
@@ -313,7 +313,7 @@
}
Future<void> test_local_hasTypeAnnotation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int v = 42;
}
@@ -322,7 +322,7 @@
}
Future<void> test_local_int() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = 0;
}
@@ -335,7 +335,7 @@
}
Future<void> test_local_List() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = <String>[];
}
@@ -348,7 +348,7 @@
}
Future<void> test_local_localType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {}
C f() => null;
main() {
@@ -365,7 +365,7 @@
}
Future<void> test_local_multiple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var a = 1, b = '';
}
@@ -375,7 +375,7 @@
Future<void> test_local_noValue() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v;
}
@@ -384,7 +384,7 @@
}
Future<void> test_local_null() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = null;
}
@@ -393,7 +393,7 @@
}
Future<void> test_local_onInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var abc = 0;
}
@@ -402,7 +402,7 @@
}
Future<void> test_local_onName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var abc = 0;
}
@@ -415,7 +415,7 @@
}
Future<void> test_local_onVar() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = 0;
}
@@ -429,7 +429,7 @@
Future<void> test_local_unknown() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = unknownVar;
}
@@ -438,7 +438,7 @@
}
Future<void> test_parameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo(f(int p)) {}
main() {
foo((test) {});
@@ -453,7 +453,7 @@
}
Future<void> test_parameter_hasExplicitType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo(f(int p)) {}
main() {
foo((num test) {});
@@ -463,7 +463,7 @@
}
Future<void> test_parameter_noPropagatedType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo(f(p)) {}
main() {
foo((test) {});
@@ -479,7 +479,7 @@
class _B extends A {}
foo(f(_B p)) {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'my_lib.dart';
main() {
foo((test) {});
@@ -495,7 +495,7 @@
class _B extends A {}
List<_B> getValues() => [];
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'my_lib.dart';
class A<T> {
main() {
@@ -516,7 +516,7 @@
class _B extends A {}
List<_B> getValues() => [];
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'my_lib.dart';
main() {
var v = getValues();
@@ -531,7 +531,7 @@
}
Future<void> test_privateType_sameLibrary() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class _A {}
_A getValue() => _A();
main() {
@@ -554,7 +554,7 @@
class _B extends A {}
_B getValue() => _B();
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'my_lib.dart';
main() {
var v = getValue();
@@ -564,7 +564,7 @@
}
Future<void> test_topLevelField_int() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var V = 0;
''');
await assertHasAssistAt('var ', '''
@@ -573,14 +573,14 @@
}
Future<void> test_topLevelField_multiple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var A = 1, V = '';
''');
await assertNoAssistAt('var ');
}
Future<void> test_topLevelField_noValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var V;
''');
await assertNoAssistAt('var ');
diff --git a/pkg/analysis_server/test/src/services/correction/assist/assign_to_local_variable_test.dart b/pkg/analysis_server/test/src/services/correction/assist/assign_to_local_variable_test.dart
index 936b9fa..3fa857a 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/assign_to_local_variable_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/assign_to_local_variable_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.ASSIGN_TO_LOCAL_VARIABLE;
Future<void> test_alreadyAssignment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var vvv;
vvv = 42;
@@ -31,7 +31,7 @@
}
Future<void> test_inClosure() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
print(() {
12345;
@@ -48,7 +48,7 @@
}
Future<void> test_invocation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
List<int> bytes;
readBytes();
@@ -70,7 +70,7 @@
}
Future<void> test_invocationArgument() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
f(12345);
}
@@ -81,7 +81,7 @@
Future<void> test_recovery_splitExpression() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
Future<void> _extractDataForSite() async {
final Map<String, Object> data = {};
final data['table'][] //marker
@@ -91,7 +91,7 @@
}
Future<void> test_throw() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
throw 42;
}
@@ -100,7 +100,7 @@
}
Future<void> test_void() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
f();
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_mixin_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_mixin_test.dart
index 14d3271..9ccf27d 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_mixin_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_mixin_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_CLASS_TO_MIXIN;
Future<void> test_abstract() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {}
''');
await assertHasAssistAt('A', '''
@@ -29,7 +29,7 @@
}
Future<void> test_extends_noSuper() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
class B extends A {}
''');
@@ -40,7 +40,7 @@
}
Future<void> test_extends_super() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
a() {}
}
@@ -63,7 +63,7 @@
}
Future<void> test_extends_superSuper() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
a() {}
}
@@ -88,7 +88,7 @@
}
Future<void> test_extendsImplements_noSuper() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
class B {}
class C extends A implements B {}
@@ -101,7 +101,7 @@
}
Future<void> test_extendsImplements_super_extends() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
a() {}
}
@@ -126,7 +126,7 @@
}
Future<void> test_extendsWith_noSuper() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
class B {}
class C extends A with B {}
@@ -139,7 +139,7 @@
}
Future<void> test_extendsWith_super_both() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
a() {}
}
@@ -170,7 +170,7 @@
}
Future<void> test_extendsWith_super_extends() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
a() {}
}
@@ -199,7 +199,7 @@
}
Future<void> test_extendsWith_super_with() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
a() {}
}
@@ -228,7 +228,7 @@
}
Future<void> test_extendsWithImplements_noSuper() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
class B {}
class C {}
@@ -243,7 +243,7 @@
}
Future<void> test_extendsWithImplements_super_both() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
a() {}
}
@@ -276,7 +276,7 @@
}
Future<void> test_extendsWithImplements_super_extends() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
a() {}
}
@@ -307,7 +307,7 @@
}
Future<void> test_extendsWithImplements_super_with() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
a() {}
}
@@ -338,7 +338,7 @@
}
Future<void> test_implements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
class B implements A {}
''');
@@ -349,14 +349,14 @@
}
Future<void> test_noClauses_invalidSelection() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
''');
await assertNoAssistAt('{}');
}
Future<void> test_noClauses_selectKeyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
''');
await assertHasAssistAt('class', '''
@@ -365,7 +365,7 @@
}
Future<void> test_noClauses_selectName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
''');
await assertHasAssistAt('A', '''
@@ -374,7 +374,7 @@
}
Future<void> test_typeParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A<T> {}
''');
await assertHasAssistAt('A', '''
@@ -383,7 +383,7 @@
}
Future<void> test_with_noSuper() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
class B with A {}
''');
@@ -394,7 +394,7 @@
}
Future<void> test_with_super() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
a() {}
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_block_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_block_test.dart
index a253255..9fe4f87 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_block_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_block_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_DOCUMENTATION_INTO_BLOCK;
Future<void> test_alreadyBlock() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
/**
* AAAAAAA
*/
@@ -30,7 +30,7 @@
}
Future<void> test_noSpaceBeforeText() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/// AAAAA
///BBBBB
@@ -53,7 +53,7 @@
}
Future<void> test_notDocumentation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
// AAAA
class A {}
''');
@@ -61,7 +61,7 @@
}
Future<void> test_onReference() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
/// AAAAAAA [int] AAAAAAA
class A {}
''');
@@ -74,7 +74,7 @@
}
Future<void> test_onText() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/// AAAAAAA [int] AAAAAAA
/// BBBBBBBB BBBB BBBB
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_line_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_line_test.dart
index 29c820b..92a8449 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_line_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_documentation_into_line_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.CONVERT_DOCUMENTATION_INTO_LINE;
Future<void> test_alreadyLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
/// AAAAAAA
class A {}
''');
@@ -29,7 +29,7 @@
}
Future<void> test_hasEmptyLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/**
* AAAAAAA [int] AAAAAAA
@@ -50,7 +50,7 @@
}
Future<void> test_notDocumentation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
/* AAAA */
class A {}
''');
@@ -58,7 +58,7 @@
}
Future<void> test_onReference() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
/**
* AAAAAAA [int] AAAAAAA
*/
@@ -71,7 +71,7 @@
}
Future<void> test_onText() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/**
* AAAAAAA [int] AAAAAAA
@@ -92,7 +92,7 @@
}
Future<void> test_onText_hasFirstLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/** AAAAAAA [int] AAAAAAA
* BBBBBBBB BBBB BBBB
@@ -114,7 +114,7 @@
Future<void> test_onText_noAssistWithLint() async {
createAnalysisOptionsFile(lints: [LintNames.slash_for_doc_comments]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/**
* AAAAAAA [int] AAAAAAA
@@ -128,7 +128,7 @@
}
Future<void> test_preserveIndentation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/**
* First line.
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_async_body_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_async_body_test.dart
index 117edae..0120636 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_async_body_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_async_body_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_INTO_ASYNC_BODY;
Future<void> test_async() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async';
Future<String> f() async => '';
''');
@@ -28,7 +28,7 @@
}
Future<void> test_asyncStar() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async';
Stream<String> f() async* {}
''');
@@ -36,7 +36,7 @@
}
Future<void> test_closure() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
f(() => 123);
}
@@ -51,7 +51,7 @@
}
Future<void> test_constructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
C() {}
}
@@ -60,7 +60,7 @@
}
Future<void> test_function() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
String f() => '';
''');
await assertHasAssistAt('=>', '''
@@ -69,7 +69,7 @@
}
Future<void> test_getter_expression_noSpace() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int get g=>0;
}
@@ -82,7 +82,7 @@
}
Future<void> test_inBody_block() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
void foo() {
print(42);
@@ -93,7 +93,7 @@
}
Future<void> test_inBody_expression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
void foo() => print(42);
}
@@ -102,7 +102,7 @@
}
Future<void> test_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int m() { return 0; }
}
@@ -115,7 +115,7 @@
}
Future<void> test_method_abstract() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class C {
int m();
}
@@ -124,7 +124,7 @@
}
Future<void> test_method_noReturnType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
m() { return 0; }
}
@@ -137,7 +137,7 @@
}
Future<void> test_syncStar() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Iterable<String> f() sync* {}
''');
await assertNoAssistAt('{}');
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_block_body_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_block_body_test.dart
index 734b03a..db04588 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_block_body_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_block_body_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_INTO_BLOCK_BODY;
Future<void> test_async() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
mmm() async => 123;
}
@@ -35,7 +35,7 @@
}
Future<void> test_closure() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
setup(x) {}
main() {
setup(() => 42);
@@ -53,7 +53,7 @@
}
Future<void> test_closure_voidExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
setup(x) {}
main() {
setup(() => print('done'));
@@ -71,7 +71,7 @@
}
Future<void> test_constructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A.named();
@@ -90,14 +90,14 @@
}
Future<void> test_inExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() => 123;
''');
await assertNoAssistAt('123;');
}
Future<void> test_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
mmm() => 123;
}
@@ -112,14 +112,14 @@
}
Future<void> test_noEnclosingFunction() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var v = 123;
''');
await assertNoAssistAt('v =');
}
Future<void> test_notExpressionBlock() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
fff() {
return 123;
}
@@ -128,7 +128,7 @@
}
Future<void> test_onArrow() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
fff() => 123;
''');
await assertHasAssistAt('=>', '''
@@ -139,7 +139,7 @@
}
Future<void> test_onName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
fff() => 123;
''');
await assertHasAssistAt('fff()', '''
@@ -150,7 +150,7 @@
}
Future<void> test_throw() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
mmm() => throw 'error';
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_expression_body_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_expression_body_test.dart
index cfacc90..6e8152d 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_expression_body_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_expression_body_test.dart
@@ -21,14 +21,14 @@
AssistKind get kind => DartAssistKind.CONVERT_INTO_EXPRESSION_BODY;
Future<void> test_already() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
fff() => 42;
''');
await assertNoAssistAt('fff()');
}
Future<void> test_async() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
mmm() async {
return 42;
@@ -46,7 +46,7 @@
createAnalysisOptionsFile(
lints: [LintNames.prefer_expression_function_bodies]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
mmm() async {
return 42;
@@ -57,7 +57,7 @@
}
Future<void> test_closure() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
setup(x) {}
main() {
setup(() {
@@ -74,7 +74,7 @@
}
Future<void> test_closure_voidExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
setup(x) {}
main() {
setup((_) {
@@ -91,7 +91,7 @@
}
Future<void> test_constructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A.named();
@@ -110,7 +110,7 @@
}
Future<void> test_function_onBlock() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
fff() {
return 42;
}
@@ -121,7 +121,7 @@
}
Future<void> test_function_onName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
fff() {
return 42;
}
@@ -132,7 +132,7 @@
}
Future<void> test_inExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
return 42;
}
@@ -141,7 +141,7 @@
}
Future<void> test_method_onBlock() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
m() { // marker
return 42;
@@ -156,7 +156,7 @@
}
Future<void> test_moreThanOneStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
fff() {
var v = 42;
return v;
@@ -166,14 +166,14 @@
}
Future<void> test_noEnclosingFunction() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var V = 42;
''');
await assertNoAssistAt('V = ');
}
Future<void> test_noReturn() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
fff() {
var v = 42;
}
@@ -182,7 +182,7 @@
}
Future<void> test_noReturnValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
fff() {
return;
}
@@ -191,7 +191,7 @@
}
Future<void> test_topFunction_onReturnStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
fff() {
return 42;
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_final_field_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_final_field_test.dart
index b81362d..345eda1 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_final_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_final_field_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_INTO_FINAL_FIELD;
Future<void> test_blockBody_onlyReturnStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int get foo {
return 1 + 2;
@@ -35,7 +35,7 @@
}
Future<void> test_hasOverride() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
const myAnnotation = const Object();
class A {
@myAnnotation
@@ -52,7 +52,7 @@
}
Future<void> test_hasSetter_inSuper() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
void set foo(_) {}
}
@@ -71,7 +71,7 @@
}
Future<void> test_hasSetter_inThisClass() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int get foo => null;
void set foo(_) {}
@@ -81,7 +81,7 @@
}
Future<void> test_noReturnType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
get foo => 42;
}
@@ -94,7 +94,7 @@
}
Future<void> test_noReturnType_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static get foo => 42;
}
@@ -107,7 +107,7 @@
}
Future<void> test_notExpressionBody() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int get foo {
int v = 1 + 2;
@@ -119,7 +119,7 @@
}
Future<void> test_notGetter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int foo() => 42;
}
@@ -128,7 +128,7 @@
}
Future<void> test_notNull() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int get foo => 1 + 2;
}
@@ -141,7 +141,7 @@
}
Future<void> test_null() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int get foo => null;
}
@@ -154,7 +154,7 @@
}
Future<void> test_onName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int get foo => 42;
}
@@ -167,7 +167,7 @@
}
Future<void> test_onReturnType_parameterized() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
List<int> get foo => null;
}
@@ -180,7 +180,7 @@
}
Future<void> test_onReturnType_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int get foo => 42;
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_for_index_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_for_index_test.dart
index dc0a9e3..d6aca70 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_for_index_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_for_index_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_INTO_FOR_INDEX;
Future<void> test_bodyNotBlock() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List<String> items) {
for (String item in items) print(item);
}
@@ -29,7 +29,7 @@
}
Future<void> test_doesNotDeclareVariable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List<String> items) {
String item;
for (item in items) {
@@ -41,7 +41,7 @@
}
Future<void> test_iterableIsNotVariable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
for (String item in ['a', 'b', 'c']) {
print(item);
@@ -52,7 +52,7 @@
}
Future<void> test_iterableNotList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(Iterable<String> items) {
for (String item in items) {
print(item);
@@ -63,7 +63,7 @@
}
Future<void> test_onDeclaredIdentifier_name() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List<String> items) {
for (String item in items) {
print(item);
@@ -81,7 +81,7 @@
}
Future<void> test_onDeclaredIdentifier_type() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List<String> items) {
for (String item in items) {
print(item);
@@ -99,7 +99,7 @@
}
Future<void> test_onFor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List<String> items) {
for (String item in items) {
print(item);
@@ -117,7 +117,7 @@
}
Future<void> test_usesI() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List<String> items) {
for (String item in items) {
int i = 0;
@@ -135,7 +135,7 @@
}
Future<void> test_usesIJ() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List<String> items) {
for (String item in items) {
print(item);
@@ -155,7 +155,7 @@
}
Future<void> test_usesIJK() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List<String> items) {
for (String item in items) {
print(item);
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_generic_function_syntax_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_generic_function_syntax_test.dart
index 8ae79a7..cb80726 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_generic_function_syntax_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_generic_function_syntax_test.dart
@@ -20,21 +20,21 @@
AssistKind get kind => DartAssistKind.CONVERT_INTO_GENERIC_FUNCTION_SYNTAX;
Future<void> test_functionTypeAlias_insideParameterList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef String F(int x, int y);
''');
await assertNoAssistAt('x,');
}
Future<void> test_functionTypeAlias_noParameterTypes() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef String F(x);
''');
await assertNoAssistAt('def');
}
Future<void> test_functionTypeAlias_noReturnType_noTypeParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef String F(int x);
''');
await assertHasAssistAt('def', '''
@@ -43,7 +43,7 @@
}
Future<void> test_functionTypeAlias_noReturnType_typeParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef F<P, R>(P x);
''');
await assertHasAssistAt('def', '''
@@ -52,7 +52,7 @@
}
Future<void> test_functionTypeAlias_returnType_noTypeParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef String F(int x);
''');
await assertHasAssistAt('def', '''
@@ -61,7 +61,7 @@
}
Future<void> test_functionTypeAlias_returnType_typeParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef R F<P, R>(P x);
''');
await assertHasAssistAt('def', '''
@@ -70,14 +70,14 @@
}
Future<void> test_functionTypedParameter_insideParameterList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
g(String f(int x, int y)) {}
''');
await assertNoAssistAt('x,');
}
Future<void> test_functionTypedParameter_noParameterTypes() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
g(String f(x)) {}
''');
await assertNoAssistAt('f(');
@@ -85,7 +85,7 @@
Future<void>
test_functionTypedParameter_noReturnType_noTypeParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
g(f(int x)) {}
''');
await assertHasAssistAt('f(', '''
@@ -94,7 +94,7 @@
}
Future<void> test_functionTypedParameter_returnType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
g(String f(int x)) {}
''');
await assertHasAssistAt('f(', '''
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_getter_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_getter_test.dart
index 48f5200..ffc7664 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_getter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_getter_test.dart
@@ -21,7 +21,7 @@
Future<void> test_noInitializer() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
final int foo;
}
@@ -30,7 +30,7 @@
}
Future<void> test_notFinal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int foo = 1;
}
@@ -39,7 +39,7 @@
}
Future<void> test_notSingleField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
final int foo = 1, bar = 2;
}
@@ -48,7 +48,7 @@
}
Future<void> test_noType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
final foo = 42;
}
@@ -61,7 +61,7 @@
}
Future<void> test_type() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
const myAnnotation = const Object();
class A {
@myAnnotation
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_empty_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_empty_test.dart
index 18b1e53..ce777b0 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_empty_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_empty_test.dart
@@ -21,7 +21,7 @@
Future<void> test_noBang() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
main(String str) {
~str.isEmpty;
}
@@ -30,7 +30,7 @@
}
Future<void> test_noIsNotEmpty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
bool get isEmpty => false;
}
@@ -42,7 +42,7 @@
}
Future<void> test_notInPrefixExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(String str) {
str.isEmpty;
}
@@ -51,7 +51,7 @@
}
Future<void> test_notIsEmpty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(int p) {
!p.isEven;
}
@@ -60,7 +60,7 @@
}
Future<void> test_on_isEmpty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(String str) {
!str.isEmpty;
}
@@ -73,7 +73,7 @@
}
Future<void> test_on_str() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(String str) {
!str.isEmpty;
}
@@ -86,7 +86,7 @@
}
Future<void> test_propertyAccess() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(String str) {
!'text'.isEmpty;
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_test.dart
index a729944..5a68942 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_into_is_not_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_INTO_IS_NOT;
Future<void> test_childOfIs_left() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
!(p is String);
}
@@ -33,7 +33,7 @@
}
Future<void> test_childOfIs_right() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
!(p is String);
}
@@ -46,7 +46,7 @@
}
Future<void> test_is() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
!(p is String);
}
@@ -59,7 +59,7 @@
}
Future<void> test_is_alreadyIsNot() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
p is! String;
}
@@ -68,7 +68,7 @@
}
Future<void> test_is_higherPrecedencePrefix() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
!!(p is String);
}
@@ -81,7 +81,7 @@
}
Future<void> test_is_noEnclosingParenthesis() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
p is String;
}
@@ -90,7 +90,7 @@
}
Future<void> test_is_noPrefix() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
(p is String);
}
@@ -99,7 +99,7 @@
}
Future<void> test_is_not_higherPrecedencePrefix() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
!!(p is String);
}
@@ -112,7 +112,7 @@
}
Future<void> test_is_notIsExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
123 + 456;
}
@@ -122,7 +122,7 @@
Future<void> test_is_notTheNotOperator() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
++(p is String);
}
@@ -131,7 +131,7 @@
}
Future<void> test_not() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
!(p is String);
}
@@ -144,7 +144,7 @@
}
Future<void> test_not_alreadyIsNot() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
!(p is! String);
}
@@ -153,7 +153,7 @@
}
Future<void> test_not_noEnclosingParenthesis() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
!p;
}
@@ -162,7 +162,7 @@
}
Future<void> test_not_notIsExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
!(p == null);
}
@@ -172,7 +172,7 @@
Future<void> test_not_notTheNotOperator() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
++(p is String);
}
@@ -181,7 +181,7 @@
}
Future<void> test_parentheses() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
!(p is String);
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart
index f9aecc2..4f99ef9 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_part_of_to_uri_test.dart
@@ -31,7 +31,7 @@
''');
await analyzeTestPackageFiles();
- await resolveTestUnit2();
+ await resolveTestFile();
await assertHasAssistAt('foo', '''
part of '../foo.dart';
''');
@@ -49,7 +49,7 @@
''');
await analyzeTestPackageFiles();
- await resolveTestUnit2();
+ await resolveTestFile();
await assertHasAssistAt('foo', '''
part of 'foo.dart';
''');
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_double_quoted_string_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_double_quoted_string_test.dart
index f031a25..6f8f3d2 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_double_quoted_string_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_double_quoted_string_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_DOUBLE_QUOTED_STRING;
Future<void> test_one_embeddedTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print('a"b"c');
}
@@ -29,7 +29,7 @@
}
Future<void> test_one_enclosingTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print("abc");
}
@@ -38,7 +38,7 @@
}
Future<void> test_one_interpolation() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
var b = 'b';
var c = 'c';
@@ -55,7 +55,7 @@
}
Future<void> test_one_raw() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print(r'abc');
}
@@ -68,7 +68,7 @@
}
Future<void> test_one_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print('abc');
}
@@ -81,7 +81,7 @@
}
Future<void> test_three_embeddedTarget() async {
- await resolveTestUnit("""
+ await resolveTestCode("""
main() {
print('''a""\"c''');
}
@@ -90,7 +90,7 @@
}
Future<void> test_three_enclosingTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print("""abc""");
}
@@ -99,7 +99,7 @@
}
Future<void> test_three_interpolation() async {
- await resolveTestUnit(r"""
+ await resolveTestCode(r"""
main() {
var b = 'b';
var c = 'c';
@@ -116,7 +116,7 @@
}
Future<void> test_three_raw() async {
- await resolveTestUnit("""
+ await resolveTestCode("""
main() {
print(r'''abc''');
}
@@ -129,7 +129,7 @@
}
Future<void> test_three_simple() async {
- await resolveTestUnit("""
+ await resolveTestCode("""
main() {
print('''abc''');
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_field_parameter_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_field_parameter_test.dart
index 8ff735a..f616eab 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_field_parameter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_field_parameter_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_FIELD_PARAMETER;
Future<void> test_additionalUse() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int aaa2;
int bbb2;
@@ -31,7 +31,7 @@
}
Future<void> test_firstInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int aaa2;
int bbb2;
@@ -48,7 +48,7 @@
}
Future<void> test_notPureAssignment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int aaa2;
A(int aaa) : aaa2 = aaa * 2;
@@ -58,7 +58,7 @@
}
Future<void> test_onParameterName_inInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int test2;
A(int test) : test2 = test {
@@ -75,7 +75,7 @@
}
Future<void> test_onParameterName_inParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int test;
A(int test) : test = test {
@@ -92,7 +92,7 @@
}
Future<void> test_secondInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int aaa2;
int bbb2;
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_for_element_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_for_element_test.dart
index 6a2da91..80cd6c1 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_for_element_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_for_element_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_FOR_ELEMENT;
Future<void> test_mapFromIterable_complexKey() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
return Map.fromIt/*caret*/erable(i, key: (e) {
var result = e * 2;
@@ -33,7 +33,7 @@
}
Future<void> test_mapFromIterable_complexValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
return Map.fromIt/*caret*/erable(i, key: (e) => e * 2, value: (e) {
var result = e + 3;
@@ -46,7 +46,7 @@
Future<void>
test_mapFromIterable_differentParameterNames_usedInKey_conflictInValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
var k = 3;
return Map.fromIt/*caret*/erable(i, key: (k) => k * 2, value: (v) => k);
@@ -65,7 +65,7 @@
createAnalysisOptionsFile(
lints: [LintNames.prefer_for_elements_to_map_fromIterable]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
var k = 3;
return Map.fromIt/*caret*/erable(i, key: (k) => k * 2, value: (v) => k);
@@ -76,7 +76,7 @@
Future<void>
test_mapFromIterable_differentParameterNames_usedInKey_noConflictInValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
return Map.fromIt/*caret*/erable(i, key: (k) => k * 2, value: (v) => 0);
}
@@ -90,7 +90,7 @@
Future<void>
test_mapFromIterable_differentParameterNames_usedInKeyAndValue_conflictWithDefault() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
var e = 2;
return Map.fromIt/*caret*/erable(i, key: (k) => k * e, value: (v) => v + e);
@@ -106,7 +106,7 @@
Future<void>
test_mapFromIterable_differentParameterNames_usedInKeyAndValue_noConflictWithDefault() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
return Map.fromIt/*caret*/erable(i, key: (k) => k * 2, value: (v) => v + 3);
}
@@ -120,7 +120,7 @@
Future<void>
test_mapFromIterable_differentParameterNames_usedInValue_conflictInKey() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
int v = 0;
return Map.fromIt/*caret*/erable(i, key: (k) => v++, value: (v) => v * 10);
@@ -136,7 +136,7 @@
Future<void>
test_mapFromIterable_differentParameterNames_usedInValue_noConflictInKey() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
int index = 0;
return Map.fromIt/*caret*/erable(i, key: (k) => index++, value: (v) => v * 10);
@@ -151,7 +151,7 @@
}
Future<void> test_mapFromIterable_missingKey() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
return Map.fromIt/*caret*/erable(i, value: (e) => e + 3);
}
@@ -160,7 +160,7 @@
}
Future<void> test_mapFromIterable_missingKeyAndValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
return Map.fromIt/*caret*/erable(i);
}
@@ -169,7 +169,7 @@
}
Future<void> test_mapFromIterable_missingValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
return Map.fromIt/*caret*/erable(i, key: (e) => e * 2);
}
@@ -178,7 +178,7 @@
}
Future<void> test_mapFromIterable_notMapFromIterable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
return A.fromIt/*caret*/erable(i, key: (e) => e * 2, value: (e) => e + 3);
}
@@ -190,7 +190,7 @@
}
Future<void> test_mapFromIterable_sameParameterNames() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
return Map.fromIt/*caret*/erable(i, key: (e) => e * 2, value: (e) => e + 3);
}
@@ -204,7 +204,7 @@
Future<void> test_undefinedConstructor() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
return new Unde/*caret*/fined();
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_if_element_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_if_element_test.dart
index f59eb2a..b277e60 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_if_element_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_if_element_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_IF_ELEMENT;
Future<void> test_conditional_list() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(bool b) {
return ['a', b /*caret*/? 'c' : 'd', 'e'];
}
@@ -34,7 +34,7 @@
}
Future<void> test_conditional_list_caret_at_start_of_expression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(bool b) {
return ['a', /*caret*/b ? 'c' : 'd', 'e'];
}
@@ -50,7 +50,7 @@
createAnalysisOptionsFile(
lints: [LintNames.prefer_if_elements_to_conditional_expressions]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
f(bool b) {
return ['a', b /*caret*/? 'c' : 'd', 'e'];
}
@@ -59,7 +59,7 @@
}
Future<void> test_conditional_list_withParentheses() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(bool b) {
return ['a', (b /*caret*/? 'c' : 'd'), 'e'];
}
@@ -72,7 +72,7 @@
}
Future<void> test_conditional_map() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(bool b) {
return {'a' : 1, b /*caret*/? 'c' : 'd' : 2, 'e' : 3};
}
@@ -81,7 +81,7 @@
}
Future<void> test_conditional_notConditional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(bool b) {
return {'/*caret*/a', b ? 'c' : 'd', 'e'};
}
@@ -90,7 +90,7 @@
}
Future<void> test_conditional_notInLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(bool b) {
return b /*caret*/? 'c' : 'd';
}
@@ -99,7 +99,7 @@
}
Future<void> test_conditional_set() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(bool b) {
return {'a', b /*caret*/? 'c' : 'd', 'e'};
}
@@ -112,7 +112,7 @@
}
Future<void> test_conditional_set_withParentheses() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(bool b) {
return {'a', ((b /*caret*/? 'c' : 'd')), 'e'};
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_int_literal_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_int_literal_test.dart
index ae6bb6c..919ab32 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_int_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_int_literal_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_INT_LITERAL;
Future<void> test_decimal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
const double myDouble = /*caret*/42.0;
''');
await assertHasAssist('''
@@ -32,21 +32,21 @@
Future<void> test_decimal_noAssistWithLint() async {
createAnalysisOptionsFile(lints: [LintNames.prefer_int_literals]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
const double myDouble = /*caret*/42.0;
''');
await assertNoAssist();
}
Future<void> test_notDouble() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
const double myDouble = /*caret*/42;
''');
await assertNoAssist();
}
Future<void> test_scientific() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
const double myDouble = /*caret*/4.2e1;
''');
await assertHasAssist('''
@@ -55,7 +55,7 @@
}
Future<void> test_tooBig() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
const double myDouble = /*caret*/4.2e99999;
''');
await assertNoAssist();
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_list_literal_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_list_literal_test.dart
index 71a49aa..880a6f1 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_list_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_list_literal_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_LIST_LITERAL;
Future<void> test_default_declaredType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
List l = Li/*caret*/st();
''');
await assertHasAssist('''
@@ -29,7 +29,7 @@
}
Future<void> test_default_minimal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = Li/*caret*/st();
''');
await assertHasAssist('''
@@ -38,7 +38,7 @@
}
Future<void> test_default_newKeyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = new Li/*caret*/st();
''');
await assertHasAssist('''
@@ -47,14 +47,14 @@
}
Future<void> test_default_tooManyArguments() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = Li/*caret*/st(5);
''');
await assertNoAssist();
}
Future<void> test_default_typeArg() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = Li/*caret*/st<int>();
''');
await assertHasAssist('''
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_map_literal_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_map_literal_test.dart
index 22549b0..9b6b24b 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_map_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_map_literal_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_MAP_LITERAL;
Future<void> test_default_declaredType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Map m = Ma/*caret*/p();
''');
await assertHasAssist('''
@@ -29,7 +29,7 @@
}
Future<void> test_default_linkedHashMap() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:collection';
var m = LinkedHashMa/*caret*/p();
''');
@@ -40,7 +40,7 @@
}
Future<void> test_default_minimal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var m = Ma/*caret*/p();
''');
await assertHasAssist('''
@@ -49,7 +49,7 @@
}
Future<void> test_default_newKeyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var m = new Ma/*caret*/p();
''');
await assertHasAssist('''
@@ -58,7 +58,7 @@
}
Future<void> test_default_typeArg() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var m = Ma/*caret*/p<String, int>();
''');
await assertHasAssist('''
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_multiline_string_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_multiline_string_test.dart
index 66fd199..316515d 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_multiline_string_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_multiline_string_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_MULTILINE_STRING;
Future<void> test_doubleQuoted() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print("abc");
}
@@ -34,7 +34,7 @@
}
Future<void> test_doubleQuoted_alreadyMultiline() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print("""abc""");
}
@@ -43,7 +43,7 @@
}
Future<void> test_doubleQuoted_interpolation_expressionElement() async {
- await resolveTestUnit(r"""
+ await resolveTestCode(r"""
main() {
var b = 'b';
var c = 'c';
@@ -54,7 +54,7 @@
}
Future<void> test_doubleQuoted_interpolation_stringElement_begin() async {
- await resolveTestUnit(r"""
+ await resolveTestCode(r"""
main() {
var b = 'b';
var c = 'c';
@@ -72,7 +72,7 @@
}
Future<void> test_doubleQuoted_interpolation_stringElement_middle() async {
- await resolveTestUnit(r"""
+ await resolveTestCode(r"""
main() {
var b = 'b';
var c = 'c';
@@ -90,7 +90,7 @@
}
Future<void> test_doubleQuoted_raw() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print(r"abc");
}
@@ -104,7 +104,7 @@
}
Future<void> test_singleQuoted() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print('abc');
}
@@ -118,7 +118,7 @@
}
Future<void> test_singleQuoted_interpolation_expressionElement() async {
- await resolveTestUnit(r"""
+ await resolveTestCode(r"""
main() {
var b = 'b';
var c = 'c';
@@ -129,7 +129,7 @@
}
Future<void> test_singleQuoted_interpolation_stringElement_begin() async {
- await resolveTestUnit(r"""
+ await resolveTestCode(r"""
main() {
var b = 'b';
var c = 'c';
@@ -147,7 +147,7 @@
}
Future<void> test_singleQuoted_interpolation_stringElement_middle() async {
- await resolveTestUnit(r"""
+ await resolveTestCode(r"""
main() {
var b = 'b';
var c = 'c';
@@ -165,7 +165,7 @@
}
Future<void> test_singleQuoted_raw() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print(r'abc');
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_normal_parameter_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_normal_parameter_test.dart
index cdbf63e..90973a6 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_normal_parameter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_normal_parameter_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_NORMAL_PARAMETER;
Future<void> test_dynamic() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
var test;
A(this.test) {
@@ -37,7 +37,7 @@
}
Future<void> test_firstInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int test;
A(this.test) {
@@ -54,7 +54,7 @@
}
Future<void> test_secondInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
double aaa;
int bbb;
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_null_aware_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_null_aware_test.dart
index 47027ee..d12dd4c 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_null_aware_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_null_aware_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_NULL_AWARE;
Future<void> test_equal_differentTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int m();
}
@@ -31,7 +31,7 @@
}
Future<void> test_equal_notComparedToNull() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int m();
}
@@ -41,7 +41,7 @@
}
Future<void> test_equal_notIdentifier() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int m();
}
@@ -51,7 +51,7 @@
}
Future<void> test_equal_notInvocation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int m();
int operator +(A a);
@@ -62,7 +62,7 @@
}
Future<void> test_equal_notNullPreserving() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int m();
}
@@ -72,7 +72,7 @@
}
Future<void> test_equal_notPeriod() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int m();
}
@@ -82,7 +82,7 @@
}
Future<void> test_equal_nullOnLeft() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int m();
}
@@ -99,7 +99,7 @@
Future<void> test_equal_nullOnLeft_noAssistWithLint() async {
createAnalysisOptionsFile(lints: [LintNames.prefer_null_aware_operators]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int m();
}
@@ -109,7 +109,7 @@
}
Future<void> test_equal_nullOnRight() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int m();
}
@@ -124,7 +124,7 @@
}
Future<void> test_equal_prefixedIdentifier() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int p;
}
@@ -139,7 +139,7 @@
}
Future<void> test_notEqual_notNullPreserving() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int m();
}
@@ -149,7 +149,7 @@
}
Future<void> test_notEqual_nullOnLeft() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int m();
}
@@ -164,7 +164,7 @@
}
Future<void> test_notEqual_nullOnRight() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int m();
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart
index db35739..95807a2 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_package_import_test.dart
@@ -23,7 +23,7 @@
Future<void> test_fileName_onImport() async {
addSource('/home/test/lib/foo.dart', '');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'foo.dart';
''');
// Validate assist is on import keyword too.
@@ -35,7 +35,7 @@
Future<void> test_fileName_onUri() async {
addSource('/home/test/lib/foo.dart', '');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'foo.dart';
''');
await assertHasAssistAt('foo.dart', '''
@@ -45,7 +45,7 @@
Future<void> test_invalidUri() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
import ':[invalidUri]';
''');
await assertNoAssistAt('invalid');
@@ -54,7 +54,7 @@
Future<void> test_nonPackage_Uri() async {
addSource('/home/test/lib/foo.dart', '');
testFile = convertPath('/home/test/lib/src/test.dart');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:core';
''');
@@ -65,7 +65,7 @@
Future<void> test_packageUri() async {
addSource('/home/test/lib/foo.dart', '');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/foo.dart';
''');
await assertNoAssistAt('foo.dart');
@@ -77,7 +77,7 @@
testFile = convertPath('/home/test/lib/src/test.dart');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '../foo/bar.dart';
''');
await assertHasAssistAt('bar.dart', '''
@@ -90,7 +90,7 @@
verifyNoTestUnitErrors = false;
addSource('/home/test/lib/foo.dart', '');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '../lib/foo.dart';
''');
await assertNoAssist();
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_set_literal_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_set_literal_test.dart
index 1480548..76079f7 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_set_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_set_literal_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_SET_LITERAL;
Future<void> test_default_declaredType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Set s = S/*caret*/et();
''');
await assertHasAssist('''
@@ -29,7 +29,7 @@
}
Future<void> test_default_minimal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = S/*caret*/et();
''');
await assertHasAssist('''
@@ -38,7 +38,7 @@
}
Future<void> test_default_newKeyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = new S/*caret*/et();
''');
await assertHasAssist('''
@@ -47,7 +47,7 @@
}
Future<void> test_default_typeArg() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = S/*caret*/et<int>();
''');
await assertHasAssist('''
@@ -56,7 +56,7 @@
}
Future<void> test_from_empty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = S/*caret*/et.from([]);
''');
await assertHasAssist('''
@@ -65,7 +65,7 @@
}
Future<void> test_from_newKeyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = new S/*caret*/et.from([2, 3]);
''');
await assertHasAssist('''
@@ -74,7 +74,7 @@
}
Future<void> test_from_noKeyword_declaredType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Set s = S/*caret*/et.from([2, 3]);
''');
await assertHasAssist('''
@@ -83,7 +83,7 @@
}
Future<void> test_from_noKeyword_typeArg_onConstructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = S/*caret*/et<int>.from([2, 3]);
''');
await assertHasAssist('''
@@ -92,7 +92,7 @@
}
Future<void> test_from_noKeyword_typeArg_onConstructorAndLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = S/*caret*/et<int>.from(<num>[2, 3]);
''');
await assertHasAssist('''
@@ -101,7 +101,7 @@
}
Future<void> test_from_noKeyword_typeArg_onLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = S/*caret*/et.from(<int>[2, 3]);
''');
await assertHasAssist('''
@@ -110,7 +110,7 @@
}
Future<void> test_from_nonEmpty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = S/*caret*/et.from([2, 3]);
''');
await assertHasAssist('''
@@ -119,7 +119,7 @@
}
Future<void> test_from_notALiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = [1];
Set s = new S/*caret*/et.from(l);
''');
@@ -127,7 +127,7 @@
}
Future<void> test_from_trailingComma() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = S/*caret*/et.from([2, 3,]);
''');
await assertHasAssist('''
@@ -136,7 +136,7 @@
}
Future<void> test_toSet_empty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = [].to/*caret*/Set();
''');
await assertHasAssist('''
@@ -145,7 +145,7 @@
}
Future<void> test_toSet_empty_typeArg() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = <int>[].to/*caret*/Set();
''');
await assertHasAssist('''
@@ -154,7 +154,7 @@
}
Future<void> test_toSet_nonEmpty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = [2, 3].to/*caret*/Set();
''');
await assertHasAssist('''
@@ -163,7 +163,7 @@
}
Future<void> test_toSet_nonEmpty_typeArg() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = <int>[2, 3].to/*caret*/Set();
''');
await assertHasAssist('''
@@ -172,7 +172,7 @@
}
Future<void> test_toSet_notALiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = [];
var s = l.to/*caret*/Set();
''');
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_single_quoted_string_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_single_quoted_string_test.dart
index 35bb812..9e925c0 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_single_quoted_string_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_single_quoted_string_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_SINGLE_QUOTED_STRING;
Future<void> test_one_embeddedTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print("a'b'c");
}
@@ -30,7 +30,7 @@
}
Future<void> test_one_enclosingTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print('abc');
}
@@ -39,7 +39,7 @@
}
Future<void> test_one_interpolation() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
var b = 'b';
var c = 'c';
@@ -56,7 +56,7 @@
}
Future<void> test_one_raw() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print(r"abc");
}
@@ -69,7 +69,7 @@
}
Future<void> test_one_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print("abc");
}
@@ -84,7 +84,7 @@
Future<void> test_one_simple_noAssistWithLint() async {
createAnalysisOptionsFile(lints: [LintNames.prefer_single_quotes]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print("abc");
}
@@ -93,7 +93,7 @@
}
Future<void> test_three_embeddedTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print("""a''\'bc""");
}
@@ -102,7 +102,7 @@
}
Future<void> test_three_enclosingTarget() async {
- await resolveTestUnit("""
+ await resolveTestCode("""
main() {
print('''abc''');
}
@@ -111,7 +111,7 @@
}
Future<void> test_three_interpolation() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
var b = 'b';
var c = 'c';
@@ -128,7 +128,7 @@
}
Future<void> test_three_raw() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print(r"""abc""");
}
@@ -141,7 +141,7 @@
}
Future<void> test_three_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print("""abc""");
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_to_spread_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_to_spread_test.dart
index e577bef..dc43575 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/convert_to_spread_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/convert_to_spread_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.CONVERT_TO_SPREAD;
Future<void> test_addAll_condition_const() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool condition;
var things;
var l = ['a']..add/*caret*/All(condition ? things : const []);
@@ -34,7 +34,7 @@
}
Future<void> test_addAll_condition_nonConst() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool condition;
var things;
var l = ['a']..add/*caret*/All(condition ? things : []);
@@ -47,7 +47,7 @@
}
Future<void> test_addAll_expression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
var ints = [1, 2, 3];
print(['a']..addAl/*caret*/l(ints.map((i) => i.toString()))..addAll(['c']));
@@ -64,7 +64,7 @@
Future<void> test_addAll_expression_noAssistWithLint() async {
createAnalysisOptionsFile(lints: [LintNames.prefer_spread_collections]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
var ints = [1, 2, 3];
print(['a']..addAl/*caret*/l(ints.map((i) => i.toString()))..addAll(['c']));
@@ -74,7 +74,7 @@
}
Future<void> test_addAll_expression_toEmptyList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
var ints = [1, 2, 3];
print([]..addAl/*caret*/l(ints.map((i) => i.toString()))..addAll(['c']));
@@ -90,14 +90,14 @@
Future<void> test_addAll_literal() async {
// This case is covered by the INLINE_INVOCATION assist.
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = ['a']..add/*caret*/All(['b'])..addAll(['c']);
''');
await assertNoAssist();
}
Future<void> test_addAll_nonLiteralTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l1 = [];
var l2 = l1..addAl/*caret*/l(['b'])..addAll(['c']);
''');
@@ -105,14 +105,14 @@
}
Future<void> test_addAll_notFirst() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = ['a']..addAll(['b'])../*caret*/addAll(['c']);
''');
await assertNoAssist();
}
Future<void> test_addAll_nullAware_const() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var things;
var l = ['a']..add/*caret*/All(things ?? const []);
''');
@@ -123,7 +123,7 @@
}
Future<void> test_addAll_nullAware_nonConst() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var things;
var l = ['a']..add/*caret*/All(things ?? []);
''');
diff --git a/pkg/analysis_server/test/src/services/correction/assist/encapsulate_field_test.dart b/pkg/analysis_server/test/src/services/correction/assist/encapsulate_field_test.dart
index 55e1bcb..3ab99bf 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/encapsulate_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/encapsulate_field_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.ENCAPSULATE_FIELD;
Future<void> test_alreadyPrivate() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int _test = 42;
}
@@ -32,7 +32,7 @@
}
Future<void> test_documentation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/// AAA
/// BBB
@@ -59,7 +59,7 @@
}
Future<void> test_final() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
final int test = 42;
}
@@ -68,7 +68,7 @@
}
Future<void> test_hasType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int test = 42;
A(this.test);
@@ -95,7 +95,7 @@
}
Future<void> test_multipleFields() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int aaa, bbb, ccc;
}
@@ -107,7 +107,7 @@
}
Future<void> test_notOnName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int test = 1 + 2 + 3;
}
@@ -116,7 +116,7 @@
}
Future<void> test_noType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
var test = 42;
}
@@ -142,7 +142,7 @@
Future<void> test_parseError() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int; // marker
}
@@ -154,7 +154,7 @@
}
Future<void> test_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static int test = 42;
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/exchange_operands_test.dart b/pkg/analysis_server/test/src/services/correction/assist/exchange_operands_test.dart
index dfd234c..c5921f3 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/exchange_operands_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/exchange_operands_test.dart
@@ -25,7 +25,7 @@
for (var i = 0; i <= 0; i++) {
var initialOperator = initialOperators[i];
var resultOperator = resultOperators[i];
- await resolveTestUnit('''
+ await resolveTestCode('''
bool main(int a, int b) {
return a $initialOperator b;
}
@@ -39,7 +39,7 @@
}
Future<void> test_extended_mixOperator_1() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
1 * 2 * 3 + 4;
}
@@ -52,7 +52,7 @@
}
Future<void> test_extended_mixOperator_2() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
1 + 2 - 3 + 4;
}
@@ -65,7 +65,7 @@
}
Future<void> test_extended_sameOperator_afterFirst() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
1 + 2 + 3;
}
@@ -78,7 +78,7 @@
}
Future<void> test_extended_sameOperator_afterSecond() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
1 + 2 + 3;
}
@@ -91,7 +91,7 @@
}
Future<void> test_extraLength() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
111 + 222;
}
@@ -100,7 +100,7 @@
}
Future<void> test_onOperand() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
111 + 222;
}
@@ -109,7 +109,7 @@
}
Future<void> test_selectionWithBinary() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
1 + 2 + 3;
}
@@ -118,7 +118,7 @@
}
Future<void> test_simple_afterOperator() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
1 + 2;
}
@@ -131,7 +131,7 @@
}
Future<void> test_simple_beforeOperator() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
1 + 2;
}
@@ -144,7 +144,7 @@
}
Future<void> test_simple_fullSelection() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
1 + 2;
}
@@ -160,7 +160,7 @@
}
Future<void> test_simple_withLength() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
1 + 2;
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_children_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_children_test.dart
index 3884824..1bac364 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_children_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_children_test.dart
@@ -29,7 +29,7 @@
Future<void> test_childUnresolved() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
build() {
return Row(
@@ -41,7 +41,7 @@
}
Future<void> test_multiLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
build() {
return Scaffold(
@@ -76,7 +76,7 @@
Future<void> test_newlineChild() async {
// This case could occur with deeply nested constructors, common in Flutter.
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
build() {
return Scaffold(
@@ -110,7 +110,7 @@
}
Future<void> test_notOnChild() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
build() {
return Scaffold(
@@ -124,7 +124,7 @@
}
Future<void> test_singleLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
build() {
return Scaffold(
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateful_widget_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateful_widget_test.dart
index 879fef5..426fa2b 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateful_widget_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_convert_to_stateful_widget_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_empty() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
import 'package:flutter/material.dart';
class /*caret*/MyWidget extends StatelessWidget {
@@ -56,7 +56,7 @@
}
Future<void> test_empty_typeParam() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
import 'package:flutter/material.dart';
class /*caret*/MyWidget<T> extends StatelessWidget {
@@ -84,7 +84,7 @@
}
Future<void> test_fields() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
import 'package:flutter/material.dart';
class /*caret*/MyWidget extends StatelessWidget {
@@ -164,7 +164,7 @@
}
Future<void> test_getters() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
import 'package:flutter/material.dart';
class /*caret*/MyWidget extends StatelessWidget {
@@ -222,7 +222,7 @@
}
Future<void> test_methods() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
import 'package:flutter/material.dart';
class /*caret*/MyWidget extends StatelessWidget {
@@ -311,7 +311,7 @@
}
Future<void> test_notClass() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
/*caret*/main() {}
''');
@@ -319,7 +319,7 @@
}
Future<void> test_notStatelessWidget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
class /*caret*/MyWidget extends Text {
MyWidget() : super('');
@@ -329,7 +329,7 @@
}
Future<void> test_notWidget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
class /*caret*/MyWidget {}
''');
@@ -337,7 +337,7 @@
}
Future<void> test_simple() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
import 'package:flutter/material.dart';
class /*caret*/MyWidget extends StatelessWidget {
@@ -389,7 +389,7 @@
}
Future<void> test_tail() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
import 'package:flutter/material.dart';
class /*caret*/MyWidget extends StatelessWidget {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_move_down_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_move_down_test.dart
index 12d8ac8..3ed98b5 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_move_down_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_move_down_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_first() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
@@ -56,7 +56,7 @@
}
Future<void> test_last() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
@@ -72,7 +72,7 @@
}
Future<void> test_notInList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Center(
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_move_up_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_move_up_test.dart
index b2e3386..905d316 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_move_up_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_move_up_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_first() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
@@ -44,7 +44,7 @@
}
Future<void> test_last() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
@@ -72,7 +72,7 @@
}
Future<void> test_notInList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Center(
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_remove_widget_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_remove_widget_test.dart
index c470789..f6ed88f 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_remove_widget_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_remove_widget_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_childIntoChild_multiLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
@@ -64,7 +64,7 @@
}
Future<void> test_childIntoChild_singleLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Padding(
@@ -88,7 +88,7 @@
}
Future<void> test_childIntoChildren() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
@@ -124,7 +124,7 @@
}
Future<void> test_childrenMultipleIntoChild() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Center(
@@ -141,7 +141,7 @@
}
Future<void> test_childrenOneIntoChild() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Center(
@@ -164,7 +164,7 @@
}
Future<void> test_childrenOneIntoReturn() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
return /*caret*/Column(
@@ -183,7 +183,7 @@
}
Future<void> test_intoChildren() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_surround_with_set_state_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_surround_with_set_state_test.dart
index 3938f65..3445e2c 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_surround_with_set_state_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_surround_with_set_state_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_outsideState() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class Stateless {
@@ -47,7 +47,7 @@
}
Future<void> test_stateSubclass() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class MyState extends State {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_child_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_child_test.dart
index 6ebbd20..babc107 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_child_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_child_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_aroundCenter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
build() {
return Scaffold(
@@ -67,7 +67,7 @@
}
Future<void> test_notFormatted() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
class Foo extends StatefulWidget {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_parent_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_parent_test.dart
index dbd59ca..197470b 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_parent_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_swap_with_parent_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_inCenter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
build() {
return Scaffold(
@@ -67,7 +67,7 @@
}
Future<void> test_notFormatted() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
class Foo extends StatefulWidget {
@@ -117,7 +117,7 @@
}
Future<void> test_outerIsInChildren() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_center_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_center_test.dart
index b2037c6..877ffb7 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_center_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_center_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_aroundCenter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
main() {
@@ -40,7 +40,7 @@
}
Future<void> test_aroundContainer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
main() {
@@ -59,7 +59,7 @@
}
Future<void> test_aroundNamedConstructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class MyWidget extends StatelessWidget {
@@ -88,7 +88,7 @@
}
Future<void> test_assignment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
@@ -107,7 +107,7 @@
}
Future<void> test_expressionFunctionBody() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
main() => /*caret*/Container();
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_column_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_column_test.dart
index d707097..fc79cb7 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_column_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_column_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_controlFlowCollections_if() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
Widget build(bool b) {
@@ -61,7 +61,7 @@
}
Future<void> test_coveredByWidget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
@@ -90,7 +90,7 @@
}
Future<void> test_coversWidgets() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
@@ -127,7 +127,7 @@
}
Future<void> test_endOfWidgetName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_container_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_container_test.dart
index 39be197..04702fa 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_container_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_container_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_aroundContainer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
return /*caret*/Container();
@@ -38,7 +38,7 @@
}
Future<void> test_aroundText() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
/*caret*/Text('a');
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_generic_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_generic_test.dart
index 347d013..e8df73f 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_generic_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_generic_test.dart
@@ -28,14 +28,14 @@
}
Future<void> test_minimal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
/*caret*/x(){}
''');
await assertNoAssist();
}
Future<void> test_multiLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
build() {
return Container(
@@ -72,7 +72,7 @@
Future<void> test_multiLine_inListLiteral() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
build() {
return Container(
@@ -92,7 +92,7 @@
}
Future<void> test_multiLines() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
main() {
@@ -131,7 +131,7 @@
}
Future<void> test_multiLines_eol2() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {\r
main() {\r
@@ -170,7 +170,7 @@
}
Future<void> test_prefixedIdentifier_identifier() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
abstract class Foo extends Widget {
@@ -195,7 +195,7 @@
}
Future<void> test_prefixedIdentifier_prefix() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
abstract class Foo extends Widget {
@@ -220,7 +220,7 @@
}
Future<void> test_singleLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
main() {
@@ -233,7 +233,7 @@
}
Future<void> test_singleLine1() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
main() {
@@ -252,7 +252,7 @@
}
Future<void> test_singleLine2() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
main() {
@@ -271,7 +271,7 @@
}
Future<void> test_variable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
main() {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_padding_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_padding_test.dart
index 1470d12..685b2df 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_padding_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_padding_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_aroundContainer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
main() {
@@ -50,7 +50,7 @@
}
Future<void> test_aroundPadding() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
main() {
@@ -65,7 +65,7 @@
}
Future<void> test_inConstantContext() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
Widget build() {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_row_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_row_test.dart
index c28ab00..a9e6554 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_row_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_row_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_twoWidgets() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_sized_box_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_sized_box_test.dart
index cff7743..74c6918 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_sized_box_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_sized_box_test.dart
@@ -30,7 +30,7 @@
}
Future<void> test_aroundContainer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
main() {
@@ -49,7 +49,7 @@
}
Future<void> test_aroundNamedConstructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class MyWidget extends StatelessWidget {
@@ -78,7 +78,7 @@
}
Future<void> test_aroundSizedBox() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
main() {
@@ -90,7 +90,7 @@
}
Future<void> test_assignment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
@@ -109,7 +109,7 @@
}
Future<void> test_expressionFunctionBody() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class FakeFlutter {
main() => /*caret*/Container();
diff --git a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_stream_builder_test.dart b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_stream_builder_test.dart
index 61b04bf..4c32342 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_stream_builder_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/flutter_wrap_stream_builder_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_aroundStreamBuilder() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
@@ -42,7 +42,7 @@
}
Future<void> test_aroundText() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart b/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart
index bb801c2..e00ee78 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/import_add_show_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.IMPORT_ADD_SHOW;
Future<void> test_hasShow() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' show pi;
main() {
pi;
@@ -30,7 +30,7 @@
}
Future<void> test_hasUnresolvedIdentifier() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math';
main(x) {
pi;
@@ -47,7 +47,7 @@
}
Future<void> test_onDirective() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math';
main() {
pi;
@@ -66,7 +66,7 @@
}
Future<void> test_onUri() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math';
main() {
pi;
@@ -88,7 +88,7 @@
addSource('/home/test/lib/a.dart', r'''
void set setter(int i) {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'a.dart';
main() {
@@ -106,14 +106,14 @@
Future<void> test_unresolvedUri() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
import '/no/such/lib.dart';
''');
await assertNoAssistAt('import ');
}
Future<void> test_unused() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math';
''');
await assertNoAssistAt('import ');
diff --git a/pkg/analysis_server/test/src/services/correction/assist/inline_invocation_test.dart b/pkg/analysis_server/test/src/services/correction/assist/inline_invocation_test.dart
index f00cf69..23749ff 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/inline_invocation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/inline_invocation_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.INLINE_INVOCATION;
Future<void> test_add_emptyTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = []..ad/*caret*/d('a')..add('b');
''');
await assertHasAssist('''
@@ -32,14 +32,14 @@
Future<void> test_add_emptyTarget_noAssistWithLint() async {
createAnalysisOptionsFile(lints: [LintNames.prefer_inlined_adds]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = []..ad/*caret*/d('a')..add('b');
''');
await assertNoAssist();
}
Future<void> test_add_nonEmptyTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = ['a']..ad/*caret*/d('b')..add('c');
''');
await assertHasAssist('''
@@ -48,7 +48,7 @@
}
Future<void> test_add_nonLiteralArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var e = 'b';
var l = ['a']..add/*caret*/(e);
''');
@@ -59,7 +59,7 @@
}
Future<void> test_add_nonLiteralTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l1 = [];
var l2 = l1..ad/*caret*/d('b')..add('c');
''');
@@ -67,14 +67,14 @@
}
Future<void> test_add_notFirst() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = ['a']..add('b')../*caret*/add('c');
''');
await assertNoAssist();
}
Future<void> test_addAll_emptyTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = []..add/*caret*/All(['a'])..addAll(['b']);
''');
await assertHasAssist('''
@@ -85,14 +85,14 @@
Future<void> test_addAll_emptyTarget_noAssistWithLint() async {
createAnalysisOptionsFile(lints: [LintNames.prefer_inlined_adds]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = []..add/*caret*/All(['a'])..addAll(['b']);
''');
await assertNoAssist();
}
Future<void> test_addAll_nonEmptyTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = ['a']..add/*caret*/All(['b'])..addAll(['c']);
''');
await assertHasAssist('''
@@ -101,7 +101,7 @@
}
Future<void> test_addAll_nonLiteralArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l1 = <String>[];
var l2 = ['a']..add/*caret*/All(l1);
''');
@@ -109,7 +109,7 @@
}
Future<void> test_addAll_nonLiteralTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l1 = [];
var l2 = l1..addAl/*caret*/l(['b'])..addAll(['c']);
''');
@@ -117,7 +117,7 @@
}
Future<void> test_addAll_notFirst() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = ['a']..addAll(['b'])../*caret*/addAll(['c']);
''');
await assertNoAssist();
diff --git a/pkg/analysis_server/test/src/services/correction/assist/introduce_local_cast_type_test.dart b/pkg/analysis_server/test/src/services/correction/assist/introduce_local_cast_type_test.dart
index 33c0c35..784efb9 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/introduce_local_cast_type_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/introduce_local_cast_type_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.INTRODUCE_LOCAL_CAST_TYPE;
Future<void> test_introduceLocalTestedType_if_is() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyTypeName {}
main(p) {
if (p is MyTypeName) {
@@ -49,7 +49,7 @@
}
Future<void> test_introduceLocalTestedType_if_isNot() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyTypeName {}
main(p) {
if (p is! MyTypeName) {
@@ -77,7 +77,7 @@
}
Future<void> test_introduceLocalTestedType_notBlock() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
if (p is String)
print('not a block');
@@ -87,7 +87,7 @@
}
Future<void> test_introduceLocalTestedType_notIsExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
if (p == null) {
}
@@ -97,7 +97,7 @@
}
Future<void> test_introduceLocalTestedType_notStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
bool b;
C(v) : b = v is int;
@@ -106,7 +106,7 @@
}
Future<void> test_introduceLocalTestedType_while() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
while (p is String) {
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/invert_if_statement_test.dart b/pkg/analysis_server/test/src/services/correction/assist/invert_if_statement_test.dart
index 81f1950..b86a190 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/invert_if_statement_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/invert_if_statement_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.INVERT_IF_STATEMENT;
Future<void> test_blocks() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (true) {
0;
@@ -41,7 +41,7 @@
}
Future<void> test_statements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (true)
0;
diff --git a/pkg/analysis_server/test/src/services/correction/assist/join_if_with_inner_test.dart b/pkg/analysis_server/test/src/services/correction/assist/join_if_with_inner_test.dart
index bd1cf73..3c19528 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/join_if_with_inner_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/join_if_with_inner_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.JOIN_IF_WITH_INNER;
Future<void> test_conditionAndOr() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2 || 3 == 3) {
@@ -39,7 +39,7 @@
}
Future<void> test_conditionInvocation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (isCheck()) {
if (2 == 2) {
@@ -60,7 +60,7 @@
}
Future<void> test_conditionOrAnd() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1 || 2 == 2) {
if (3 == 3) {
@@ -79,7 +79,7 @@
}
Future<void> test_innerNotIf() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
print(0);
@@ -90,7 +90,7 @@
}
Future<void> test_innerWithElse() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2) {
@@ -105,7 +105,7 @@
}
Future<void> test_onCondition() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2) {
@@ -124,7 +124,7 @@
}
Future<void> test_simpleConditions_block_block() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2) {
@@ -143,7 +143,7 @@
}
Future<void> test_simpleConditions_block_single() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2)
@@ -161,7 +161,7 @@
}
Future<void> test_simpleConditions_single_blockMulti() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2) {
@@ -184,7 +184,7 @@
}
Future<void> test_simpleConditions_single_blockOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1)
if (2 == 2) {
@@ -202,7 +202,7 @@
}
Future<void> test_statementAfterInner() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2) {
@@ -216,7 +216,7 @@
}
Future<void> test_statementBeforeInner() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
print(1);
@@ -230,7 +230,7 @@
}
Future<void> test_targetNotIf() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print(0);
}
@@ -239,7 +239,7 @@
}
Future<void> test_targetWithElse() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2) {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/join_if_with_outer_test.dart b/pkg/analysis_server/test/src/services/correction/assist/join_if_with_outer_test.dart
index 79d87b5..a31c29e 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/join_if_with_outer_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/join_if_with_outer_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.JOIN_IF_WITH_OUTER;
Future<void> test_conditionAndOr() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2 || 3 == 3) {
@@ -39,7 +39,7 @@
}
Future<void> test_conditionInvocation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (isCheck()) {
@@ -60,7 +60,7 @@
}
Future<void> test_conditionOrAnd() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1 || 2 == 2) {
if (3 == 3) {
@@ -79,7 +79,7 @@
}
Future<void> test_onCondition() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2) {
@@ -98,7 +98,7 @@
}
Future<void> test_outerNotIf() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
print(0);
@@ -109,7 +109,7 @@
}
Future<void> test_outerWithElse() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2) {
@@ -124,7 +124,7 @@
}
Future<void> test_simpleConditions_block_block() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2) {
@@ -143,7 +143,7 @@
}
Future<void> test_simpleConditions_block_single() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2)
@@ -161,7 +161,7 @@
}
Future<void> test_simpleConditions_single_blockMulti() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2) {
@@ -184,7 +184,7 @@
}
Future<void> test_simpleConditions_single_blockOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1)
if (2 == 2) {
@@ -202,7 +202,7 @@
}
Future<void> test_statementAfterInner() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2) {
@@ -216,7 +216,7 @@
}
Future<void> test_statementBeforeInner() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
print(1);
@@ -230,7 +230,7 @@
}
Future<void> test_targetNotIf() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print(0);
}
@@ -239,7 +239,7 @@
}
Future<void> test_targetWithElse() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1) {
if (2 == 2) {
diff --git a/pkg/analysis_server/test/src/services/correction/assist/join_variable_declaration_test.dart b/pkg/analysis_server/test/src/services/correction/assist/join_variable_declaration_test.dart
index ac731da..8b885c8 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/join_variable_declaration_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/join_variable_declaration_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.JOIN_VARIABLE_DECLARATION;
Future<void> test_onAssignment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v;
v = 1;
@@ -34,7 +34,7 @@
}
Future<void> test_onAssignment_hasInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = 1;
v = 2;
@@ -44,7 +44,7 @@
}
Future<void> test_onAssignment_notAdjacent() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v;
var bar;
@@ -55,7 +55,7 @@
}
Future<void> test_onAssignment_notAssignment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v;
v += 1;
@@ -65,7 +65,7 @@
}
Future<void> test_onAssignment_notDeclaration() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(var v) {
v = 1;
}
@@ -74,7 +74,7 @@
}
Future<void> test_onAssignment_notLeftArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v;
1 + v; // marker
@@ -84,7 +84,7 @@
}
Future<void> test_onAssignment_notOneVariable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v, v2;
v = 1;
@@ -95,7 +95,7 @@
Future<void> test_onAssignment_notResolved() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v;
x = 1;
@@ -105,7 +105,7 @@
}
Future<void> test_onAssignment_notSameBlock() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v;
{
@@ -117,7 +117,7 @@
}
Future<void> test_onDeclaration_hasInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = 1;
v = 2;
@@ -127,7 +127,7 @@
}
Future<void> test_onDeclaration_lastStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (true)
var v;
@@ -137,7 +137,7 @@
}
Future<void> test_onDeclaration_nextNotAssignmentExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v;
42;
@@ -147,7 +147,7 @@
}
Future<void> test_onDeclaration_nextNotExpressionStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v;
if (true) return;
@@ -157,7 +157,7 @@
}
Future<void> test_onDeclaration_nextNotPureAssignment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v;
v += 1;
@@ -167,7 +167,7 @@
}
Future<void> test_onDeclaration_notOneVariable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v, v2;
v = 1;
@@ -177,7 +177,7 @@
}
Future<void> test_onDeclaration_onName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v;
v = 1;
@@ -191,7 +191,7 @@
}
Future<void> test_onDeclaration_onType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int v;
v = 1;
@@ -205,7 +205,7 @@
}
Future<void> test_onDeclaration_onVar() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v;
v = 1;
diff --git a/pkg/analysis_server/test/src/services/correction/assist/remove_type_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/assist/remove_type_annotation_test.dart
index 0a9f0b2..a1efc00 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/remove_type_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/remove_type_annotation_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.REMOVE_TYPE_ANNOTATION;
Future<void> test_classField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int v = 1;
}
@@ -33,7 +33,7 @@
}
Future<void> test_classField_final() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
final int v = 1;
}
@@ -46,7 +46,7 @@
}
Future<void> test_field_noInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int v;
}
@@ -55,7 +55,7 @@
}
Future<void> test_instanceCreation_freeStanding() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
main() {
@@ -66,7 +66,7 @@
}
Future<void> test_localVariable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int a = 1, b = 2;
}
@@ -79,7 +79,7 @@
}
Future<void> test_localVariable_const() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
const int v = 1;
}
@@ -92,7 +92,7 @@
}
Future<void> test_localVariable_final() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
final int v = 1;
}
@@ -105,7 +105,7 @@
}
Future<void> test_localVariable_noInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int v;
}
@@ -114,7 +114,7 @@
}
Future<void> test_localVariable_onInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
final int v = 1;
}
@@ -123,7 +123,7 @@
}
Future<void> test_loopVariable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
for(int i = 0; i < 3; i++) {}
}
@@ -136,7 +136,7 @@
}
Future<void> test_loopVariable_nested() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = () {
for (int x in <int>[]) {}
@@ -153,7 +153,7 @@
}
Future<void> test_loopVariable_noType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
for(var i = 0; i < 3; i++) {}
}
@@ -162,7 +162,7 @@
}
Future<void> test_topLevelVariable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
int V = 1;
''');
await assertHasAssistAt('int ', '''
@@ -171,7 +171,7 @@
}
Future<void> test_topLevelVariable_final() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
final int V = 1;
''');
await assertHasAssistAt('int ', '''
@@ -181,7 +181,7 @@
Future<void> test_topLevelVariable_noInitializer() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
int v;
''');
await assertNoAssistAt('v;');
@@ -189,7 +189,7 @@
Future<void> test_topLevelVariable_syntheticName() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
MyType
''');
await assertNoAssistAt('MyType');
diff --git a/pkg/analysis_server/test/src/services/correction/assist/replace_conditional_with_if_else_test.dart b/pkg/analysis_server/test/src/services/correction/assist/replace_conditional_with_if_else_test.dart
index 2085f59..1e81306 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/replace_conditional_with_if_else_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/replace_conditional_with_if_else_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.REPLACE_CONDITIONAL_WITH_IF_ELSE;
Future<void> test_assignment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v;
v = true ? 111 : 222;
@@ -51,14 +51,14 @@
}
Future<void> test_noEnclosingStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var v = true ? 111 : 222;
''');
await assertNoAssistAt('? 111');
}
Future<void> test_notConditional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = 42;
}
@@ -67,7 +67,7 @@
}
Future<void> test_return() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
return true ? 111 : 222;
}
@@ -84,7 +84,7 @@
}
Future<void> test_variableDeclaration() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int a = 1, vvv = true ? 111 : 222, b = 2;
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/replace_if_else_with_conditional_test.dart b/pkg/analysis_server/test/src/services/correction/assist/replace_if_else_with_conditional_test.dart
index d6139ed..7b8f335 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/replace_if_else_with_conditional_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/replace_if_else_with_conditional_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.REPLACE_IF_ELSE_WITH_CONDITIONAL;
Future<void> test_assignment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int vvv;
if (true) {
@@ -39,7 +39,7 @@
}
Future<void> test_expressionVsReturn() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (true) {
print(42);
@@ -52,7 +52,7 @@
}
Future<void> test_notIfStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print(0);
}
@@ -61,7 +61,7 @@
}
Future<void> test_notSingleStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int vvv;
if (true) {
@@ -77,7 +77,7 @@
}
Future<void> test_return() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (true) {
return 111;
diff --git a/pkg/analysis_server/test/src/services/correction/assist/replace_with_var_test.dart b/pkg/analysis_server/test/src/services/correction/assist/replace_with_var_test.dart
index 19eb57a..6ab4ad8 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/replace_with_var_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/replace_with_var_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.REPLACE_WITH_VAR;
Future<void> test_for() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int> list) {
for (/*caret*/int i = 0; i < list.length; i++) {
print(i);
@@ -37,7 +37,7 @@
}
Future<void> test_forEach() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int> list) {
for (/*caret*/int i in list) {
print(i);
@@ -54,7 +54,7 @@
}
Future<void> test_generic_instanceCreation_withArguments() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
C<int> f() {
/*caret*/C<int> c = C<int>();
return c;
@@ -71,7 +71,7 @@
}
Future<void> test_generic_instanceCreation_withoutArguments() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
C<int> f() {
/*caret*/C<int> c = C();
return c;
@@ -88,7 +88,7 @@
}
Future<void> test_generic_listLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
List f() {
/*caret*/List<int> l = [];
return l;
@@ -103,7 +103,7 @@
}
Future<void> test_generic_mapLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Map f() {
/*caret*/Map<String, int> m = {};
return m;
@@ -118,7 +118,7 @@
}
Future<void> test_generic_setLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Set f() {
/*caret*/Set<int> s = {};
return s;
@@ -133,7 +133,7 @@
}
Future<void> test_generic_setLiteral_ambiguous() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Set f() {
/*caret*/Set s = {};
return s;
@@ -143,7 +143,7 @@
}
Future<void> test_moreGeneral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
num f() {
/*caret*/num n = 0;
return n;
@@ -153,7 +153,7 @@
}
Future<void> test_noInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
String f() {
/*caret*/String s;
s = '';
@@ -164,7 +164,7 @@
}
Future<void> test_noType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
String f() {
/*caret*/var s = '';
return s;
@@ -174,7 +174,7 @@
}
Future<void> test_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
String f() {
/*caret*/String s = '';
return s;
diff --git a/pkg/analysis_server/test/src/services/correction/assist/shadow_field_test.dart b/pkg/analysis_server/test/src/services/correction/assist/shadow_field_test.dart
index aa74274..f13b966 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/shadow_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/shadow_field_test.dart
@@ -22,7 +22,7 @@
AssistKind get kind => DartAssistKind.SHADOW_FIELD;
Future<void> test_is_assigned() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
num f = 0;
@@ -39,7 +39,7 @@
}
Future<void> test_is_noBlock_while() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
num f = 0;
@@ -55,7 +55,7 @@
}
Future<void> test_is_referencedViaThis() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
num f = 0;
@@ -81,7 +81,7 @@
}
Future<void> test_is_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
num f = 0;
@@ -111,7 +111,7 @@
class ShadowFieldWithNullSafetyTest extends ShadowFieldTest
with WithNullSafetyMixin {
Future<void> test_notNull() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int? f;
@@ -137,7 +137,7 @@
}
Future<void> test_notNull_assigned() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int? f;
@@ -154,7 +154,7 @@
}
Future<void> test_notNull_referencedViaThis() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int? f;
diff --git a/pkg/analysis_server/test/src/services/correction/assist/sort_child_property_last_test.dart b/pkg/analysis_server/test/src/services/correction/assist/sort_child_property_last_test.dart
index 86b6655..2aea7cc 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/sort_child_property_last_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/sort_child_property_last_test.dart
@@ -29,7 +29,7 @@
}
Future<void> test_already_sorted() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
@@ -46,7 +46,7 @@
}
Future<void> test_already_sorted_one_prop() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
@@ -62,7 +62,7 @@
}
Future<void> test_no_children() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
@@ -74,7 +74,7 @@
}
Future<void> test_sort() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
@@ -106,7 +106,7 @@
Future<void> test_sort_noAssistWithLint() async {
createAnalysisOptionsFile(lints: [LintNames.sort_child_properties_last]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
diff --git a/pkg/analysis_server/test/src/services/correction/assist/split_and_condition_test.dart b/pkg/analysis_server/test/src/services/correction/assist/split_and_condition_test.dart
index 4371672..2e96ea7 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/split_and_condition_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/split_and_condition_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.SPLIT_AND_CONDITION;
Future<void> test_hasElse() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1 && 2 == 2) {
print(1);
@@ -33,7 +33,7 @@
}
Future<void> test_innerAndExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1 && 2 == 2 && 3 == 3) {
print(0);
@@ -52,7 +52,7 @@
}
Future<void> test_notAnd() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1 || 2 == 2) {
print(0);
@@ -63,7 +63,7 @@
}
Future<void> test_notOnOperator() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1 && 2 == 2) {
print(0);
@@ -75,7 +75,7 @@
}
Future<void> test_notPartOfIf() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print(1 == 1 && 2 == 2);
}
@@ -84,7 +84,7 @@
}
Future<void> test_notTopLevelAnd() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (true || (1 == 1 && 2 == 2)) {
print(0);
@@ -99,7 +99,7 @@
}
Future<void> test_selectionTooLarge() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (1 == 1
// start
@@ -116,7 +116,7 @@
}
Future<void> test_thenBlock() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (true && false) {
print(0);
@@ -141,7 +141,7 @@
}
Future<void> test_thenStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (true && false)
print(0);
diff --git a/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart b/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart
index 07d4997..255f6e5 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/split_variable_declaration_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.SPLIT_VARIABLE_DECLARATION;
Future<void> test_const() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
const v = 1;
}
@@ -29,7 +29,7 @@
}
Future<void> test_final() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
final v = 1;
}
@@ -38,7 +38,7 @@
}
Future<void> test_notOneVariable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = 1, v2;
}
@@ -47,7 +47,7 @@
}
Future<void> test_onName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = 1;
}
@@ -61,7 +61,7 @@
}
Future<void> test_onName_functionStatement_noType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() => 1;
main() {
var v = f();
@@ -77,7 +77,7 @@
}
Future<void> test_onType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int v = 1;
}
@@ -92,7 +92,7 @@
@failingTest
Future<void> test_onType_prefixedByComment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
/*comment*/int v = 1;
}
@@ -106,7 +106,7 @@
}
Future<void> test_onVar() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var v = 1;
}
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_block_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_block_test.dart
index 3d35b43..54ef449 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_block_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_block_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.SURROUND_WITH_BLOCK;
Future<void> test_notStatementInBlock() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
while (true)
// start
@@ -32,7 +32,7 @@
}
Future<void> test_twoStatements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
// start
print(0);
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_do_while_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_do_while_test.dart
index 3a1f308..d6ad18f 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_do_while_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_do_while_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.SURROUND_WITH_DO_WHILE;
Future<void> test_twoStatements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
// start
print(0);
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_in_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_in_test.dart
index 0dd79ed..6b7ca74 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_in_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_in_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.SURROUND_WITH_FOR_IN;
Future<void> test_twoStatements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
// start
print(0);
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_test.dart
index d946e3b..ca39826 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_for_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.SURROUND_WITH_FOR;
Future<void> test_twoStatements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
// start
print(0);
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_if_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_if_test.dart
index 288aae5..91ed08c 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_if_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_if_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.SURROUND_WITH_IF;
Future<void> test_twoStatements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
// start
print(0);
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_catch_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_catch_test.dart
index 2b3121d..3fa1377 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_catch_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_catch_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.SURROUND_WITH_TRY_CATCH;
Future<void> test_twoStatements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
// start
print(0);
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_finally_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_finally_test.dart
index dc9a109..e6d5010 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_finally_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_try_finally_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.SURROUND_WITH_TRY_FINALLY;
Future<void> test_twoStatements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
// start
print(0);
diff --git a/pkg/analysis_server/test/src/services/correction/assist/surround_with_while_test.dart b/pkg/analysis_server/test/src/services/correction/assist/surround_with_while_test.dart
index 42502fe..24eb591 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/surround_with_while_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/surround_with_while_test.dart
@@ -20,7 +20,7 @@
AssistKind get kind => DartAssistKind.SURROUND_WITH_WHILE;
Future<void> test_twoStatements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
// start
print(0);
diff --git a/pkg/analysis_server/test/src/services/correction/assist/use_curly_braces_test.dart b/pkg/analysis_server/test/src/services/correction/assist/use_curly_braces_test.dart
index 032f5ee..93d28d6 100644
--- a/pkg/analysis_server/test/src/services/correction/assist/use_curly_braces_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/assist/use_curly_braces_test.dart
@@ -21,7 +21,7 @@
AssistKind get kind => DartAssistKind.USE_CURLY_BRACES;
Future<void> test_do_block() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
/*caret*/do {
print(0);
@@ -32,7 +32,7 @@
}
Future<void> test_do_body_middle() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
do print/*caret*/(0); while (true);
}
@@ -47,7 +47,7 @@
}
Future<void> test_do_body_start() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
do /*caret*/print(0); while (true);
}
@@ -62,7 +62,7 @@
}
Future<void> test_do_condition() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
do print(0); while (/*caret*/true);
}
@@ -77,7 +77,7 @@
}
Future<void> test_do_end() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
do print(0); while (true);/*caret*/
}
@@ -92,7 +92,7 @@
}
Future<void> test_do_keyword_do() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
/*caret*/do print(0); while (true);
}
@@ -107,7 +107,7 @@
}
Future<void> test_do_keyword_while() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
do print(0); /*caret*/while (true);
}
@@ -122,7 +122,7 @@
}
Future<void> test_for_body_end() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
for (;;) print(0);/*caret*/
}
@@ -137,7 +137,7 @@
}
Future<void> test_for_body_middle() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
for (;;) print/*caret*/(0);
}
@@ -152,7 +152,7 @@
}
Future<void> test_for_body_start() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
for (;;) /*caret*/print(0);
}
@@ -167,7 +167,7 @@
}
Future<void> test_for_condition() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
for (/*caret*/;;) print(0);
}
@@ -182,7 +182,7 @@
}
Future<void> test_for_keyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
/*caret*/for (;;) print(0);
}
@@ -197,7 +197,7 @@
}
Future<void> test_for_keyword_block() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
/*caret*/for (;;) {
print(0);
@@ -208,7 +208,7 @@
}
Future<void> test_if_else_keyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(int a) {
if (a == 0)
print(0);
@@ -227,7 +227,7 @@
}
Future<void> test_if_else_statement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(int a) {
if (a == 0)
print(0);
@@ -246,7 +246,7 @@
}
Future<void> test_if_keyword_blockBoth() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(int a) {
/*caret*/if (a == 0) {
print(0);
@@ -259,7 +259,7 @@
}
Future<void> test_if_keyword_blockElse() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(int a) {
/*caret*/if (a == 0) print(0);
else {
@@ -279,7 +279,7 @@
}
Future<void> test_if_keyword_blockThen() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(int a) {
/*caret*/if (a == 0) {
print(0);
@@ -290,7 +290,7 @@
}
Future<void> test_if_keyword_withElse() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(int a) {
/*caret*/if (a == 0)
print(0);
@@ -309,7 +309,7 @@
}
Future<void> test_if_keyword_withoutElse() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(int a) {
/*caret*/if (a == 0)
print(0);
@@ -325,7 +325,7 @@
}
Future<void> test_if_then_withElse() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(int a) {
if (a == 0)
/*caret*/print(0);
@@ -342,7 +342,7 @@
}
Future<void> test_if_then_withoutElse() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(int a) {
if (a == 0) /*caret*/print(0);
}
@@ -360,7 +360,7 @@
createAnalysisOptionsFile(
lints: [LintNames.curly_braces_in_flow_control_structures]);
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
do print/*caret*/(0); while (true);
}
@@ -369,7 +369,7 @@
}
Future<void> test_while_body_end() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
while (true) print(0);/*caret*/
}
@@ -384,7 +384,7 @@
}
Future<void> test_while_body_middle() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
while (true) print/*caret*/(0);
}
@@ -399,7 +399,7 @@
}
Future<void> test_while_body_start() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
while (true) /*caret*/print(0);
}
@@ -414,7 +414,7 @@
}
Future<void> test_while_condition() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
while (/*caret*/true) print(0);
}
@@ -429,7 +429,7 @@
}
Future<void> test_while_keyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
/*caret*/while (true) print(0);
}
@@ -444,7 +444,7 @@
}
Future<void> test_while_keyword_block() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
/*caret*/while (true) {
print(0);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_async_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_async_test.dart
index d47cf3a..8047f30 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_async_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_async_test.dart
@@ -24,7 +24,7 @@
FixKind get kind => DartFixKind.ADD_ASYNC;
Future<void> test_asyncFor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void main(Stream<String> names) {
await for (String name in names) {
print(name);
@@ -41,7 +41,7 @@
}
Future<void> test_blockFunctionBody_function() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo() {}
main() {
await foo();
@@ -56,7 +56,7 @@
}
Future<void> test_blockFunctionBody_getter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
int get foo => null;
int f() {
await foo;
@@ -75,7 +75,7 @@
}
Future<void> test_closure() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void takeFutureCallback(Future callback()) {}
void doStuff() => takeFutureCallback(() => await 1);
@@ -90,7 +90,7 @@
}
Future<void> test_expressionFunctionBody() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo() {}
main() => await foo();
''');
@@ -101,14 +101,14 @@
}
Future<void> test_nullFunctionBody() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var F = await;
''');
await assertNoFix();
}
Future<void> test_returnFuture_alreadyFuture() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo() {}
Future<int> main() {
await foo();
@@ -127,7 +127,7 @@
}
Future<void> test_returnFuture_dynamic() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo() {}
dynamic main() {
await foo();
@@ -144,7 +144,7 @@
}
Future<void> test_returnFuture_nonFuture() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo() {}
int main() {
await foo();
@@ -161,7 +161,7 @@
}
Future<void> test_returnFuture_noType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo() {}
main() {
await foo();
@@ -187,7 +187,7 @@
String get lintCode => LintNames.avoid_returning_null_for_future;
Future<void> test_asyncFor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Future<String> f() {
return null;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_await_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_await_test.dart
index b54c20d..31ce0c6 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_await_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_await_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.unawaited_futures;
Future<void> test_intLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Future doSomething() => new Future.value('');
void main() async {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_const_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_const_test.dart
index f04807c..bcb2893 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_const_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_const_test.dart
@@ -25,7 +25,7 @@
String get lintCode => LintNames.prefer_const_constructors;
Future<void> test_new() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
const C();
}
@@ -39,7 +39,7 @@
}
Future<void> test_noKeyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
const C();
}
@@ -77,7 +77,7 @@
}
Future<void> test_constConstructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
@immutable
@@ -96,7 +96,7 @@
}
Future<void> test_constConstructorWithComment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
@immutable
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_curly_braces_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_curly_braces_test.dart
index ab16f8e..18da15e 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_curly_braces_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_curly_braces_test.dart
@@ -26,7 +26,7 @@
// More coverage in the `use_curly_braces_test.dart` assist test.
Future<void> test_do_block() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
do print(0); while (true);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_diagnostic_property_reference_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_diagnostic_property_reference_test.dart
index 864433b..7df0970 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_diagnostic_property_reference_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_diagnostic_property_reference_test.dart
@@ -34,7 +34,7 @@
Future<void> test_boolField() async {
// todo(pq): when linter 0.1.118 is integrated, update DiagnosticableMixin to Diagnosticable
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -68,7 +68,7 @@
}
Future<void> test_boolField_empty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -94,7 +94,7 @@
}
Future<void> test_boolField_empty_customParamName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -120,7 +120,7 @@
}
Future<void> test_boolGetter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -150,7 +150,7 @@
}
Future<void> test_colorField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
@@ -180,7 +180,7 @@
}
Future<void> test_doubleField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -208,7 +208,7 @@
}
Future<void> test_dynamicField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -236,7 +236,7 @@
}
Future<void> test_enumField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -266,7 +266,7 @@
}
Future<void> test_functionField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
@@ -298,7 +298,7 @@
}
Future<void> test_intField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -326,7 +326,7 @@
}
Future<void> test_iterableField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -354,7 +354,7 @@
}
Future<void> test_listField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -386,7 +386,7 @@
flutter: true,
vector_math: true,
);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:vector_math/vector_math_64.dart';
@@ -416,7 +416,7 @@
}
Future<void> test_objectField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -444,7 +444,7 @@
}
Future<void> test_stringField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -472,7 +472,7 @@
}
Future<void> test_stringField_noDebugFillProperties() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -496,7 +496,7 @@
}
Future<void> test_typeOutOfScopeField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -528,7 +528,7 @@
}
Future<void> test_typeOutOfScopeGetter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -560,7 +560,7 @@
}
Future<void> test_varField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_explicit_cast_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_explicit_cast_test.dart
index 25a4a6c..ebf1233 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_explicit_cast_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_explicit_cast_test.dart
@@ -23,7 +23,7 @@
FixKind get kind => DartFixKind.ADD_EXPLICIT_CAST;
Future<void> test_as() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(A a) {
C c = a as B;
print(c);
@@ -36,7 +36,7 @@
}
Future<void> test_assignment_general() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(A a) {
B b;
b = a;
@@ -57,7 +57,7 @@
}
Future<void> test_assignment_general_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(A a) {
B b, b2;
b = a;
@@ -78,7 +78,7 @@
}
Future<void> test_assignment_list() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List<A> a) {
List<B> b;
b = a.where((e) => e is B).toList();
@@ -99,7 +99,7 @@
}
Future<void> test_assignment_list_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List<A> a) {
List<B> b, b2;
b = a.where((e) => e is B).toList();
@@ -120,7 +120,7 @@
}
Future<void> test_assignment_map() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Map<A, B> a) {
Map<B, A> b;
b = a;
@@ -141,7 +141,7 @@
}
Future<void> test_assignment_map_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Map<A, B> a) {
Map<B, A> b, b2;
b = a;
@@ -162,7 +162,7 @@
}
Future<void> test_assignment_needsParens() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(A a) {
B b;
b = a..m();
@@ -187,7 +187,7 @@
}
Future<void> test_assignment_needsParens_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(A a) {
B b, b2;
b = a..m();
@@ -212,7 +212,7 @@
}
Future<void> test_assignment_set() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Set<A> a) {
Set<B> b;
b = a;
@@ -233,7 +233,7 @@
}
Future<void> test_assignment_set_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Set<A> a) {
Set<B> b, b2;
b = a;
@@ -254,7 +254,7 @@
}
Future<void> test_cast() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List<A> a) {
List<B> b = a.cast<A>();
print(b);
@@ -266,7 +266,7 @@
}
Future<void> test_declaration_general() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(A a) {
B b = a;
print(b);
@@ -285,7 +285,7 @@
}
Future<void> test_declaration_general_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(A a) {
B b = a;
B b2 = a;
@@ -304,7 +304,7 @@
}
Future<void> test_declaration_list() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List<A> a) {
List<B> b = a.where((e) => e is B).toList();
print(b);
@@ -323,7 +323,7 @@
}
Future<void> test_declaration_list_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List<A> a) {
List<B> b = a.where((e) => e is B).toList();
List<B> b2 = a.where((e) => e is B).toList();
@@ -342,7 +342,7 @@
}
Future<void> test_declaration_map() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Map<A, B> a) {
Map<B, A> b = a;
print(b);
@@ -361,7 +361,7 @@
}
Future<void> test_declaration_map_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Map<A, B> a) {
Map<B, A> b = a;
Map<B, A> b2 = a;
@@ -380,7 +380,7 @@
}
Future<void> test_declaration_needsParens() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(A a) {
B b = a..m();
print(b);
@@ -403,7 +403,7 @@
}
Future<void> test_declaration_needsParens_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(A a) {
B b = a..m();
B b2 = a..m();
@@ -426,7 +426,7 @@
}
Future<void> test_declaration_set() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Set<A> a) {
Set<B> b = a;
print(b);
@@ -445,7 +445,7 @@
}
Future<void> test_declaration_set_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Set<A> a) {
Set<B> b = a;
Set<B> b2 = a;
@@ -464,7 +464,7 @@
}
Future<void> test_notExpression_incomplete() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
void foo(int a) {
a = a < ;
}
@@ -481,7 +481,7 @@
class AddExplicitCastWithNullSafetyTest extends AddExplicitCastTest
with WithNullSafetyMixin {
Future<void> test_assignment_null() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(int x) {
x = null;
}
@@ -490,7 +490,7 @@
}
Future<void> test_assignment_nullable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(int x, int? y) {
x = y;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_field_formal_parameters_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_field_formal_parameters_test.dart
index 0e59102..b8dbde7 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_field_formal_parameters_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_field_formal_parameters_test.dart
@@ -24,7 +24,7 @@
flutter: true,
);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class MyWidget extends StatelessWidget {
@@ -49,7 +49,7 @@
}
Future<void> test_hasRequiredParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Test {
final int a;
final int b;
@@ -68,7 +68,7 @@
}
Future<void> test_noParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Test {
final int a;
final int b;
@@ -87,7 +87,7 @@
}
Future<void> test_noRequiredParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Test {
final int a;
final int b;
@@ -106,7 +106,7 @@
}
Future<void> test_notAllFinal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Test {
final int a;
int b;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_late_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_late_test.dart
index 2169e59..9558f70 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_late_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_late_test.dart
@@ -22,7 +22,7 @@
FixKind get kind => DartFixKind.ADD_LATE;
Future<void> test_withFinal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
final String s;
}
@@ -37,7 +37,7 @@
FixKind get kind => DartFixKind.ADD_LATE;
Future<void> test_withFinal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
final String s;
}
@@ -50,7 +50,7 @@
}
Future<void> test_withLate() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
late s;
}
@@ -59,7 +59,7 @@
}
Future<void> test_withType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
String s;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_missing_enum_case_clauses_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_missing_enum_case_clauses_test.dart
index 09f61ed..f23da1c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_missing_enum_case_clauses_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_missing_enum_case_clauses_test.dart
@@ -39,7 +39,7 @@
}
Future<void> test_empty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
enum E {a, b, c}
void f(E e) {
switch (e) {
@@ -65,7 +65,7 @@
}
Future<void> test_incomplete_switchStatement() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
enum E {a, b, c}
void f(E e) {
@@ -76,7 +76,7 @@
}
Future<void> test_nonEmpty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
enum E {a, b, c}
void f(E e) {
switch (e) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_named_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_named_test.dart
index eee9f5c..d1572d6 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_named_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_named_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.ADD_MISSING_PARAMETER_NAMED;
Future<void> test_constructor_hasNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A(int a, {int b}) {}
}
@@ -41,7 +41,7 @@
}
Future<void> test_constructor_hasRequired() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A(int a) {}
}
@@ -62,7 +62,7 @@
}
Future<void> test_constructor_noParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A() {}
}
@@ -83,7 +83,7 @@
}
Future<void> test_constructor_noParameters_named() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A.aaa() {}
}
@@ -104,7 +104,7 @@
}
Future<void> test_function_hasNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
test(int a, {int b: 0}) {}
main() {
@@ -121,7 +121,7 @@
}
Future<void> test_function_hasRequired() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
test(int a) {}
main() {
@@ -138,7 +138,7 @@
}
Future<void> test_function_noParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
test() {}
main() {
@@ -155,7 +155,7 @@
}
Future<void> test_method_hasNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
test(int a, {int b: 0}) {}
@@ -176,7 +176,7 @@
}
Future<void> test_method_hasOptionalPositional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
test(int a, [int b]) {}
@@ -189,7 +189,7 @@
}
Future<void> test_method_hasRequired() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
test(int a) {}
@@ -210,7 +210,7 @@
}
Future<void> test_method_noParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
test() {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_positional_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_positional_test.dart
index 757b017..532f7a1 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_positional_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_positional_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL;
Future<void> test_function_hasNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
test({int a}) {}
main() {
test(1);
@@ -30,7 +30,7 @@
}
Future<void> test_function_hasZero() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
test() {}
main() {
test(1);
@@ -45,7 +45,7 @@
}
Future<void> test_method_hasOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
test(int a) {}
main() {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_required_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_required_test.dart
index 9957bbe..0f5c502 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_required_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_missing_parameter_required_test.dart
@@ -23,7 +23,7 @@
FixKind get kind => DartFixKind.ADD_MISSING_PARAMETER_REQUIRED;
Future<void> test_constructor_named_hasOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A.named(int a) {}
}
@@ -42,7 +42,7 @@
}
Future<void> test_constructor_unnamed_hasOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A(int a) {}
}
@@ -61,7 +61,7 @@
}
Future<void> test_function_hasNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
test({int a}) {}
main() {
test(1);
@@ -76,7 +76,7 @@
}
Future<void> test_function_hasOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
test(int a) {}
main() {
test(1, 2.0);
@@ -91,7 +91,7 @@
}
Future<void> test_function_hasZero() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
test() {}
main() {
test(1);
@@ -106,7 +106,7 @@
}
Future<void> test_method_hasOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
test(int a) {}
main() {
@@ -125,7 +125,7 @@
}
Future<void> test_method_hasZero() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
test() {}
main() {
@@ -167,7 +167,7 @@
getContext('/home/aaa').currentSession,
]);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:aaa/a.dart';
main() {
@@ -189,7 +189,7 @@
..add(name: 'bbb', rootPath: '$workspaceRootPath/bbb'),
);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:bbb/b.dart';
main() {
@@ -200,7 +200,7 @@
}
Future<void> test_method_inSdk() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
42.abs(true);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_missing_required_argument_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_missing_required_argument_test.dart
index ed684f8..b29d1e8 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_missing_required_argument_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_missing_required_argument_test.dart
@@ -30,7 +30,7 @@
}
Future<void> test_constructor_flutter_children() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
import 'package:meta/meta.dart';
@@ -57,7 +57,7 @@
}
Future<void> test_constructor_flutter_hasTrailingComma() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
import 'package:meta/meta.dart';
@@ -84,7 +84,7 @@
}
Future<void> test_constructor_named() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
class A {
@@ -118,7 +118,7 @@
A({@required int a}) {}
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/a.dart';
main() {
@@ -146,7 +146,7 @@
A({@required VoidCallback onPressed}) {}
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/a.dart';
main() {
@@ -174,7 +174,7 @@
A({@required Callback callback}) {}
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/a.dart';
main() {
@@ -202,7 +202,7 @@
A({@required Callback callback}) {}
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/a.dart';
main() {
@@ -230,7 +230,7 @@
A({@required Callback callback}) {}
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/a.dart';
main() {
@@ -256,7 +256,7 @@
A({@required List<String> names}) {}
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/a.dart';
main() {
@@ -275,7 +275,7 @@
}
Future<void> test_multiple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
test({@required int a, @required int bcd}) {}
@@ -294,7 +294,7 @@
}
Future<void> test_multiple_1of2() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
test({@required int a, @required int bcd}) {}
@@ -313,7 +313,7 @@
}
Future<void> test_multiple_2of2() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
test({@required int a, @required int bcd}) {}
@@ -332,7 +332,7 @@
}
Future<void> test_param_child() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
import 'package:meta/meta.dart';
@@ -364,7 +364,7 @@
}
Future<void> test_param_children() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
import 'package:meta/meta.dart';
@@ -396,7 +396,7 @@
}
Future<void> test_single() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
test({@required int abc}) {}
@@ -416,7 +416,7 @@
}
Future<void> test_single_normal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
test(String x, {@required int abc}) {}
@@ -435,7 +435,7 @@
}
Future<void> test_single_with_details() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
test({@Required("Really who doesn't need an abc?") int abc}) {}
@@ -473,7 +473,7 @@
A({@required Callback callback}) {}
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/a.dart';
main() {
@@ -502,7 +502,7 @@
A({@required Callback callback}) {}
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/a.dart';
main() {
@@ -530,7 +530,7 @@
A({@required Callback callback}) {}
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
// @dart = 2.8
import 'package:test/a.dart';
@@ -551,7 +551,7 @@
}
Future<void> test_nonNullable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f({required int x}) {}
void g() {
f();
@@ -566,7 +566,7 @@
}
Future<void> test_nullable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f({required int? x}) {}
void g() {
f();
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_ne_null_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_ne_null_test.dart
index 657adcc..95302e6 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_ne_null_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_ne_null_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.ADD_NE_NULL;
Future<void> test_nonBoolCondition() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(String p) {
if (p) {
print(p);
@@ -38,7 +38,7 @@
}
Future<void> test_nonBoolCondition_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(String p, String q) {
if (p) {
print(p);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_null_check_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_null_check_test.dart
index 96010dd..dc640e4 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_null_check_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_null_check_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.ADD_NULL_CHECK;
Future<void> test_argument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(int x) {}
void g(int? y) {
f(y);
@@ -36,7 +36,7 @@
}
Future<void> test_argument_differByMoreThanNullability() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(int x) {}
void g(String y) {
f(y);
@@ -46,7 +46,7 @@
}
Future<void> test_assignment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(int x, int? y) {
x = y;
}
@@ -60,7 +60,7 @@
Future<void>
test_assignment_differByMoreThanNullability_nonNullableRight() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(int x, String y) {
x = y;
}
@@ -70,7 +70,7 @@
Future<void>
test_assignment_differByMoreThanNullability_nullableRight() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(int x, String? y) {
x = y;
}
@@ -79,7 +79,7 @@
}
Future<void> test_assignment_needsParens() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(A x) {
x = x + x;
}
@@ -98,7 +98,7 @@
}
Future<void> test_initializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(int? x) {
int y = x;
print(y);
@@ -113,7 +113,7 @@
}
Future<void> test_initializer_differByMoreThanNullability() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String x) {
int y = x;
print(y);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_override_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_override_test.dart
index 1205817..7a33711 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_override_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_override_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.annotate_overrides;
Future<void> test_field() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class Test {
int get t;
}
@@ -44,7 +44,7 @@
}
Future<void> test_getter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Test {
int get t => null;
}
@@ -64,7 +64,7 @@
}
Future<void> test_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Test {
void t() { }
}
@@ -84,7 +84,7 @@
}
Future<void> test_method_with_doc_comment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Test {
void t() { }
}
@@ -106,7 +106,7 @@
}
Future<void> test_method_with_doc_comment_2() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Test {
void t() { }
}
@@ -132,7 +132,7 @@
}
Future<void> test_method_with_doc_comment_and_metadata() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Test {
void t() { }
}
@@ -158,7 +158,7 @@
}
Future<void> test_method_with_non_doc_comment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Test {
void t() { }
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_required_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_required_test.dart
index fcf9c8b..1f22076 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_required_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_required_test.dart
@@ -26,7 +26,7 @@
String get lintCode => LintNames.always_require_non_null_named_parameters;
Future<void> test_withAssert() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void function({String param}) {
assert(param != null);
}
@@ -46,7 +46,7 @@
FixKind get kind => DartFixKind.ADD_REQUIRED2;
Future<void> test_withAssert() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void function({String param}) {}
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart
index b3a2423..75a8383 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_return_type_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.always_declare_return_types;
Future<void> test_localFunction_block() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
void m() {
f() {
@@ -47,7 +47,7 @@
}
Future<void> test_localFunction_expression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
void m() {
f() => '';
@@ -66,7 +66,7 @@
}
Future<void> test_method_block_noReturn() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
m() {
}
@@ -76,7 +76,7 @@
}
Future<void> test_method_block_returnDynamic() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
m(p) {
return p;
@@ -93,7 +93,7 @@
}
Future<void> test_method_block_returnNoValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
m() {
return;
@@ -110,7 +110,7 @@
}
Future<void> test_method_block_singleReturn() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
m() {
return '';
@@ -127,7 +127,7 @@
}
Future<void> test_method_expression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
m() => '';
}
@@ -140,7 +140,7 @@
}
Future<void> test_method_getter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
get foo => 0;
}
@@ -153,7 +153,7 @@
}
Future<void> test_topLevelFunction_block() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
return '';
}
@@ -166,7 +166,7 @@
}
Future<void> test_topLevelFunction_expression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() => '';
''');
await assertHasFix('''
@@ -175,7 +175,7 @@
}
Future<void> test_topLevelFunction_getter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
get foo => 0;
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_static_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_static_test.dart
index d547fbf..7fd378a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_static_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_static_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.ADD_STATIC;
Future<void> test_multipleFields() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
const int x = 0, y = 0;
}
@@ -33,7 +33,7 @@
}
Future<void> test_oneField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
const int x = 0;
}
@@ -46,7 +46,7 @@
}
Future<void> test_withAnnotation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
@ann
const int x = 0;
@@ -63,7 +63,7 @@
}
Future<void> test_withDocComment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
/// Doc comment
const int x = 0;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_super_constructor_invocation_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_super_constructor_invocation_test.dart
index 0fe23f1..ce129cc 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_super_constructor_invocation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_super_constructor_invocation_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.ADD_SUPER_CONSTRUCTOR_INVOCATION;
Future<void> test_hasInitializers() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A(int p);
}
@@ -41,7 +41,7 @@
}
Future<void> test_named() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A.named(int p);
}
@@ -60,7 +60,7 @@
}
Future<void> test_named_private() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A._named(int p);
}
@@ -72,7 +72,7 @@
}
Future<void> test_requiredAndNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A(bool p1, int p2, double p3, String p4, {p5});
}
@@ -91,7 +91,7 @@
}
Future<void> test_typeArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A<T> {
A(T p);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_type_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_type_annotation_test.dart
index 4322e01..dd375be 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_type_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_type_annotation_test.dart
@@ -27,7 +27,7 @@
// More coverage in the `add_type_annotation_test.dart` assist test.
Future<void> test_do_block() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
final f = 0;
}
@@ -47,7 +47,7 @@
Future<void> test_missingFieldType() async {
// MISSING_CONST_FINAL_VAR_OR_TYPE
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
f = 0;
}
@@ -61,7 +61,7 @@
Future<void> test_missingStaticFieldType() async {
// MISSING_CONST_FINAL_VAR_OR_TYPE
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static f = 0;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/add_await_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/add_await_test.dart
index 5ee8044..dc61da4 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/add_await_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/add_await_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.unawaited_futures;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Future doSomething() => new Future.value('');
Future doSomethingElse() => new Future.value('');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/add_const_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/add_const_test.dart
index fd2fc44..d20eaf8 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/add_const_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/add_const_test.dart
@@ -23,7 +23,7 @@
@failingTest
Future<void> test_singleFile() async {
writeTestPackageConfig(meta: true);
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class C {
const C([C c]);
}
@@ -46,7 +46,7 @@
Future<void> test_singleFile() async {
writeTestPackageConfig(meta: true);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
@immutable
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/add_diagnostic_property_reference_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/add_diagnostic_property_reference_test.dart
index 8ea5e2f..0fead9f 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/add_diagnostic_property_reference_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/add_diagnostic_property_reference_test.dart
@@ -20,7 +20,7 @@
Future<void> test_singleFile() async {
writeTestPackageConfig(flutter: true);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/add_override_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/add_override_test.dart
index afd882d..b62d97e 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/add_override_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/add_override_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.annotate_overrides;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
void a() {}
void aa() {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_documentation_into_line_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_documentation_into_line_test.dart
index 5a5d169..2094c37 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_documentation_into_line_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_documentation_into_line_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.slash_for_doc_comments;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
/**
* C
*/
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_map_from_iterable_to_for_literal_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_map_from_iterable_to_for_literal_test.dart
index 151df66..d9e3834 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_map_from_iterable_to_for_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_map_from_iterable_to_for_literal_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_for_elements_to_map_fromIterable;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
var k = 3;
return Map.fromIterable(i, key: (k) => k * 2, value: (v) => k);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_contains_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_contains_test.dart
index 5e7445b..eacb1cc 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_contains_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_contains_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_contains;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return -1 != list.indexOf(value);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_generic_function_syntax_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_generic_function_syntax_test.dart
index 8d55491..af826e2 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_generic_function_syntax_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_generic_function_syntax_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_generic_function_type_aliases;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef String F(int x);
typedef F2<P, R>(P x);
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_if_element_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_if_element_test.dart
index 4e3908a..e965e54 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_if_element_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_if_element_test.dart
@@ -20,7 +20,7 @@
LintNames.prefer_if_elements_to_conditional_expressions;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
String f(bool b) {
return ['a', b ? 'c' : 'd', 'e'];
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_if_null_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_if_null_test.dart
index d587043..5bca56c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_if_null_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_if_null_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_if_null_operators;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
print(s == null ? 'default' : s);
print(s != null ? s : 'default');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_int_literal_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_int_literal_test.dart
index a86f1f6..32b17ce 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_int_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_int_literal_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_int_literals;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
const double d1 = 42.0;
double d2 = 7.0e2;
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_list_literal_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_list_literal_test.dart
index 8810f14..af7f3cb 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_list_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_list_literal_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_collection_literals;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
List l = List();
var l2 = List<int>();
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_map_literal_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_map_literal_test.dart
index 066755e..cb02894 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_map_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_map_literal_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_collection_literals;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Map m = Map();
var m2 = Map<String, int>();
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_null_aware_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_null_aware_test.dart
index ed938e6..e30e7d7 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_null_aware_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_null_aware_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_null_aware_operators;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int m(int p) => p;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_relative_import_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_relative_import_test.dart
index 8319104..40b022f 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_relative_import_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_relative_import_test.dart
@@ -27,7 +27,7 @@
''');
testFile = convertPath('/home/test/lib/src/test.dart');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/bar.dart';
import 'package:test/foo.dart';
C c;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_set_literal_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_set_literal_test.dart
index 526e697..bfcaf1c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_set_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_set_literal_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_collection_literals;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Set s = Set();
var s1 = Set<int>();
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_single_quoted_strings_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_single_quoted_strings_test.dart
index 7bc1a30..68a54c0 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_single_quoted_strings_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_single_quoted_strings_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_single_quotes;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print("abc");
print("e" + "f" + "g");
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_spread_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_spread_test.dart
index 59bdc19..ddbdc0a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_spread_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_spread_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_spread_collections;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
var ints = [1, 2, 3];
print(['a']..addAll(ints.map((i) => i.toString()))..addAll(['c']));
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_where_type_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_where_type_test.dart
index 12bc2eb..62788ef 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_where_type_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_where_type_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_iterable_whereType;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Iterable<C> f(List<Object> list) {
return list.where((e) => e is C);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/create_method_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/create_method_test.dart
index 5933dbe..cf17881 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/create_method_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/create_method_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.hash_and_equals;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
@override
int get hashCode => 13;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/data_driven_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/data_driven_test.dart
index 4a91e90..8404c8b 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/data_driven_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/data_driven_test.dart
@@ -53,7 +53,7 @@
- kind: 'rename'
newName: 'New'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class A extends Old {}
class B extends Old {}
@@ -81,7 +81,7 @@
- kind: 'rename'
newName: 'New'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class A extends Old {}
class B extends Old {}
@@ -127,7 +127,7 @@
- kind: 'removeParameter'
index: 1
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void g() {
f(0, f(1, 2));
@@ -164,7 +164,7 @@
- kind: 'removeParameter'
index: 1
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void g() {
f(0, f(1, 2));
@@ -199,7 +199,7 @@
- kind: 'rename'
newName: 'New'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class A implements Old {}
class B implements Old {}
@@ -227,7 +227,7 @@
- kind: 'rename'
newName: 'New'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class A implements Old {}
class B implements Old {}
@@ -267,7 +267,7 @@
argumentValue:
expression: '0'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class A extends C {
@override
@@ -313,7 +313,7 @@
argumentValue:
expression: 'int'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class A extends C {
@override
@@ -358,7 +358,7 @@
- kind: 'rename'
newName: 'New'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class A with Old {}
class B with Old {}
@@ -386,7 +386,7 @@
- kind: 'rename'
newName: 'New'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class A with Old {}
class B with Old {}
@@ -422,7 +422,7 @@
- kind: 'rename'
newName: 'new'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
C c() => C(C());
''');
@@ -451,7 +451,7 @@
- kind: 'rename'
newName: 'new'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
C c() => C(C());
''');
@@ -483,7 +483,7 @@
- kind: 'rename'
newName: 'New'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class A extends Old {}
class B extends Old {}
@@ -514,7 +514,7 @@
argumentValue:
expression: '0'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void g() {
f(f(0));
@@ -550,7 +550,7 @@
- kind: 'rename'
newName: 'new'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class D extends C {
@override
@@ -595,7 +595,7 @@
- kind: 'rename'
newName: 'New'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Old a, Old b) {}
''');
@@ -621,7 +621,7 @@
- kind: 'rename'
newName: 'New'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Old a, Old b) {}
''');
@@ -652,7 +652,7 @@
- kind: 'rename'
newName: 'new'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
old(old(0));
@@ -682,7 +682,7 @@
- kind: 'rename'
newName: 'new'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
old(old(0));
@@ -720,7 +720,7 @@
- kind: 'rename'
newName: 'new'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C a, C b) {
a.old + b.old;
@@ -753,7 +753,7 @@
- kind: 'rename'
newName: 'new'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C a, C b) {
a.old + b.old;
@@ -788,7 +788,7 @@
- kind: 'rename'
newName: 'new'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
old + old;
@@ -818,7 +818,7 @@
- kind: 'rename'
newName: 'new'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
old + old;
@@ -856,7 +856,7 @@
- kind: 'rename'
newName: 'new'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C a, C b) {
a.old(b.old(0));
@@ -889,7 +889,7 @@
- kind: 'rename'
newName: 'new'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C a, C b) {
a.old(b.old(0));
@@ -927,7 +927,7 @@
- kind: 'rename'
newName: 'new'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C a, C b) {
a.old = b.old = 1;
@@ -960,7 +960,7 @@
- kind: 'rename'
newName: 'new'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C a, C b) {
a.old = b.old = 1;
@@ -998,7 +998,7 @@
argumentValue:
expression: 'int'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
C f() => C<String>.c(C<String>.c());
''');
@@ -1032,7 +1032,7 @@
argumentValue:
expression: 'int'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(String s) {
E<String>(s).m(E<String>(s).m(0));
@@ -1071,7 +1071,7 @@
argumentValue:
expression: 'int'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
c.m<String>(c.m<String>(0));
@@ -1107,7 +1107,7 @@
argumentValue:
expression: 'int'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C<String> c) {}
''');
@@ -1138,7 +1138,7 @@
argumentValue:
expression: 'int'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
C f() => C<String>(C<String>());
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/inline_invocation_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/inline_invocation_test.dart
index 2e6ed1b..b34d124 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/inline_invocation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/inline_invocation_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_inlined_adds;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = []..add('a')..add('b');
var l2 = ['a', 'b']..add('c');
var l3 = ['a']..addAll(['b', 'c']);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/make_final_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/make_final_test.dart
index cae164a..21724f2 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/make_final_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/make_final_test.dart
@@ -20,7 +20,7 @@
String get lintCode => LintNames.prefer_final_fields;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int _f = 2;
var _f2 = 2;
@@ -45,7 +45,7 @@
String get lintCode => LintNames.prefer_final_locals;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
var x = 0;
var y = x;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_argument_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_argument_test.dart
index d246cd8..7d87ea4 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_argument_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_argument_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.avoid_redundant_argument_values;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f({bool valWithDefault = true, bool val}) {}
void f2({bool valWithDefault = true, bool val}) {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_await_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_await_test.dart
index ea4c184..b1c9f97 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_await_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_await_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.await_only_futures;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() async {
print(await 23);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_duplicate_case_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_duplicate_case_test.dart
index 0ce557d..76d7a91 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_duplicate_case_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_duplicate_case_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.no_duplicate_case_values;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void switchInt() {
switch (2) {
case 1:
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_catch_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_catch_test.dart
index 2582a53..a6a0897d 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_catch_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_catch_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.empty_catches;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
try {
try {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_constructor_body_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_constructor_body_test.dart
index 9272e89..9469973 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_constructor_body_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_constructor_body_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.empty_constructor_bodies;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
C() {}
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_else_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_else_test.dart
index faf94fc..5c967e2 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_else_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_else_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.avoid_empty_else;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(bool cond) {
if (cond) {
//
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_statement_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_statement_test.dart
index 42227c9..fbf7b39 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_statement_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_empty_statement_test.dart
@@ -21,7 +21,7 @@
Future<void> test_singleFile() async {
// Note that ReplaceWithEmptyBrackets is not supported.
// for example: `if (true) ;` ...
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
while(true) {
;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_initializer_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_initializer_test.dart
index 446ec84..c95ede1 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_initializer_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_initializer_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.avoid_init_to_null;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class T {
int x = null;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_interpolation_braces_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_interpolation_braces_test.dart
index 5060050..a291bf1 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_interpolation_braces_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_interpolation_braces_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.unnecessary_brace_in_string_interps;
Future<void> test_singleFile() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
var v = 42;
print('v: ${ v}, ${ v}');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_method_declaration_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_method_declaration_test.dart
index 6389eaf..65f7918 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_method_declaration_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_method_declaration_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.unnecessary_overrides;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int foo;
int bar() => 0;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_operator_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_operator_test.dart
index e8aede6..f876196 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_operator_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_operator_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_adjacent_string_concatenation;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = 'a' + 'b';
var s1 = 'b' + 'c';
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_this_expression_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_this_expression_test.dart
index 06f6938..eb9eb5c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_this_expression_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_this_expression_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.unnecessary_this;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int x;
A(int x) : this.x = x;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_type_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_type_annotation_test.dart
index f164e06..600d12d 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_type_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_type_annotation_test.dart
@@ -22,7 +22,7 @@
String get lintCode => LintNames.avoid_annotating_with_dynamic;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(void foo(dynamic x)) {
return null;
}
@@ -49,7 +49,7 @@
String get lintCode => LintNames.avoid_return_types_on_setters;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void set s(int s) {}
void set s2(int s2) {}
''');
@@ -66,7 +66,7 @@
String get lintCode => LintNames.avoid_types_on_closure_parameters;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var x = ({Future<int> defaultValue}) => null;
var y = (Future<int> defaultValue) => null;
''');
@@ -83,7 +83,7 @@
String get lintCode => LintNames.type_init_formals;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int f;
C(int this.f);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_unnecessary_const_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_unnecessary_const_test.dart
index 5b6811d..eb112f7 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_unnecessary_const_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_unnecessary_const_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.unnecessary_const;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C { const C(); }
class D { const D(C c); }
const c = const C();
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_unnecessary_new_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_unnecessary_new_test.dart
index 6f3b5e2..88670c3 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_unnecessary_new_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_unnecessary_new_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.unnecessary_new;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
C f() => new C();
class C {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/rename_to_camel_case_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/rename_to_camel_case_test.dart
index 8e717a0..5248e32 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/rename_to_camel_case_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/rename_to_camel_case_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.non_constant_identifier_names;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int my_integer_variable = 42;
int foo;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_colon_with_equals_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_colon_with_equals_test.dart
index c90d5f7..f057c74 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_colon_with_equals_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_colon_with_equals_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_equal_for_default_values;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f({int a: 1}) => null;
class C {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_final_with_const_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_final_with_const_test.dart
index 1eefe84..d886f78 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_final_with_const_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_final_with_const_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_const_declarations;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
final int a = 1;
final b = 1;
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_new_with_const_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_new_with_const_test.dart
index a6c5170..f8ba7bd 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_new_with_const_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_new_with_const_test.dart
@@ -21,7 +21,7 @@
/// Disabled in BulkFixProcessor.
@failingTest
Future<void> test_singleFile() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class C {
const C();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_null_with_closure_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_null_with_closure_test.dart
index f647efb..9a686bf 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_null_with_closure_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_null_with_closure_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.null_closures;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int> l) {
l.firstWhere((e) => e.isEven, orElse: null);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_conditional_assignment_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_conditional_assignment_test.dart
index 790ff57..77c9615 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_conditional_assignment_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_conditional_assignment_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_conditional_assignment;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Person {
String _fullName;
void foo() {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_is_empty_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_is_empty_test.dart
index b7475c3..b61ffd7 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_is_empty_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_is_empty_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_is_empty;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List c) {
if (0 == c.length) {}
if (1 > c.length) {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_tear_off_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_tear_off_test.dart
index 5be6f3f..eef575b 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_tear_off_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_tear_off_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.unnecessary_lambdas;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Function f() => (name) {
print(name);
};
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_var_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_var_test.dart
index 63c23a5..27367dc 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_var_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_with_var_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.omit_local_variable_types;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
List f() {
List<int> l = [];
return l;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/sort_child_properties_last_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/sort_child_properties_last_test.dart
index dafc81d..3cc5338 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/sort_child_properties_last_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/sort_child_properties_last_test.dart
@@ -20,7 +20,7 @@
Future<void> test_singleFile() async {
writeTestPackageConfig(flutter: true);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/use_curly_braces_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/use_curly_braces_test.dart
index 3bce118..8e1f19a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/use_curly_braces_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/use_curly_braces_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.curly_braces_in_flow_control_structures;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
while (true) if (false) print('');
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/use_is_not_empty_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/use_is_not_empty_test.dart
index e9010c7..1f337b8 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/use_is_not_empty_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/use_is_not_empty_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.prefer_is_not_empty;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int> l) {
if (!l.isEmpty) {}
if (!l.isEmpty || true) {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/use_rethrow_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/use_rethrow_test.dart
index 967d352..9d4678b 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/use_rethrow_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/use_rethrow_test.dart
@@ -19,7 +19,7 @@
String get lintCode => LintNames.use_rethrow_when_possible;
Future<void> test_singleFile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
try {} catch (e) {
throw e;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/change_argument_name_test.dart b/pkg/analysis_server/test/src/services/correction/fix/change_argument_name_test.dart
index bd4ac94..5bb073d 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/change_argument_name_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/change_argument_name_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.CHANGE_ARGUMENT_NAME;
Future<void> test_child_constructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() => new A(children: 2);
class A {
A({int child});
@@ -35,7 +35,7 @@
}
Future<void> test_child_function() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
g(children: 0);
}
@@ -50,7 +50,7 @@
}
Future<void> test_child_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(A a) {
a.m(children: 0);
}
@@ -69,7 +69,7 @@
}
Future<void> test_children_constructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() => new A(child: 2);
class A {
A({int children});
@@ -84,7 +84,7 @@
}
Future<void> test_children_function() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
g(child: 0);
}
@@ -99,7 +99,7 @@
}
Future<void> test_children_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(A a) {
a.m(child: 0);
}
@@ -118,7 +118,7 @@
}
Future<void> test_default_annotation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
@A(boot: 2)
f() => null;
class A {
@@ -135,7 +135,7 @@
}
Future<void> test_default_constructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() => new A(boot: 2);
class A {
A({int boat});
@@ -150,7 +150,7 @@
}
Future<void> test_default_function() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
g(boot: 0);
}
@@ -165,7 +165,7 @@
}
Future<void> test_default_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(A a) {
a.m(boot: 0);
}
@@ -184,7 +184,7 @@
}
Future<void> test_default_redirectingConstructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A.one() : this.two(boot: 3);
A.two({int boat});
@@ -199,7 +199,7 @@
}
Future<void> test_default_superConstructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A.a({int boat});
}
@@ -218,7 +218,7 @@
}
Future<void> test_tooDistant_constructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() => new A(bbbbb: 2);
class A {
A({int aaaaaaa});
@@ -228,7 +228,7 @@
}
Future<void> test_tooDistant_function() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
g(bbbbb: 0);
}
@@ -238,7 +238,7 @@
}
Future<void> test_tooDistant_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(A a) {
a.m(bbbbb: 0);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/change_to_nearest_precise_value_test.dart b/pkg/analysis_server/test/src/services/correction/fix/change_to_nearest_precise_value_test.dart
index 6a9c074..419a6c1 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/change_to_nearest_precise_value_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/change_to_nearest_precise_value_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.CHANGE_TO_NEAREST_PRECISE_VALUE;
Future<void> test_impreciseIntAsDouble() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
double x = 1000000000000000000000000;
''');
await assertHasFix('''
@@ -29,7 +29,7 @@
}
Future<void> test_impreciseIntAsDouble_asCapitalHex() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
double x = 0X1000000000000000000000001;
''');
await assertHasFix('''
@@ -38,7 +38,7 @@
}
Future<void> test_impreciseIntAsDouble_asHex() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
double x = 0x1000000000000000000000001;
''');
await assertHasFix('''
@@ -47,7 +47,7 @@
}
Future<void> test_impreciseIntAsDouble_maxValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
double x = 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
''');
await assertHasFix('''
@@ -56,7 +56,7 @@
}
Future<void> test_impreciseIntAsDouble_maxValue_asHex() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
double x = 0x100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/change_to_static_access_test.dart b/pkg/analysis_server/test/src/services/correction/fix/change_to_static_access_test.dart
index acc3551..dd985bb 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/change_to_static_access_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/change_to_static_access_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.CHANGE_TO_STATIC_ACCESS;
Future<void> test_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static foo() {}
}
@@ -39,7 +39,7 @@
}
Future<void> test_method_extension() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on int {
static void foo() {}
}
@@ -68,7 +68,7 @@
class B extends A {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/b.dart';
main(B b) {
@@ -86,7 +86,7 @@
}
Future<void> test_method_prefixLibrary() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async' as pref;
main(pref.Future f) {
f.wait([]);
@@ -101,7 +101,7 @@
}
Future<void> test_property() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static get foo => 42;
}
@@ -121,7 +121,7 @@
@failingTest
Future<void> test_property_extension() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on int {
static int get foo => 42;
}
@@ -150,7 +150,7 @@
class B extends A {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/b.dart';
main(B b) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/change_to_test.dart b/pkg/analysis_server/test/src/services/correction/fix/change_to_test.dart
index 7bc4ba2..e3e581b 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/change_to_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/change_to_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.CHANGE_TO;
Future<void> test_annotation_constructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
@MyCalss()
void f() {}
@@ -42,7 +42,7 @@
Future<void> test_annotation_variable() async {
// TODO(brianwilkerson) Add support for suggesting similar top-level
// variables.
- await resolveTestUnit('''
+ await resolveTestCode('''
const annotation = '';
@anontation
void f() {}
@@ -55,7 +55,7 @@
}
Future<void> test_class_extends() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyClass extends BaseClssa {}
class BaseClass {}
@@ -68,7 +68,7 @@
}
Future<void> test_class_fromImport() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Stirng s = 'abc';
print(s);
@@ -83,7 +83,7 @@
}
Future<void> test_class_fromThisLibrary() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyClass {}
main() {
MyCalss v = null;
@@ -100,7 +100,7 @@
}
Future<void> test_class_implements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyClass implements BaseClssa {}
class BaseClass {}
@@ -113,7 +113,7 @@
}
Future<void> test_class_prefixed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async' as c;
main() {
c.Fture v = null;
@@ -130,7 +130,7 @@
}
Future<void> test_class_with() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyClass with BaseClssa {}
class BaseClass {}
@@ -143,7 +143,7 @@
}
Future<void> test_function_fromImport() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
pritn(0);
}
@@ -156,7 +156,7 @@
}
Future<void> test_function_prefixed_fromImport() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:core' as c;
main() {
c.prnt(42);
@@ -171,7 +171,7 @@
}
Future<void> test_function_prefixed_ignoreLocal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async' as c;
main() {
c.main();
@@ -181,7 +181,7 @@
}
Future<void> test_function_thisLibrary() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
myFunction() {}
main() {
myFuntcion();
@@ -196,7 +196,7 @@
}
Future<void> test_getter_hint() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int myField;
}
@@ -217,7 +217,7 @@
}
Future<void> test_getter_override() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on int {
int get myGetter => 0;
}
@@ -236,7 +236,7 @@
}
Future<void> test_getter_qualified() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int myField;
}
@@ -255,7 +255,7 @@
}
Future<void> test_getter_qualified_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static int MY_NAME = 1;
}
@@ -274,7 +274,7 @@
}
Future<void> test_getter_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on int {
static int get myGetter => 0;
}
@@ -293,7 +293,7 @@
}
Future<void> test_getter_unqualified() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int myField;
main() {
@@ -312,7 +312,7 @@
}
Future<void> test_method_ignoreOperators() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(Object object) {
object.then();
}
@@ -321,7 +321,7 @@
}
Future<void> test_method_override() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on int {
int myMethod() => 0;
}
@@ -340,7 +340,7 @@
}
Future<void> test_method_qualified() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
myMethod() {}
}
@@ -361,7 +361,7 @@
}
Future<void> test_method_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on int {
static int myMethod() => 0;
}
@@ -380,7 +380,7 @@
}
Future<void> test_method_unqualified_superClass() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
myMethod() {}
}
@@ -403,7 +403,7 @@
}
Future<void> test_method_unqualified_thisClass() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
myMethod() {}
main() {
@@ -422,7 +422,7 @@
}
Future<void> test_setter_hint() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int myField;
}
@@ -443,7 +443,7 @@
}
Future<void> test_setter_override() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on int {
void set mySetter(int i) {}
}
@@ -462,7 +462,7 @@
}
Future<void> test_setter_qualified() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int myField;
}
@@ -481,7 +481,7 @@
}
Future<void> test_setter_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on int {
static void set mySetter(int i) {}
}
@@ -500,7 +500,7 @@
}
Future<void> test_setter_unqualified() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int myField;
main() {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart
index 91c2321..c848914 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/change_type_annotation_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.CHANGE_TYPE_ANNOTATION;
Future<void> test_generic() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
String v = <int>[];
print(v);
@@ -36,7 +36,7 @@
}
Future<void> test_multipleVariables() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
String a, b = 42;
print('\$a \$b');
@@ -46,7 +46,7 @@
}
Future<void> test_notVariableDeclaration() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
String v;
v = 42;
@@ -57,7 +57,7 @@
}
Future<void> test_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
String v = 'abc'.length;
print(v);
@@ -73,7 +73,7 @@
Future<void> test_synthetic_implicitCast() async {
createAnalysisOptionsFile(implicitCasts: false);
- await resolveTestUnit('''
+ await resolveTestCode('''
int foo =
''');
await assertNoFix(
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_documentation_into_line_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_documentation_into_line_test.dart
index 4e8edc0..e68869f 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_documentation_into_line_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_documentation_into_line_test.dart
@@ -25,7 +25,7 @@
/// More coverage in the `convert_to_documentation_line_test.dart` assist test.
Future<void> test_onText() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
/**
* AAAAAAA [int] AAAAAAA
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_flutter_child_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_flutter_child_test.dart
index d083826..7afc732 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_flutter_child_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_flutter_child_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_hasList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
build() {
return Container(
@@ -57,7 +57,7 @@
}
Future<void> test_hasTypedList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
build() {
return new Container(
@@ -86,7 +86,7 @@
}
Future<void> test_listNotWidget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
build() {
return new Container(
@@ -103,7 +103,7 @@
}
Future<void> test_multiLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
build() {
return new Scaffold(
@@ -134,7 +134,7 @@
}
Future<void> test_widgetVariable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
build() {
var text = new Text('foo');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_flutter_children_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_flutter_children_test.dart
index 36d89c5..0d5ae48 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_flutter_children_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_flutter_children_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_undefinedParameter_multiLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
build() {
return new Center(
@@ -55,7 +55,7 @@
}
Future<void> test_undefinedParameter_notWidget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
build() {
return new Center(
@@ -69,7 +69,7 @@
}
Future<void> test_undefinedParameter_singleLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
build() {
return new Center(
@@ -90,7 +90,7 @@
}
Future<void> test_undefinedParameter_singleLine2() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
build() {
var text = new Text('foo');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_into_expression_body_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_into_expression_body_test.dart
index 97f56dd..5bcdd3e 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_into_expression_body_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_into_expression_body_test.dart
@@ -25,7 +25,7 @@
/// More coverage in the `convert_into_expression_body_test.dart` assist test.
Future<void> test_async() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
mmm() async {
return 42;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_contains_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_contains_test.dart
index f72cb3a..f0edd0b 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_contains_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_contains_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_contains;
Future<void> test_left_bangEq_minusOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return -1 != list.indexOf(value);
}
@@ -37,7 +37,7 @@
}
Future<void> test_left_eqEq_minusOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return -1 == list.indexOf(value);
}
@@ -50,7 +50,7 @@
}
Future<void> test_left_gt_minusOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return -1 > list.indexOf(value);
}
@@ -59,7 +59,7 @@
}
Future<void> test_left_gt_zero() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return 0 > list.indexOf(value);
}
@@ -72,7 +72,7 @@
}
Future<void> test_left_gtEq_minusOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return -1 >= list.indexOf(value);
}
@@ -85,7 +85,7 @@
}
Future<void> test_left_lt_minusOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return -1 < list.indexOf(value);
}
@@ -98,7 +98,7 @@
}
Future<void> test_left_ltEq_minusOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return -1 <= list.indexOf(value);
}
@@ -107,7 +107,7 @@
}
Future<void> test_left_ltEq_zero() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return 0 <= list.indexOf(value);
}
@@ -120,7 +120,7 @@
}
Future<void> test_right_bangEq_minusOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return list.indexOf(value) != -1;
}
@@ -133,7 +133,7 @@
}
Future<void> test_right_eqEq_minusOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return list.indexOf(value) == -1;
}
@@ -146,7 +146,7 @@
}
Future<void> test_right_gt_minusOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return list.indexOf(value) > -1;
}
@@ -159,7 +159,7 @@
}
Future<void> test_right_gtEq_minusOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return list.indexOf(value) >= -1;
}
@@ -168,7 +168,7 @@
}
Future<void> test_right_gtEq_zero() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return list.indexOf(value) >= 0;
}
@@ -181,7 +181,7 @@
}
Future<void> test_right_lt_minusOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return list.indexOf(value) < -1;
}
@@ -190,7 +190,7 @@
}
Future<void> test_right_lt_zero() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return list.indexOf(value) < 0;
}
@@ -203,7 +203,7 @@
}
Future<void> test_right_ltEq_minusOne() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bool f(List<int> list, int value) {
return list.indexOf(value) <= -1;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_for_element_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_for_element_test.dart
index 2457d3b..fafbb6e 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_for_element_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_for_element_test.dart
@@ -26,7 +26,7 @@
/// More coverage in the `convert_to_for_element_line_test.dart` assist test.
Future<void>
test_mapFromIterable_differentParameterNames_usedInKey_conflictInValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(Iterable<int> i) {
var k = 3;
return Map.fromIterable(i, key: (k) => k * 2, value: (v) => k);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_generic_function_syntax_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_generic_function_syntax_test.dart
index f56da24..de45575 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_generic_function_syntax_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_generic_function_syntax_test.dart
@@ -25,14 +25,14 @@
String get lintCode => LintNames.prefer_generic_function_type_aliases;
Future<void> test_functionTypeAlias_noParameterTypes() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef String F(x);
''');
await assertNoFix();
}
Future<void> test_functionTypeAlias_noReturnType_noTypeParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef String F(int x);
''');
await assertHasFix('''
@@ -41,7 +41,7 @@
}
Future<void> test_functionTypeAlias_noReturnType_typeParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef F<P, R>(P x);
''');
await assertHasFix('''
@@ -50,7 +50,7 @@
}
Future<void> test_functionTypeAlias_returnType_noTypeParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef String F(int x);
''');
await assertHasFix('''
@@ -59,7 +59,7 @@
}
Future<void> test_functionTypeAlias_returnType_typeParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef R F<P, R>(P x);
''');
await assertHasFix('''
@@ -77,14 +77,14 @@
String get lintCode => LintNames.use_function_type_syntax_for_parameters;
Future<void> test_functionTypedParameter_noParameterTypes() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
g(String f(x)) {}
''');
await assertNoFix();
}
Future<void> test_functionTypedParameter_returnType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
g(String f(int x)) {}
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_if_element_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_if_element_test.dart
index cb36355..ed2c3aa 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_if_element_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_if_element_test.dart
@@ -26,7 +26,7 @@
// More coverage in the `convert_to_if_element_test.dart` assist test.
Future<void> test_conditional_list() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(bool b) {
return ['a', b ? 'c' : 'd', 'e'];
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_if_null_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_if_null_test.dart
index 81c4960..1a641e7 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_if_null_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_if_null_test.dart
@@ -25,7 +25,7 @@
String get lintCode => LintNames.prefer_if_null_operators;
Future<void> test_equalEqual() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
print(s == null ? 'default' : s);
}
@@ -38,7 +38,7 @@
}
Future<void> test_malformed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s, bool b) {
print(b ? s != null ? s : : null);
}
@@ -52,7 +52,7 @@
Future<void> test_malformed_parentheses() async {
// https://github.com/dart-lang/sdk/issues/43432
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s, bool b) {
print(b ? (s != null ? s : ) : null);
}
@@ -65,7 +65,7 @@
}
Future<void> test_notEqual() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
print(s != null ? s : 'default');
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_int_literal_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_int_literal_test.dart
index e451086..154e215 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_int_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_int_literal_test.dart
@@ -25,7 +25,7 @@
/// More coverage in the `convert_to_int_literal_test.dart` assist test.
Future<void> test_decimal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
const double myDouble = 42.0;
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_list_literal_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_list_literal_test.dart
index 65f833c..160c5f4 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_list_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_list_literal_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_collection_literals;
Future<void> test_default_declaredType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
List l = List();
''');
await assertHasFix('''
@@ -33,7 +33,7 @@
}
Future<void> test_default_minimal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = List();
''');
await assertHasFix('''
@@ -42,7 +42,7 @@
}
Future<void> test_default_newKeyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = new List();
''');
await assertHasFix('''
@@ -51,7 +51,7 @@
}
Future<void> test_default_typeArg() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = List<int>();
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_map_literal_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_map_literal_test.dart
index 16926a1..3407683 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_map_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_map_literal_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_collection_literals;
Future<void> test_default_declaredType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Map m = Map();
''');
await assertHasFix('''
@@ -33,7 +33,7 @@
}
Future<void> test_default_linkedHashMap() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:collection';
var m = LinkedHashMap();
''');
@@ -44,7 +44,7 @@
}
Future<void> test_default_minimal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var m = Map();
''');
await assertHasFix('''
@@ -53,7 +53,7 @@
}
Future<void> test_default_newKeyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var m = new Map();
''');
await assertHasFix('''
@@ -62,7 +62,7 @@
}
Future<void> test_default_typeArg() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var m = Map<String, int>();
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_named_arguments_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_named_arguments_test.dart
index 95bcb68..cf35cc7 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_named_arguments_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_named_arguments_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.CONVERT_TO_NAMED_ARGUMENTS;
Future<void> test_ambiguous() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A({int a, int b});
}
@@ -33,7 +33,7 @@
}
Future<void> test_functionExpressionInvocation_getter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
void Function({int aaa}) get g => null;
}
@@ -54,7 +54,7 @@
}
Future<void> test_functionExpressionInvocation_variable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef F = void Function({int aaa});
main(F f) {
@@ -71,7 +71,7 @@
}
Future<void> test_instanceCreation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A({int a, double b});
}
@@ -92,7 +92,7 @@
}
Future<void> test_instanceCreation_hasPositional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A(int a, {int b});
}
@@ -113,7 +113,7 @@
}
Future<void> test_methodInvocation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
void foo({int a}) {}
}
@@ -134,7 +134,7 @@
}
Future<void> test_noCompatibleParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A({String a});
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_null_aware_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_null_aware_test.dart
index a3bca6d..52e07bf 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_null_aware_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_null_aware_test.dart
@@ -25,7 +25,7 @@
/// More coverage in the `convert_to_null_aware_test.dart` assist test.
Future<void> test_equal_nullOnLeft() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int m();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_on_type_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_on_type_test.dart
index 41d23a3..a6daf9b 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_on_type_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_on_type_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.avoid_types_as_parameter_names;
Future<void> test_withOnType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
try {
} on ArgumentError catch (Object) {
@@ -39,7 +39,7 @@
}
Future<void> test_withoutStackTrace() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
try {
} catch (ArgumentError) {
@@ -56,7 +56,7 @@
}
Future<void> test_withStackTrace() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
try {
} catch (ArgumentError, st) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart
index 0f607e6..35b1de0 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart
@@ -32,7 +32,7 @@
newFile('/home/test/lib/foo/bar.dart', content: '''
class C {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '../lib/foo/bar.dart';
C c;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_relative_import_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_relative_import_test.dart
index 471432f..8e59b5f 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_relative_import_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_relative_import_test.dart
@@ -29,7 +29,7 @@
class C {}
''');
testFile = convertPath('/home/test/lib/src/test.dart');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/foo.dart';
C c;
''');
@@ -44,7 +44,7 @@
// Validate we don't get a fix with imports referencing different packages.
addSource('/home/test1/lib/foo.dart', '');
testFile = convertPath('/home/test2/lib/bar.dart');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test1/foo.dart';
''');
@@ -54,7 +54,7 @@
Future<void> test_relativeImportGarbledUri() async {
addSource('/home/test/lib/foo.dart', '');
testFile = convertPath('/home/test/lib/bar.dart');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/foo';
''');
@@ -70,7 +70,7 @@
class C {}
''');
testFile = convertPath('/home/test/lib/bar.dart');
- await resolveTestUnit('''
+ await resolveTestCode('''
import "package:test/foo.dart";
C c;
''');
@@ -86,7 +86,7 @@
class C {}
''');
testFile = convertPath('/home/test/lib/bar.dart');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/foo.dart';
C c;
''');
@@ -102,7 +102,7 @@
class C {}
''');
testFile = convertPath('/home/test/lib/test.dart');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/baz/foo.dart';
C c;
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_set_literal_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_set_literal_test.dart
index 3f55c70..f12ee52 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_set_literal_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_set_literal_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_collection_literals;
Future<void> test_default_declaredType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Set s = Set();
''');
await assertHasFix('''
@@ -33,7 +33,7 @@
}
Future<void> test_default_minimal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = Set();
''');
await assertHasFix('''
@@ -42,7 +42,7 @@
}
Future<void> test_default_newKeyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = new Set();
''');
await assertHasFix('''
@@ -51,7 +51,7 @@
}
Future<void> test_default_typeArg() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = Set<int>();
''');
await assertHasFix('''
@@ -62,7 +62,7 @@
@failingTest
Future<void> test_default_typeArg_linkedHashSet() async {
// LinkedHashSet isn't converted even though the lint reports that case.
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:collection';
var s = LinkedHashSet<int>();
@@ -75,7 +75,7 @@
}
Future<void> test_from_empty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = Set.from([]);
''');
await assertHasFix('''
@@ -87,7 +87,7 @@
Future<void> test_from_inferred() async {
// _setWouldBeInferred does not check for inference based on the parameter
// type.
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(Set<int> s) {}
var s = f(Set.from([]));
''');
@@ -98,7 +98,7 @@
}
Future<void> test_from_newKeyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = new Set.from([2, 3]);
''');
await assertHasFix('''
@@ -107,7 +107,7 @@
}
Future<void> test_from_noKeyword_declaredType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Set s = Set.from([2, 3]);
''');
await assertHasFix('''
@@ -116,7 +116,7 @@
}
Future<void> test_from_noKeyword_typeArg_onConstructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = Set<int>.from([2, 3]);
''');
await assertHasFix('''
@@ -125,7 +125,7 @@
}
Future<void> test_from_noKeyword_typeArg_onConstructorAndLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = Set<int>.from(<num>[2, 3]);
''');
await assertHasFix('''
@@ -134,7 +134,7 @@
}
Future<void> test_from_noKeyword_typeArg_onLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = Set.from(<int>[2, 3]);
''');
await assertHasFix('''
@@ -143,7 +143,7 @@
}
Future<void> test_from_nonEmpty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = Set.from([2, 3]);
''');
await assertHasFix('''
@@ -152,7 +152,7 @@
}
Future<void> test_from_trailingComma() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = Set.from([2, 3,]);
''');
await assertHasFix('''
@@ -161,7 +161,7 @@
}
Future<void> test_toSet_empty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = [].toSet();
''');
await assertHasFix('''
@@ -170,7 +170,7 @@
}
Future<void> test_toSet_empty_typeArg() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = <int>[].toSet();
''');
await assertHasFix('''
@@ -179,7 +179,7 @@
}
Future<void> test_toSet_nonEmpty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = [2, 3].toSet();
''');
await assertHasFix('''
@@ -188,7 +188,7 @@
}
Future<void> test_toSet_nonEmpty_typeArg() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = <int>[2, 3].toSet();
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_single_quoted_string_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_single_quoted_string_test.dart
index 9c46609..12f8212 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_single_quoted_string_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_single_quoted_string_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_single_quotes;
Future<void> test_one_interpolation() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
var b = 'b';
var c = 'c';
@@ -42,7 +42,7 @@
/// More coverage in the `convert_to_single_quoted_string_test.dart` assist test.
Future<void> test_one_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print("abc");
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_spread_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_spread_test.dart
index bcf9a8e..bb9b5c8 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_spread_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_spread_test.dart
@@ -25,7 +25,7 @@
/// More coverage in the `convert_to_spread_test.dart` assist test.
Future<void> test_addAll_expression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
var ints = [1, 2, 3];
print(['a']..addAll(ints.map((i) => i.toString()))..addAll(['c']));
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_where_type_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_where_type_test.dart
index e843e15..7768534 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_where_type_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_where_type_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_iterable_whereType;
Future<void> test_default_declaredType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Iterable<C> f(List<Object> list) {
return list.where((e) => e is C);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_class_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_class_test.dart
index 10f5a1a..b81a200 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_class_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_class_test.dart
@@ -22,7 +22,7 @@
FixKind get kind => DartFixKind.CREATE_CLASS;
Future<void> test_annotation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
@Test('a')
void f() {}
''');
@@ -39,7 +39,7 @@
}
Future<void> test_extends() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyClass extends BaseClass {}
''');
await assertHasFix('''
@@ -51,7 +51,7 @@
}
Future<void> test_hasUnresolvedPrefix() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
prefix.Test v = null;
print(v);
@@ -61,7 +61,7 @@
}
Future<void> test_implements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyClass implements BaseClass {}
''');
await assertHasFix('''
@@ -77,7 +77,7 @@
class A {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'lib.dart' as lib;
main() {
@@ -97,7 +97,7 @@
}
Future<void> test_innerLocalFunction() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
g() {
Test v = null;
@@ -122,7 +122,7 @@
}
Future<void> test_instanceCreation_withoutNew_fromFunction() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Test ();
}
@@ -139,7 +139,7 @@
}
Future<void> test_instanceCreation_withoutNew_fromMethod() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
Test ();
@@ -160,7 +160,7 @@
}
Future<void> test_itemOfList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var a = [Test];
print(a);
@@ -179,7 +179,7 @@
}
Future<void> test_itemOfList_inAnnotation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyAnnotation {
const MyAnnotation(a, b);
}
@@ -202,7 +202,7 @@
}
Future<void> test_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Test v = null;
print(v);
@@ -221,7 +221,7 @@
}
Future<void> test_with() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyClass with BaseClass {}
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_for_final_fields_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_for_final_fields_test.dart
index 1b587fa..32efaed 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_for_final_fields_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_for_final_fields_test.dart
@@ -23,7 +23,7 @@
Future<void> test_flutter() async {
writeTestPackageConfig(flutter: true);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class MyWidget extends StatelessWidget {
@@ -49,7 +49,7 @@
Future<void> test_flutter_childLast() async {
writeTestPackageConfig(flutter: true);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class MyWidget extends StatelessWidget {
@@ -75,7 +75,7 @@
Future<void> test_flutter_childrenLast() async {
writeTestPackageConfig(flutter: true);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class MyWidget extends StatelessWidget {
@@ -100,7 +100,7 @@
}
Future<void> test_inTopLevelMethod() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
final int v;
print(v);
@@ -110,7 +110,7 @@
}
Future<void> test_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Test {
final int a;
final int b = 2;
@@ -131,7 +131,7 @@
}
Future<void> test_topLevelField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
final int v;
''');
await assertNoFix();
@@ -145,7 +145,7 @@
FixKind get kind => DartFixKind.CREATE_CONSTRUCTOR_FOR_FINAL_FIELDS;
Future<void> test_excludesLate() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Test {
final int a;
late final int b;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart
index c6a46c6..19af80e 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_super_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.CREATE_CONSTRUCTOR_SUPER;
Future<void> test_fieldInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int _field;
A(this._field);
@@ -59,7 +59,7 @@
B(A a);
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/b.dart';
class C extends B {
@@ -76,7 +76,7 @@
}
Future<void> test_named() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A.named(p1, int p2);
}
@@ -101,7 +101,7 @@
}
Future<void> test_optional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A(p1, int p2, List<String> p3, [int p4]);
}
@@ -126,7 +126,7 @@
}
Future<void> test_private() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A._named(p);
}
@@ -137,7 +137,7 @@
}
Future<void> test_typeArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C<T> {
final T x;
C(this.x);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_test.dart
index 0512623..b4a31d8 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_constructor_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_constructor_test.dart
@@ -22,7 +22,7 @@
FixKind get kind => DartFixKind.CREATE_CONSTRUCTOR;
Future<void> test_named() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {}
main() {
@@ -45,7 +45,7 @@
/// $_text200
class A {}
''').path;
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'a.dart';
main() {
@@ -65,7 +65,7 @@
/// $_text200
class A {}
''').path;
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'a.dart';
main() {
@@ -81,7 +81,7 @@
}
Future<void> test_insteadOfSyntheticDefault() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int field;
@@ -107,7 +107,7 @@
Future<void> test_mixin() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {}
void f() {
new M(3);
@@ -119,7 +119,7 @@
}
Future<void> test_named() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
method() {}
}
@@ -141,7 +141,7 @@
}
Future<void> test_named_emptyClassBody() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
main() {
new A.named(1);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
index df32308..869bda5 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_field_test.dart
@@ -22,7 +22,7 @@
FixKind get kind => DartFixKind.CREATE_FIELD;
Future<void> test_getter_qualified_instance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {
}
@@ -44,7 +44,7 @@
}
Future<void> test_setter_qualified_instance_hasField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {
int aaa;
int zzz;
@@ -79,7 +79,7 @@
FixKind get kind => DartFixKind.CREATE_FIELD;
Future<void> test_getter_multiLevel() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
class B {
@@ -111,7 +111,7 @@
}
Future<void> test_getter_qualified_instance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
main(A a) {
@@ -142,7 +142,7 @@
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/other.dart';
main(A a) {
@@ -165,7 +165,7 @@
}
Future<void> test_getter_qualified_instance_dynamicType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
B b;
void f(dynamic context) {
@@ -189,7 +189,7 @@
}
Future<void> test_getter_qualified_propagatedType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A get self => this;
}
@@ -214,7 +214,7 @@
}
Future<void> test_getter_unqualified_instance_asInvocationArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
f(test);
@@ -235,7 +235,7 @@
}
Future<void> test_getter_unqualified_instance_assignmentRhs() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
int v = test;
@@ -256,7 +256,7 @@
}
Future<void> test_getter_unqualified_instance_asStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
test;
@@ -275,7 +275,7 @@
}
Future<void> test_hint() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
main(A a) {
@@ -297,7 +297,7 @@
}
Future<void> test_hint_setter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
main(A a) {
@@ -327,7 +327,7 @@
A getA() => null;
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/b.dart';
class C {
@@ -353,7 +353,7 @@
}
Future<void> test_inEnum() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
enum MyEnum {
AAA, BBB
}
@@ -370,7 +370,7 @@
class A {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/a.dart';
main(A a) {
@@ -384,7 +384,7 @@
}
Future<void> test_inPart_self() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
part of lib;
class A {
}
@@ -397,7 +397,7 @@
}
Future<void> test_inSDK() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List p) {
p.foo = 1;
}
@@ -406,7 +406,7 @@
}
Future<void> test_invalidInitializer_withoutType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
C(this.text);
}
@@ -421,7 +421,7 @@
}
Future<void> test_invalidInitializer_withType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
C(String this.text);
}
@@ -436,7 +436,7 @@
}
Future<void> test_setter_generic_BAD() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
class B<T> {
@@ -460,7 +460,7 @@
}
Future<void> test_setter_generic_OK_local() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A<T> {
List<T> items;
@@ -483,7 +483,7 @@
}
Future<void> test_setter_qualified_instance_hasField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int aaa;
int zzz;
@@ -510,7 +510,7 @@
}
Future<void> test_setter_qualified_instance_hasMethod() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
existingMethod() {}
}
@@ -531,7 +531,7 @@
}
Future<void> test_setter_qualified_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
main() {
@@ -549,7 +549,7 @@
}
Future<void> test_setter_unqualified_instance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
test = 5;
@@ -568,7 +568,7 @@
}
Future<void> test_setter_unqualified_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static main() {
test = 5;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_file_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_file_test.dart
index 0389835..0c156d3 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_file_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_file_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.CREATE_FILE;
Future<void> test_forImport() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'my_file.dart';
''');
await assertHasFixWithoutApplying();
@@ -39,14 +39,14 @@
}
Future<void> test_forImport_BAD_notDart() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'my_file.txt';
''');
await assertNoFix();
}
Future<void> test_forImport_inPackage_lib() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'a/bb/my_lib.dart';
''');
await assertHasFixWithoutApplying();
@@ -65,7 +65,7 @@
Future<void> test_forImport_inPackage_test() async {
testFile = convertPath('/home/test/test/test.dart');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'a/bb/my_lib.dart';
''');
await assertHasFixWithoutApplying();
@@ -83,7 +83,7 @@
}
Future<void> test_forPart() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
library my.lib;
part 'my_part.dart';
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart
index ca334c7..dff3ac4 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.CREATE_FUNCTION;
Future<void> assert_returnType_bool(String lineWithTest) async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
bool b = true;
$lineWithTest
@@ -41,7 +41,7 @@
}
Future<void> test_bottomArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
test(throw 42);
}
@@ -57,7 +57,7 @@
}
Future<void> test_duplicateArgumentNames() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int x;
}
@@ -81,7 +81,7 @@
}
Future<void> test_dynamicArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
dynamic v;
test(v);
@@ -99,7 +99,7 @@
}
Future<void> test_dynamicReturnType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
dynamic v = test();
print(v);
@@ -117,7 +117,7 @@
}
Future<void> test_fromFunction() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int v = myUndefinedFunction(1, 2.0, '3');
print(v);
@@ -135,7 +135,7 @@
}
Future<void> test_fromMethod() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
int v = myUndefinedFunction(1, 2.0, '3');
@@ -157,7 +157,7 @@
}
Future<void> test_functionType_cascadeSecond() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
B ma() => null;
}
@@ -189,7 +189,7 @@
}
Future<void> test_functionType_coreFunction() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
useFunction(g: test);
}
@@ -207,7 +207,7 @@
}
Future<void> test_functionType_dynamicArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
useFunction(test);
}
@@ -225,7 +225,7 @@
}
Future<void> test_functionType_function() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
useFunction(test);
}
@@ -243,7 +243,7 @@
}
Future<void> test_functionType_function_namedArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
useFunction(g: test);
}
@@ -269,7 +269,7 @@
useFunction(int g(A a)) {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/b.dart';
main() {
@@ -290,7 +290,7 @@
}
Future<void> test_functionType_notFunctionType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(A a) {
useFunction(a.test);
}
@@ -301,7 +301,7 @@
}
Future<void> test_generic_type() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
List<int> items;
main() {
@@ -328,7 +328,7 @@
}
Future<void> test_generic_typeParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A<T> {
Map<int, T> items;
main() {
@@ -355,7 +355,7 @@
import 'dart:async';
Future getFuture() => null;
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'lib.dart';
main() {
test(getFuture());
@@ -373,7 +373,7 @@
}
Future<void> test_nullArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
test(null);
}
@@ -389,7 +389,7 @@
}
Future<void> test_parameterName_fromIndexExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int operator[](int _) => 0;
@@ -449,7 +449,7 @@
}
Future<void> test_returnType_fromAssignment_eq() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int v;
v = myUndefinedFunction();
@@ -469,7 +469,7 @@
}
Future<void> test_returnType_fromAssignment_plusEq() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int v;
v += myUndefinedFunction();
@@ -489,7 +489,7 @@
}
Future<void> test_returnType_fromBinary_right() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
0 + myUndefinedFunction();
}
@@ -505,7 +505,7 @@
}
Future<void> test_returnType_fromInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int v = myUndefinedFunction();
print(v);
@@ -523,7 +523,7 @@
}
Future<void> test_returnType_fromInvocationArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo(int p) {}
main() {
foo( myUndefinedFunction() );
@@ -541,7 +541,7 @@
}
Future<void> test_returnType_fromReturn() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
int main() {
return myUndefinedFunction();
}
@@ -557,7 +557,7 @@
}
Future<void> test_returnType_void() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
myUndefinedFunction();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
index c8797e3..af7db0e 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_getter_test.dart
@@ -22,7 +22,7 @@
FixKind get kind => DartFixKind.CREATE_GETTER;
Future<void> test_qualified_instance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {
}
@@ -44,7 +44,7 @@
}
Future<void> test_unqualified_instance_assignmentLhs() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {
main() {
test = 42;
@@ -55,7 +55,7 @@
}
Future<void> test_unqualified_instance_assignmentRhs() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {
main() {
int v = test;
@@ -82,7 +82,7 @@
FixKind get kind => DartFixKind.CREATE_GETTER;
Future<void> test_hint_getter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
main(A a) {
@@ -104,7 +104,7 @@
}
Future<void> test_inSDK() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List p) {
int v = p.foo;
print(v);
@@ -114,7 +114,7 @@
}
Future<void> test_internal_instance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {
int m() => g;
}
@@ -129,7 +129,7 @@
}
Future<void> test_internal_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {
static int m() => g;
}
@@ -144,7 +144,7 @@
}
Future<void> test_location_afterLastGetter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int existingField;
@@ -175,7 +175,7 @@
}
Future<void> test_multiLevel() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
class B {
@@ -207,7 +207,7 @@
}
Future<void> test_override() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {
}
@@ -229,7 +229,7 @@
}
Future<void> test_qualified_instance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
main(A a) {
@@ -260,7 +260,7 @@
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/other.dart';
main(A a) {
@@ -283,7 +283,7 @@
}
Future<void> test_qualified_instance_dynamicType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
B b;
void f(dynamic context) {
@@ -313,7 +313,7 @@
class A {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/a.dart';
main(A a) {
@@ -327,7 +327,7 @@
}
Future<void> test_qualified_instance_inPart_self() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
part of lib;
class A {
@@ -342,7 +342,7 @@
}
Future<void> test_qualified_propagatedType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A get self => this;
}
@@ -367,7 +367,7 @@
}
Future<void> test_setterContext() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
main(A a) {
@@ -378,7 +378,7 @@
}
Future<void> test_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {
}
@@ -400,7 +400,7 @@
}
Future<void> test_unqualified_instance_asInvocationArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
f(test);
@@ -421,7 +421,7 @@
}
Future<void> test_unqualified_instance_assignmentLhs() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
test = 42;
@@ -432,7 +432,7 @@
}
Future<void> test_unqualified_instance_assignmentRhs() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
int v = test;
@@ -453,7 +453,7 @@
}
Future<void> test_unqualified_instance_asStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
test;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_local_variable_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_local_variable_test.dart
index 06132ad..2c1d827 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_local_variable_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_local_variable_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_functionType_named() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef MY_FUNCTION(int p);
foo(MY_FUNCTION f) {}
main() {
@@ -46,7 +46,7 @@
}
Future<void> test_functionType_named_generic() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef MY_FUNCTION<T>(T p);
foo(MY_FUNCTION<int> f) {}
main() {
@@ -64,7 +64,7 @@
}
Future<void> test_functionType_synthetic() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo(f(int p)) {}
main() {
foo(bar);
@@ -80,7 +80,7 @@
}
Future<void> test_read_typeAssignment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int a = test;
print(a);
@@ -96,7 +96,7 @@
}
Future<void> test_read_typeCondition() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
if (!test) {
print(42);
@@ -114,7 +114,7 @@
}
Future<void> test_read_typeInvocationArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
f(test);
}
@@ -132,7 +132,7 @@
}
Future<void> test_read_typeInvocationTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
test.add('hello');
}
@@ -167,7 +167,7 @@
..add(name: 'pkg', rootPath: '$workspaceRootPath/pkg'),
);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:pkg/a/a.dart';
import 'package:pkg/c/c.dart';
@@ -201,7 +201,7 @@
}
Future<void> test_write_assignment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
test = 42;
}
@@ -214,7 +214,7 @@
}
Future<void> test_write_assignment_compound() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
test += 42;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart
index f93b1cc..4549b21 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_method_test.dart
@@ -27,7 +27,7 @@
String get lintCode => LintNames.hash_and_equals;
Future<void> test_equals() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
@override
int get hashCode => 13;
@@ -49,7 +49,7 @@
/// See: https://github.com/dart-lang/sdk/issues/43867
Future<void> test_equals_fieldHashCode() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
@override
int hashCode = 13;
@@ -70,7 +70,7 @@
}
Future<void> test_hashCode() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
@override
bool operator ==(Object other) => false;
@@ -96,7 +96,7 @@
FixKind get kind => DartFixKind.CREATE_METHOD;
Future<void> test_createQualified_instance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {}
main(M m) {
@@ -115,7 +115,7 @@
}
Future<void> test_createQualified_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {}
main() {
@@ -134,7 +134,7 @@
}
Future<void> test_createUnqualified() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {
main() {
myUndefinedMethod();
@@ -153,7 +153,7 @@
}
Future<void> test_functionType_method_enclosingMixin_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {
static foo() {
useFunction(test);
@@ -177,7 +177,7 @@
}
Future<void> test_functionType_method_targetMixin() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(M m) {
useFunction(m.test);
}
@@ -208,7 +208,7 @@
FixKind get kind => DartFixKind.CREATE_METHOD;
Future<void> test_createQualified_emptyClassBody() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
main() {
A.myUndefinedMethod();
@@ -225,7 +225,7 @@
}
Future<void> test_createQualified_fromClass() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
main() {
@@ -243,7 +243,7 @@
}
Future<void> test_createQualified_fromClass_hasOtherMember() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
foo() {}
}
@@ -264,7 +264,7 @@
}
Future<void> test_createQualified_fromInstance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
main(A a) {
@@ -282,7 +282,7 @@
}
Future<void> test_createQualified_targetIsFunctionType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef A();
main() {
A.myUndefinedMethod();
@@ -292,7 +292,7 @@
}
Future<void> test_createQualified_targetIsUnresolved() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
NoSuchClass.myUndefinedMethod();
}
@@ -301,7 +301,7 @@
}
Future<void> test_createUnqualified_duplicateArgumentNames() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int x;
}
@@ -326,7 +326,7 @@
}
Future<void> test_createUnqualified_parameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
myUndefinedMethod(0, 1.0, '3');
@@ -369,7 +369,7 @@
}
Future<void> test_createUnqualified_parameters_named() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
myUndefinedMethod(0, bbb: 1.0, ccc: '2');
@@ -410,7 +410,7 @@
}
Future<void> test_createUnqualified_returnType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
int v = myUndefinedMethod();
@@ -435,7 +435,7 @@
}
Future<void> test_createUnqualified_staticFromField() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static var f = myUndefinedMethod();
}
@@ -450,7 +450,7 @@
}
Future<void> test_createUnqualified_staticFromMethod() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static main() {
myUndefinedMethod();
@@ -469,7 +469,7 @@
}
Future<void> test_functionType_method_enclosingClass_instance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
void m1() {
m2(m3);
@@ -493,7 +493,7 @@
}
Future<void> test_functionType_method_enclosingClass_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static foo() {
useFunction(test);
@@ -515,7 +515,7 @@
}
Future<void> test_functionType_method_enclosingClass_static2() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
var f;
A() : f = useFunction(test);
@@ -535,7 +535,7 @@
}
Future<void> test_functionType_method_targetClass() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(A a) {
useFunction(a.test);
}
@@ -556,7 +556,7 @@
}
Future<void> test_functionType_method_targetClass_hasOtherMember() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(A a) {
useFunction(a.test);
}
@@ -580,7 +580,7 @@
}
Future<void> test_functionType_notFunctionType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(A a) {
useFunction(a.test);
}
@@ -591,7 +591,7 @@
}
Future<void> test_functionType_unknownTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(A a) {
useFunction(a.test);
}
@@ -603,7 +603,7 @@
}
Future<void> test_generic_argumentType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A<T> {
B b;
Map<int, T> items;
@@ -631,7 +631,7 @@
}
Future<void> test_generic_literal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
B b;
List<int> items;
@@ -658,7 +658,7 @@
}
Future<void> test_generic_local() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A<T> {
List<T> items;
main() {
@@ -679,7 +679,7 @@
}
Future<void> test_generic_returnType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A<T> {
main() {
T t = new B().compute();
@@ -705,7 +705,7 @@
}
Future<void> test_hint_createQualified_fromInstance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
main() {
@@ -725,7 +725,7 @@
}
Future<void> test_inSDK() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
List.foo();
}
@@ -734,7 +734,7 @@
}
Future<void> test_internal_instance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {
int m() => n();
}
@@ -749,7 +749,7 @@
}
Future<void> test_internal_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {
static int m() => n();
}
@@ -764,7 +764,7 @@
}
Future<void> test_override() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {}
void f() {
@@ -797,7 +797,7 @@
class E {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'test2.dart' as aaa;
main(aaa.D d, aaa.E e) {
@@ -823,7 +823,7 @@
class E {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'test2.dart' as test2;
main(test2.D d, test2.E e) {
@@ -841,7 +841,7 @@
}
Future<void> test_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {}
void f() {
@@ -860,7 +860,7 @@
}
Future<void> test_targetIsEnum() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
enum MyEnum {A, B}
main() {
MyEnum.foo();
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_missing_overrides_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_missing_overrides_test.dart
index 8cafbac..300d9aa 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_missing_overrides_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_missing_overrides_test.dart
@@ -23,7 +23,7 @@
FixKind get kind => DartFixKind.CREATE_MISSING_OVERRIDES;
Future<void> test_field_untyped() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
var f;
}
@@ -44,7 +44,7 @@
}
Future<void> test_functionTypeAlias() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef int Binary(int left, int right);
abstract class Emulator {
@@ -71,7 +71,7 @@
}
Future<void> test_functionTypedParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
void forEach(int f(double p1, String p2));
}
@@ -94,7 +94,7 @@
}
Future<void> test_generics_typeArguments() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Iterator<T> {
}
@@ -122,7 +122,7 @@
}
Future<void> test_generics_typeParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class ItemProvider<T> {
List<T> getItems();
}
@@ -146,7 +146,7 @@
}
Future<void> test_getter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
get g1;
int get g2;
@@ -174,7 +174,7 @@
}
Future<void> test_importPrefix() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async' as aaa;
abstract class A {
Map<aaa.Future, List<aaa.Future>> g(aaa.Future p);
@@ -200,7 +200,7 @@
}
Future<void> test_mergeToField_getterSetter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int ma;
void mb() {}
@@ -233,7 +233,7 @@
}
Future<void> test_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
void m1();
int m2();
@@ -311,7 +311,7 @@
}
Future<void> test_method_emptyClassBody() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
void foo();
}
@@ -333,7 +333,7 @@
}
Future<void> test_method_generic() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C<T> {}
class V<E> {}
@@ -364,7 +364,7 @@
Future<void> test_method_generic_withBounds() async {
// https://github.com/dart-lang/sdk/issues/31199
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A<K, V> {
List<T> foo<T extends V>(K key);
}
@@ -388,7 +388,7 @@
}
Future<void> test_method_genericClass2() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A<R> {
R foo(int a) => null;
}
@@ -426,7 +426,7 @@
}
Future<void> test_method_namedParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
foo({int i});
}
@@ -453,7 +453,7 @@
}
Future<void> test_method_notEmptyClassBody() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
void foo();
}
@@ -482,7 +482,7 @@
Future<void> test_method_withTypedef() async {
// This fails because the element representing `Base.closure` has a return
// type that has forgotten that it was declared using the typedef `Closure`.
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef Closure = T Function<T>(T input);
abstract class Base {
@@ -508,7 +508,7 @@
}
Future<void> test_methods_reverseOrder() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
foo(int i);
bar(String bar);
@@ -542,7 +542,7 @@
}
Future<void> test_operator() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
int operator [](int index);
void operator []=(int index, String value);
@@ -573,7 +573,7 @@
}
Future<void> test_setter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
set s1(x);
set s2(int x);
@@ -618,7 +618,7 @@
Future<void> test_method_generic_nullable_dynamic() async {
// https://github.com/dart-lang/sdk/issues/43535
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
void doSomething(Map<String, dynamic>? m) {}
}
@@ -641,7 +641,7 @@
Future<void> test_method_generic_nullable_Never() async {
// https://github.com/dart-lang/sdk/issues/43535
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
void doSomething(Map<String, Never>? m) {}
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_mixin_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_mixin_test.dart
index 3945682..024eab8 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_mixin_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_mixin_test.dart
@@ -22,7 +22,7 @@
FixKind get kind => DartFixKind.CREATE_MIXIN;
Future<void> test_hasUnresolvedPrefix() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
prefix.Test v = null;
print(v);
@@ -36,7 +36,7 @@
class A {}
''';
addSource('/home/test/lib/lib.dart', libCode);
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'lib.dart' as lib;
main() {
@@ -55,7 +55,7 @@
}
Future<void> test_innerLocalFunction() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
g() {
Test v = null;
@@ -80,7 +80,7 @@
}
Future<void> test_instanceCreation_withNew() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
new Test();
}
@@ -89,7 +89,7 @@
}
Future<void> test_instanceCreation_withoutNew() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Test();
}
@@ -98,7 +98,7 @@
}
Future<void> test_itemOfList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var a = [Test];
print(a);
@@ -117,7 +117,7 @@
}
Future<void> test_itemOfList_inAnnotation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyAnnotation {
const MyAnnotation(a, b);
}
@@ -140,7 +140,7 @@
}
Future<void> test_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Test v = null;
print(v);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_no_such_method_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_no_such_method_test.dart
index 9f904f3..19bfb81 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_no_such_method_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_no_such_method_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.CREATE_NO_SUCH_METHOD;
Future<void> test_class() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
m1();
int m2();
@@ -45,7 +45,7 @@
}
Future<void> test_classTypeAlias() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
m();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
index 1a984bf..610f7dc 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_setter_test.dart
@@ -22,7 +22,7 @@
FixKind get kind => DartFixKind.CREATE_SETTER;
Future<void> test_qualified_instance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {
}
@@ -42,7 +42,7 @@
}
Future<void> test_unqualified_instance_assignmentLhs() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {
main() {
test = 0;
@@ -61,7 +61,7 @@
}
Future<void> test_unqualified_instance_assignmentRhs() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {
main() {
test;
@@ -78,7 +78,7 @@
FixKind get kind => DartFixKind.CREATE_SETTER;
Future<void> test_getterContext() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
main(A a) {
@@ -89,7 +89,7 @@
}
Future<void> test_inferredTargetType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
main(A a) {
@@ -109,7 +109,7 @@
}
Future<void> test_inSDK() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(List p) {
p.foo = 0;
}
@@ -118,7 +118,7 @@
}
Future<void> test_internal_instance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {
int m(int x) => s = x;
}
@@ -133,7 +133,7 @@
}
Future<void> test_internal_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {
static int m(int x) => s = x;
}
@@ -148,7 +148,7 @@
}
Future<void> test_location_afterLastAccessor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int existingField;
@@ -177,7 +177,7 @@
}
Future<void> test_multiLevel() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
class B {
@@ -207,7 +207,7 @@
}
Future<void> test_override() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {
}
@@ -227,7 +227,7 @@
}
Future<void> test_qualified_instance() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
}
main(A a) {
@@ -256,7 +256,7 @@
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/other.dart';
main(A a) {
@@ -278,7 +278,7 @@
}
Future<void> test_qualified_instance_dynamicType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
B b;
void f(p) {
@@ -308,7 +308,7 @@
class A {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/a.dart';
main(A a) {
@@ -321,7 +321,7 @@
}
Future<void> test_qualified_instance_inPart_self() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
part of lib;
class A {
@@ -335,7 +335,7 @@
}
Future<void> test_qualified_propagatedType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A get self => this;
}
@@ -358,7 +358,7 @@
}
Future<void> test_static() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {
}
@@ -378,7 +378,7 @@
}
Future<void> test_unqualified_instance_assignmentLhs() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
test = 0;
@@ -397,7 +397,7 @@
}
Future<void> test_unqualified_instance_assignmentRhs() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
test;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/add_type_parameter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/add_type_parameter_test.dart
index 18a504a..6b81786 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/add_type_parameter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/add_type_parameter_test.dart
@@ -33,7 +33,7 @@
}
''');
setPackageData(_add(0, components: ['C', 'C']));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
C f() {
@@ -54,7 +54,7 @@
class A<S, T> {}
''');
setPackageData(_add(0, components: ['A']));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class B extends A<int> {}
@@ -71,7 +71,7 @@
class A<S, T> {}
''');
setPackageData(_add(0, components: ['A']));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class B implements A<int> {}
@@ -88,7 +88,7 @@
class A<S, T> {}
''');
setPackageData(_add(0, components: ['A']));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
extension E on A<int> {}
@@ -105,7 +105,7 @@
class C<S, T> {}
''');
setPackageData(_add(0, components: ['C']));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C<int> c) {}
@@ -122,7 +122,7 @@
class A<S, T> {}
''');
setPackageData(_add(0, components: ['A']));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class B with A<int> {}
@@ -148,7 +148,7 @@
}
''');
setPackageData(_add(0, components: ['E']));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -178,7 +178,7 @@
}
''');
setPackageData(_add(0));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -201,7 +201,7 @@
}
''');
setPackageData(_add(0));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -225,7 +225,7 @@
}
''');
setPackageData(_add(2));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -249,7 +249,7 @@
}
''');
setPackageData(_add(1));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -273,7 +273,7 @@
}
''');
setPackageData(_add(0));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -296,7 +296,7 @@
}
''');
setPackageData(_add(0, extendedType: 'num'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class D extends C {
@@ -321,7 +321,7 @@
}
''');
setPackageData(_add(0));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class D extends C {
@@ -350,7 +350,7 @@
mixin M<S, T> {}
''');
setPackageData(_add(0, components: ['M']));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class B with M<int> {}
@@ -374,7 +374,7 @@
void f() {}
''');
setPackageData(_add(0, components: ['f']));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void g() {
@@ -409,7 +409,7 @@
typedef F = T Function<S, T>();
''');
setPackageData(_add(0, components: ['F']));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void g(F f) {
@@ -430,7 +430,7 @@
typedef F<S, T> = T Function();
''');
setPackageData(_add(0, components: ['F']));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void g(F<int> f) {
@@ -455,7 +455,7 @@
typedef F<T> = T Function();
''');
setPackageData(_add(0, components: ['F']));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void g(F f) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/code_fragment_parser_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/code_fragment_parser_test.dart
index 719eb33..75e883e 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/code_fragment_parser_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/code_fragment_parser_test.dart
@@ -53,25 +53,33 @@
void test_arguments_arguments_arguments() {
var accessors = assertNoErrors('arguments[0].arguments[1].arguments[2]');
expect(accessors, hasLength(3));
+ expect(accessors[0], isA<ArgumentAccessor>());
+ expect(accessors[1], isA<ArgumentAccessor>());
+ expect(accessors[2], isA<ArgumentAccessor>());
}
void test_arguments_named() {
var accessors = assertNoErrors('arguments[foo]');
expect(accessors, hasLength(1));
+ expect(accessors[0], isA<ArgumentAccessor>());
}
void test_arguments_positional() {
var accessors = assertNoErrors('arguments[0]');
expect(accessors, hasLength(1));
+ expect(accessors[0], isA<ArgumentAccessor>());
}
void test_arguments_typeArguments() {
var accessors = assertNoErrors('arguments[0].typeArguments[0]');
expect(accessors, hasLength(2));
+ expect(accessors[0], isA<ArgumentAccessor>());
+ expect(accessors[1], isA<TypeArgumentAccessor>());
}
void test_typeArguments() {
var accessors = assertNoErrors('typeArguments[0]');
expect(accessors, hasLength(1));
+ expect(accessors[0], isA<TypeArgumentAccessor>());
}
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/code_template_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/code_template_test.dart
index 22a45ab..ebcdb94 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/code_template_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/code_template_test.dart
@@ -66,7 +66,7 @@
Future<void> _assertTemplateResult(
String expectedResult, List<TemplateComponent> components) async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
g(0, 1);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/end_to_end_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/end_to_end_test.dart
index df98271..eb13dcf 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/end_to_end_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/end_to_end_test.dart
@@ -41,7 +41,7 @@
kind: 'fragment'
value: 'arguments[0]'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -84,7 +84,7 @@
kind: 'fragment'
value: 'arguments[0]'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -119,7 +119,7 @@
- kind: 'removeParameter'
index: 1
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -152,7 +152,7 @@
- kind: 'rename'
newName: 'New'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Old o) {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/flutter_use_case_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/flutter_use_case_test.dart
index 074330b..4c619b7 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/flutter_use_case_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/flutter_use_case_test.dart
@@ -43,7 +43,7 @@
oldName: 'child'
newName: 'content'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -84,7 +84,7 @@
oldName: 'child'
newName: 'content'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -124,7 +124,7 @@
- kind: 'rename'
newName: 'CupertinoPopupSurface'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -160,7 +160,7 @@
- kind: 'rename'
newName: 'CupertinoPopupSurface'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -203,7 +203,7 @@
- kind: 'removeParameter'
name: 'brightness'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(CupertinoTextThemeData data) {
@@ -245,7 +245,7 @@
- kind: 'removeParameter'
name: 'brightness'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(CupertinoTextThemeData data) {
@@ -288,7 +288,7 @@
- kind: 'removeParameter'
name: 'brightness'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -331,7 +331,7 @@
- kind: 'removeParameter'
name: 'brightness'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -371,7 +371,7 @@
- kind: 'rename'
newName: 'fromMouseEvent'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(PointerHoverEvent event) {
@@ -408,7 +408,7 @@
- kind: 'rename'
newName: 'fromMouseEvent'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(PointerHoverEvent event) {
@@ -448,7 +448,7 @@
- kind: 'rename'
newName: 'fromMouseEvent'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(PointerHoverEvent event) {
@@ -485,7 +485,7 @@
- kind: 'rename'
newName: 'fromMouseEvent'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(PointerHoverEvent event) {
@@ -523,7 +523,7 @@
- kind: 'rename'
newName: 'resizeToAvoidBottomInset'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Scaffold scaffold) {
@@ -559,7 +559,7 @@
- kind: 'rename'
newName: 'resizeToAvoidBottomInset'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Scaffold scaffold) {
@@ -609,7 +609,7 @@
- kind: 'removeParameter'
name: 'child'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Widget widget) {
@@ -659,7 +659,7 @@
- kind: 'removeParameter'
name: 'child'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Widget widget) {
@@ -696,7 +696,7 @@
- kind: 'rename'
newName: 'headline1'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(TextTheme theme) {
@@ -731,7 +731,7 @@
- kind: 'rename'
newName: 'headline1'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(TextTheme theme) {
@@ -768,7 +768,7 @@
- kind: 'rename'
newName: 'material2014'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -803,7 +803,7 @@
- kind: 'rename'
newName: 'material2014'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -852,7 +852,7 @@
- kind: 'removeParameter'
index: 0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(BuildContext context) {
@@ -899,7 +899,7 @@
- kind: 'removeParameter'
index: 0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(BuildContext context) {
@@ -916,6 +916,56 @@
}
Future<void>
+ test_widgets_BuildContext_ancestorStateOfType_deprecated() async {
+ setPackageContent('''
+class BuildContext {
+ @deprecated
+ void ancestorStateOfType(TypeMatcher matcher) {}
+ void findAncestorStateOfType<T>() {}
+}
+class TypeMatcher<T> {}
+''');
+ addPackageDataFile('''
+version: 1
+transforms:
+ - title: 'Rename to findAncestorStateOfType'
+ date: 2020-09-14
+ element:
+ uris: ['$importUri']
+ method: 'ancestorStateOfType'
+ inClass: 'BuildContext'
+ changes:
+ - kind: 'rename'
+ newName: 'findAncestorStateOfType'
+ - kind: 'addTypeParameter'
+ index: 0
+ name: 'T'
+ argumentValue:
+ expression: '{% type %}'
+ variables:
+ type:
+ kind: 'fragment'
+ value: 'arguments[0].typeArguments[0]'
+ - kind: 'removeParameter'
+ index: 0
+''');
+ await resolveTestCode('''
+import '$importUri';
+
+void f(BuildContext context) {
+ context.ancestorStateOfType(TypeMatcher<String>());
+}
+''');
+ await assertHasFix('''
+import '$importUri';
+
+void f(BuildContext context) {
+ context.findAncestorStateOfType<String>();
+}
+''');
+ }
+
+ Future<void>
test_widgets_BuildContext_ancestorWidgetOfExactType_deprecated() async {
setPackageContent('''
class BuildContext {
@@ -948,7 +998,7 @@
- kind: 'removeParameter'
index: 0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(BuildContext context) {
@@ -995,7 +1045,7 @@
- kind: 'removeParameter'
index: 0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(BuildContext context) {
@@ -1032,7 +1082,7 @@
- kind: 'rename'
newName: 'dependOnInheritedElement'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(BuildContext context) {
@@ -1067,7 +1117,7 @@
- kind: 'rename'
newName: 'dependOnInheritedElement'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(BuildContext context) {
@@ -1116,7 +1166,7 @@
- kind: 'removeParameter'
index: 0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(BuildContext context) {
@@ -1163,7 +1213,7 @@
- kind: 'removeParameter'
index: 0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(BuildContext context) {
@@ -1212,7 +1262,7 @@
- kind: 'removeParameter'
index: 0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Element element) {
@@ -1259,7 +1309,7 @@
- kind: 'removeParameter'
index: 0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Element element) {
@@ -1308,7 +1358,7 @@
- kind: 'removeParameter'
index: 0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Element element) {
@@ -1354,7 +1404,7 @@
- kind: 'removeParameter'
index: 0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Element element) {
@@ -1391,7 +1441,7 @@
- kind: 'rename'
newName: 'dependOnInheritedElement'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Element element) {
@@ -1426,7 +1476,7 @@
- kind: 'rename'
newName: 'dependOnInheritedElement'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Element element) {
@@ -1475,7 +1525,7 @@
- kind: 'removeParameter'
index: 0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Element element) {
@@ -1522,7 +1572,7 @@
- kind: 'removeParameter'
index: 0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Element element) {
@@ -1560,7 +1610,7 @@
- kind: 'rename'
newName: 'jumpTo'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(ScrollPosition position) {
@@ -1596,7 +1646,7 @@
- kind: 'rename'
newName: 'jumpTo'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(ScrollPosition position) {
@@ -1634,7 +1684,7 @@
- kind: 'rename'
newName: 'dependOnInheritedElement'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(StatefulElement element) {
@@ -1669,7 +1719,7 @@
- kind: 'rename'
newName: 'dependOnInheritedElement'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(StatefulElement element) {
@@ -1707,7 +1757,7 @@
- kind: 'rename'
newName: 'allowFirstFrame'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(WidgetsBinding binding) {
@@ -1743,7 +1793,7 @@
- kind: 'rename'
newName: 'allowFirstFrame'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(WidgetsBinding binding) {
@@ -1781,7 +1831,7 @@
- kind: 'rename'
newName: 'deferFirstFrame'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(WidgetsBinding binding) {
@@ -1817,7 +1867,7 @@
- kind: 'rename'
newName: 'deferFirstFrame'
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(WidgetsBinding binding) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/modify_parameters_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/modify_parameters_test.dart
index 675f008..b953b90 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/modify_parameters_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/modify_parameters_test.dart
@@ -35,7 +35,7 @@
setPackageData(_modify(
['C', 'm'], [AddParameter(0, 'a', false, false, null)],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -62,7 +62,7 @@
setPackageData(_modify(
['C', 'm'], [AddParameter(0, 'a', false, true, codeTemplate('0'))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -89,7 +89,7 @@
setPackageData(_modify(
['C', 'm'], [AddParameter(0, 'a', true, false, codeTemplate('0'))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -116,7 +116,7 @@
setPackageData(_modify(
['C', 'm'], [AddParameter(0, 'a', true, true, codeTemplate('0'))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -143,7 +143,7 @@
setPackageData(_modify(
['C', 'm'], [AddParameter(1, 'b', false, false, null)],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -170,7 +170,7 @@
setPackageData(_modify(
['C', 'm'], [AddParameter(1, 'b', false, true, codeTemplate('1'))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -197,7 +197,7 @@
setPackageData(_modify(
['C', 'm'], [AddParameter(1, 'b', true, false, codeTemplate('1'))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -224,7 +224,7 @@
setPackageData(_modify(
['C', 'm'], [AddParameter(1, 'b', true, true, codeTemplate('1'))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -256,7 +256,7 @@
AddParameter(2, 'c', true, true, codeTemplate('2')),
AddParameter(4, 'e', true, true, codeTemplate('4')),
], newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -281,7 +281,7 @@
setPackageData(_modify(
['C', 'm'], [AddParameter(0, 'a', true, true, codeTemplate('0'))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -305,7 +305,7 @@
''');
setPackageData(_modify(
['C', 'm'], [AddParameter(0, 'a', true, true, codeTemplate('0'))]));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -336,7 +336,7 @@
RemoveParameter(PositionalParameterReference(0)),
AddParameter(2, 'c', true, true, codeTemplate('2'))
], newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -367,7 +367,7 @@
RemoveParameter(PositionalParameterReference(1)),
AddParameter(0, 'a', true, true, codeTemplate('0'))
], newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -399,7 +399,7 @@
RemoveParameter(PositionalParameterReference(1)),
AddParameter(0, 'c', true, true, codeTemplate('2')),
], newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -431,7 +431,7 @@
RemoveParameter(PositionalParameterReference(2)),
AddParameter(1, 'd', true, true, codeTemplate('3')),
], newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -464,7 +464,7 @@
RemoveParameter(PositionalParameterReference(3)),
AddParameter(2, 'd', true, true, codeTemplate('3')),
], newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -491,7 +491,7 @@
setPackageData(_modify(
['C', 'm'], [RemoveParameter(NamedParameterReference('a'))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -518,7 +518,7 @@
setPackageData(_modify(
['C', 'm'], [RemoveParameter(PositionalParameterReference(0))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -545,7 +545,7 @@
setPackageData(_modify(
['C', 'm'], [RemoveParameter(PositionalParameterReference(0))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -572,7 +572,7 @@
setPackageData(_modify(
['C', 'm'], [RemoveParameter(NamedParameterReference('b'))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -599,7 +599,7 @@
setPackageData(_modify(
['C', 'm'], [RemoveParameter(PositionalParameterReference(1))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -626,7 +626,7 @@
setPackageData(_modify(
['C', 'm'], [RemoveParameter(PositionalParameterReference(1))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -651,7 +651,7 @@
''');
setPackageData(
_modify(['C', 'm'], [RemoveParameter(NamedParameterReference('b'))]));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -683,7 +683,7 @@
RemoveParameter(PositionalParameterReference(2)),
RemoveParameter(PositionalParameterReference(3)),
], newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -710,7 +710,7 @@
setPackageData(_modify(
['C', 'm'], [RemoveParameter(NamedParameterReference('a'))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -737,7 +737,7 @@
setPackageData(_modify(
['C', 'm'], [RemoveParameter(NamedParameterReference('a'))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -764,7 +764,7 @@
setPackageData(_modify(
['C', 'm'], [RemoveParameter(PositionalParameterReference(0))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -792,7 +792,7 @@
setPackageData(_modify(
['C', 'm'], [RemoveParameter(PositionalParameterReference(0))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -819,7 +819,7 @@
setPackageData(_modify(
['C', 'm'], [RemoveParameter(PositionalParameterReference(0))],
newName: 'm2'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -860,7 +860,7 @@
], [
AddParameter(0, 'a', true, true, codeTemplate('0')),
], newName: 'g'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void h() {
@@ -885,7 +885,7 @@
setPackageData(_modify(
['f'], [RemoveParameter(PositionalParameterReference(0))],
newName: 'g'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void h() {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_test.dart
index b3d8c35..8430c1a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/rename_test.dart
@@ -40,7 +40,7 @@
}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -63,7 +63,7 @@
}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -90,7 +90,7 @@
}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -113,7 +113,7 @@
}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -136,7 +136,7 @@
class New {}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class C extends Old {}
@@ -153,7 +153,7 @@
class New {}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class C extends Old {}
@@ -172,7 +172,7 @@
class New {}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class C implements Old {}
@@ -189,7 +189,7 @@
class New {}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class C implements Old {}
@@ -208,7 +208,7 @@
class New {}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
extension E on Old {}
@@ -225,7 +225,7 @@
class New {}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
extension E on Old {}
@@ -244,7 +244,7 @@
class New {}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Old o) {}
@@ -261,7 +261,7 @@
class New {}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Old o) {}
@@ -280,7 +280,7 @@
class New {}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class C with Old {}
@@ -297,7 +297,7 @@
class New {}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class C with Old {}
@@ -320,7 +320,7 @@
}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
var s = Old.empty;
@@ -339,7 +339,7 @@
}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
var s = Old.empty;
@@ -366,7 +366,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -389,7 +389,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -414,7 +414,7 @@
}
''');
setPackageData(_rename(['C', 'old'], ''));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -437,7 +437,7 @@
}
''');
setPackageData(_rename(['C', 'old'], ''));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -462,7 +462,7 @@
}
''');
setPackageData(_rename(['C', ''], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -485,7 +485,7 @@
}
''');
setPackageData(_rename(['C', ''], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -518,7 +518,7 @@
}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
var l = Old('a').double;
@@ -537,7 +537,7 @@
}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
var l = Old('a').double;
@@ -560,7 +560,7 @@
}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
var s = Old.empty;
@@ -579,7 +579,7 @@
}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
var s = Old.empty;
@@ -606,7 +606,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -629,7 +629,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -654,7 +654,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -677,7 +677,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -702,7 +702,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -725,7 +725,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -760,7 +760,7 @@
}
''');
setPackageData(_rename(['C', 'a'], 'b'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(D d) {
@@ -782,7 +782,7 @@
}
''');
setPackageData(_rename(['C', 'a'], 'b'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
D d = D(a: 2);
@@ -799,7 +799,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -822,7 +822,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -850,7 +850,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(D d) {
@@ -876,7 +876,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(D d) {
@@ -899,7 +899,7 @@
int get new => 1;
''');
setPackageData(_rename(['old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -920,7 +920,7 @@
int get new => 1;
''');
setPackageData(_rename(['old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -952,7 +952,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class D extends C {
@@ -977,7 +977,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class D extends C {
@@ -1004,7 +1004,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -1027,7 +1027,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(C c) {
@@ -1052,7 +1052,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -1075,7 +1075,7 @@
}
''');
setPackageData(_rename(['C', 'old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -1104,7 +1104,7 @@
mixin New {}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class C with Old {}
@@ -1121,7 +1121,7 @@
mixin New {}
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
class C with Old {}
@@ -1146,7 +1146,7 @@
int new() {}
''');
setPackageData(_rename(['old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -1167,7 +1167,7 @@
int new() {}
''');
setPackageData(_rename(['old'], 'new'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f() {
@@ -1196,7 +1196,7 @@
typedef New = int Function(int);
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Old o) {}
@@ -1213,7 +1213,7 @@
typedef New = int Function(int);
''');
setPackageData(_rename(['Old'], 'New'));
- await resolveTestUnit('''
+ await resolveTestCode('''
import '$importUri';
void f(Old o) {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_parser_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_parser_test.dart
index e28220e..ac2dccb 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_parser_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_parser_test.dart
@@ -368,6 +368,33 @@
expect(transform.changes, isEmpty);
}
+ void test_correctOffsetForPlainStrings() {
+ assertErrors('''
+version: 1
+transforms:
+- title: 'Add'
+ date: 2020-09-03
+ element:
+ uris:
+ - 'test.dart'
+ class: 'A'
+ changes:
+ - kind: 'addTypeParameter'
+ index: 0
+ name: 'T'
+ extends:
+ expression: 'Object'
+ argumentValue:
+ expression: '{% t %}'
+ variables:
+ t:
+ kind: 'fragment'
+ value: args
+''', [
+ error(TransformSetErrorCode.unknownAccessor, 361, 4),
+ ]);
+ }
+
void test_date() {
parse('''
version: 1
diff --git a/pkg/analysis_server/test/src/services/correction/fix/extend_class_for_mixin_test.dart b/pkg/analysis_server/test/src/services/correction/fix/extend_class_for_mixin_test.dart
index b713d0e..1624c7f 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/extend_class_for_mixin_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/extend_class_for_mixin_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.EXTEND_CLASS_FOR_MIXIN;
Future<void> test_missingClass_withExtends() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
class B {}
mixin M on B {}
@@ -30,7 +30,7 @@
}
Future<void> test_missingClass_withoutExtends_withImplements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
class B {}
mixin M on B {}
@@ -45,7 +45,7 @@
}
Future<void> test_missingClass_withoutExtends_withoutImplements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
mixin M on A {}
class C with M {}
@@ -58,7 +58,7 @@
}
Future<void> test_missingMixin_withExtends() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
mixin M {}
mixin N on M {}
@@ -69,7 +69,7 @@
@failingTest
Future<void> test_missingMixin_withoutExtends() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin M {}
mixin N on M {}
class C with N {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/fix_test.dart b/pkg/analysis_server/test/src/services/correction/fix/fix_test.dart
index 8b2ae57..b66fd12 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/fix_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/fix_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => fail('kind should not be requested');
Future<void> test_malformedTypeTest() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
p i s Null;
}''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_async_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_async_test.dart
index 592952f..5fa217e 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/import_async_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/import_async_test.dart
@@ -24,7 +24,7 @@
environment:
sdk: ^2.0.0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
Future<int> zero() async => 0;
''');
await assertHasFix('''
@@ -39,7 +39,7 @@
environment:
sdk: ^2.0.0
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
Stream<int> zero() => null;
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_library_prefix_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_library_prefix_test.dart
index 73e5996..c1ffcce 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/import_library_prefix_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/import_library_prefix_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.IMPORT_LIBRARY_PREFIX;
Future<void> test_withClass() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:collection' as pref;
main() {
pref.HashMap s = null;
@@ -45,7 +45,7 @@
static String m() => '';
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'lib.dart' as p;
void f(p.C c) {
print(E.m());
@@ -60,7 +60,7 @@
}
Future<void> test_withTopLevelVariable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' as pref;
main() {
print(pref.e);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
index 856bb00e..38c113a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart
@@ -28,7 +28,7 @@
class A {}
class B {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'lib.dart' show A;
main() {
A a;
@@ -45,7 +45,7 @@
const Test();
}
''');
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
import 'package:$foo/foo.dart';
void f() {
@@ -78,7 +78,7 @@
my_pkg: any
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Test test = null;
print(test);
@@ -112,7 +112,7 @@
my_pkg: any
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
print(E.m());
}
@@ -139,7 +139,7 @@
dependencies:
my_pkg: any
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Test test = null;
print(test);
@@ -150,7 +150,7 @@
Future<void> test_notInLib() async {
addSource('/home/other/test/lib.dart', 'class Test {}');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Test t;
print(t);
@@ -163,7 +163,7 @@
addSource('/home/test/lib/a.dart', '''
class Foo {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() { new Foo(); }
''');
await assertHasFix('''
@@ -179,7 +179,7 @@
addSource('/home/test/lib/dir/a.dart', '''
class Foo {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() { new Foo(); }
''');
await assertHasFix('''
@@ -196,7 +196,7 @@
class Foo {}
''');
testFile = convertPath('/home/test/lib/dir/test.dart');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() { new Foo(); }
''');
await assertHasFix('''
@@ -215,7 +215,7 @@
const Test(int p);
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
@Test(0)
main() {
}
@@ -233,7 +233,7 @@
addSource('/home/test/lib/lib.dart', '''
class Test {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
try {
print(1);
@@ -265,7 +265,7 @@
class One {}
class Two {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:test/b.dart' show Two;
main () {
new Two();
@@ -288,7 +288,7 @@
library lib;
class Test {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Test t = null;
print(t);
@@ -310,7 +310,7 @@
library lib;
class Test {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Test t = null;
print(t);
@@ -332,7 +332,7 @@
library lib;
class Test {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Test t = null;
print(t);
@@ -354,7 +354,7 @@
const Test();
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
return const Test();
}
@@ -374,7 +374,7 @@
const Test.named();
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
const Test.named();
}
@@ -394,7 +394,7 @@
const Test();
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
return Test();
}
@@ -414,7 +414,7 @@
const Test();
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
return new Test();
}
@@ -434,7 +434,7 @@
Test.named();
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
new Test.named();
}
@@ -453,7 +453,7 @@
library lib;
myFunction() {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
myFunction();
}
@@ -469,7 +469,7 @@
Future<void> test_withFunction_functionTopLevelVariable() async {
addSource('/home/test/lib/lib.dart', 'var myFunction = () {};');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
myFunction();
}
@@ -485,7 +485,7 @@
Future<void> test_withFunction_functionTopLevelVariableIdentifier() async {
addSource('/home/test/lib/lib.dart', 'var myFunction = () {};');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
myFunction;
}
@@ -504,7 +504,7 @@
library lib;
myFunction() {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
myFunction;
}
@@ -521,7 +521,7 @@
@failingTest
Future<void> test_withFunction_nonFunctionType() async {
addSource('/home/test/lib/lib.dart', 'int zero = 0;');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
zero();
}
@@ -534,7 +534,7 @@
library lib;
myFunction() {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main() {
myFunction();
@@ -557,7 +557,7 @@
library lib;
typedef MyFunction();
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
MyFunction t = null;
print(t);
@@ -577,7 +577,7 @@
addSource('/home/test/lib/lib.dart', '''
mixin Test {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
class X = Object with Test;
''');
await assertHasFix('''
@@ -592,7 +592,7 @@
library lib;
int MY_VAR = 42;
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print(MY_VAR);
}
@@ -625,7 +625,7 @@
dependencies:
my_pkg: any
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Test test = null;
print(test);
@@ -654,7 +654,7 @@
dependencies:
my_pkg: any
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Test test = null;
print(test);
@@ -687,7 +687,7 @@
dependencies:
my_pkg: any
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
print(E.m());
}
@@ -719,7 +719,7 @@
);
newFile('/.pub-cache/bbb/lib/src/b2.dart', content: 'class Test {}');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:bbb/b1.dart';
main() {
Test t;
@@ -732,7 +732,7 @@
Future<void> test_inLibSrc_thisContextRoot() async {
addSource('/home/test/lib/src/lib.dart', 'class Test {}');
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Test t;
print(t);
@@ -754,7 +754,7 @@
static String m() => '';
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
print(E.m());
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_library_sdk_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_library_sdk_test.dart
index 600d792..8b0b7e5 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/import_library_sdk_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/import_library_sdk_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.IMPORT_LIBRARY_SDK;
Future<void> test_alreadyImported_sdk() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:collection' show HashMap;
main() {
HashMap s = null;
@@ -33,7 +33,7 @@
}
Future<void> test_withClass_asExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
p as HashMap;
}
@@ -48,7 +48,7 @@
}
Future<void> test_withClass_extends() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyCompleter extends Completer<String> {}
''');
await assertHasFix('''
@@ -59,7 +59,7 @@
}
Future<void> test_withClass_implements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyCompleter implements Completer<String> {}
''');
await assertHasFix('''
@@ -70,7 +70,7 @@
}
Future<void> test_withClass_instanceCreation_explicitNew() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
foo() {
new HashMap();
@@ -90,7 +90,7 @@
Future<void>
test_withClass_instanceCreation_explicitNew_namedConstructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
foo() {
new Completer.sync(0);
@@ -109,7 +109,7 @@
}
Future<void> test_withClass_instanceCreation_implicitNew() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
foo() {
HashMap();
@@ -129,7 +129,7 @@
Future<void>
test_withClass_instanceCreation_implicitNew_namedConstructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
foo() {
Completer.sync(0);
@@ -148,7 +148,7 @@
}
Future<void> test_withClass_invocationTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Timer.run(null);
}
@@ -163,7 +163,7 @@
}
Future<void> test_withClass_IsExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
p is Completer;
}
@@ -178,7 +178,7 @@
}
Future<void> test_withClass_itemOfList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var a = [Completer];
print(a);
@@ -195,7 +195,7 @@
}
Future<void> test_withClass_itemOfList_inAnnotation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyAnnotation {
const MyAnnotation(a, b);
}
@@ -216,7 +216,7 @@
}
Future<void> test_withClass_typeAnnotation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Completer f = null;
print(f);
@@ -233,7 +233,7 @@
}
Future<void> test_withClass_typeAnnotation_PrefixedIdentifier() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
Timer.run;
}
@@ -248,7 +248,7 @@
}
Future<void> test_withClass_typeArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
List<Completer> completers = [];
print(completers);
@@ -265,7 +265,7 @@
}
Future<void> test_withClass_with() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyCompleter with Completer<String> {}
''');
await assertHasFix('''
@@ -276,7 +276,7 @@
}
Future<void> test_withTopLevelVariable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print(pi);
}
@@ -291,7 +291,7 @@
}
Future<void> test_withTopLevelVariable_annotation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
@pi
main() {
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_library_show_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_library_show_test.dart
index 5afd7f5..e54adba 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/import_library_show_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/import_library_show_test.dart
@@ -26,7 +26,7 @@
String m() => '';
}
''');
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
import 'lib.dart' show A;
void f(A a) {
print('$a ${E(3).m()}');
@@ -45,7 +45,7 @@
class A {}
class B {}
''');
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
import 'lib.dart' show A;
main() {
A a;
@@ -64,7 +64,7 @@
}
Future<void> test_sdk() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
import 'dart:collection' show HashMap;
main() {
HashMap s = null;
@@ -89,7 +89,7 @@
static String m() => '';
}
''');
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
import 'lib.dart' show A;
void f(A a) {
print('$a ${E.m()}');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/inline_invocation_test.dart b/pkg/analysis_server/test/src/services/correction/fix/inline_invocation_test.dart
index 82168ee..bb8dc37 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/inline_invocation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/inline_invocation_test.dart
@@ -25,7 +25,7 @@
/// More coverage in the `inline_invocation_test.dart` assist test.
Future<void> test_add_emptyTarget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = []..add('a')..add('b');
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/inline_typedef_test.dart b/pkg/analysis_server/test/src/services/correction/fix/inline_typedef_test.dart
index e94ab21..39d4fdb 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/inline_typedef_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/inline_typedef_test.dart
@@ -25,7 +25,7 @@
String get lintCode => LintNames.avoid_private_typedef_functions;
Future<void> test_generic_parameter_optionalNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef _F = Function({int i});
void g(_F f) {}
''');
@@ -35,7 +35,7 @@
}
Future<void> test_generic_parameter_optionalPositional_withName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef _F = Function([int i]);
void g(_F f) {}
''');
@@ -45,7 +45,7 @@
}
Future<void> test_generic_parameter_optionalPositional_withoutName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef _F = Function([int]);
void g(_F f) {}
''');
@@ -55,7 +55,7 @@
}
Future<void> test_generic_parameter_requiredPositional_withName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef _F = Function(int i);
void g(_F f) {}
''');
@@ -65,7 +65,7 @@
}
Future<void> test_generic_parameter_requiredPositional_withoutName() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef _F = Function(int);
void g(_F f) {}
''');
@@ -75,7 +75,7 @@
}
Future<void> test_generic_returnType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef _F = void Function();
void g(_F f) {}
''');
@@ -85,7 +85,7 @@
}
Future<void> test_generic_typeParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef _F = Function<T>(T);
void g(_F f) {}
''');
@@ -95,7 +95,7 @@
}
Future<void> test_nonGeneric_parameter_requiredPositional_typed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef _F(int i);
void g(_F f) {}
''');
@@ -105,7 +105,7 @@
}
Future<void> test_nonGeneric_parameter_requiredPositional_untyped() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef _F(i);
void g(_F f) {}
''');
@@ -115,7 +115,7 @@
}
Future<void> test_nonGeneric_returnType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef void _F();
void g(_F f) {}
''');
@@ -125,7 +125,7 @@
}
Future<void> test_nonGeneric_typeParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef _F<T>(T t);
void g(_F f) {}
''');
@@ -139,7 +139,7 @@
class InlineTypedefWithNullSafetyTest extends InlineTypedefTest
with WithNullSafetyLintMixin {
Future<void> test_generic_parameter_requiredNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef _F = Function({required int i});
void g(_F f) {}
''');
@@ -149,7 +149,7 @@
}
Future<void> test_nonGeneric_parameter_requiredNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef _F({required int i});
void g(_F f) {}
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/insert_semicolon_test.dart b/pkg/analysis_server/test/src/services/correction/fix/insert_semicolon_test.dart
index 3e0fc37..937ff59 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/insert_semicolon_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/insert_semicolon_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.INSERT_SEMICOLON;
Future<void> test_expectedToken_semicolon() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
print(0)
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/make_class_abstract_test.dart b/pkg/analysis_server/test/src/services/correction/fix/make_class_abstract_test.dart
index cc90674..f5927f9 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/make_class_abstract_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/make_class_abstract_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.MAKE_CLASS_ABSTRACT;
Future<void> test_declaresAbstractMethod() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
m();
}
@@ -33,7 +33,7 @@
}
Future<void> test_inheritsAbstractMethod() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
abstract class A {
m();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/make_field_not_final_test.dart b/pkg/analysis_server/test/src/services/correction/fix/make_field_not_final_test.dart
index d0b89d3..941643a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/make_field_not_final_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/make_field_not_final_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.MAKE_FIELD_NOT_FINAL;
Future<void> test_hasType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
final int fff = 1;
main() {
@@ -39,7 +39,7 @@
}
Future<void> test_noType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
final fff = 1;
main() {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/make_final_test.dart b/pkg/analysis_server/test/src/services/correction/fix/make_final_test.dart
index 01e9935..fbee41d 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/make_final_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/make_final_test.dart
@@ -26,7 +26,7 @@
String get lintCode => LintNames.prefer_final_fields;
Future<void> test_field_type() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int _f = 2;
int get g => _f;
@@ -41,7 +41,7 @@
}
Future<void> test_field_var() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
var _f = 2;
int get g => _f;
@@ -66,7 +66,7 @@
String get lintCode => LintNames.prefer_final_fields;
Future<void> test_lateField_type() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
late int _f = 2;
int get g => _f;
@@ -81,7 +81,7 @@
}
Future<void> test_lateField_var() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
late var _f = 2;
int get g => _f;
@@ -105,7 +105,7 @@
String get lintCode => LintNames.prefer_final_in_for_each;
Future<void> test_noType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void fn() {
for (var i in [1, 2, 3]) {
print(i);
@@ -122,7 +122,7 @@
}
Future<void> test_type() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void fn() {
for (int i in [1, 2, 3]) {
print(i);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/make_return_type_nullable_test.dart b/pkg/analysis_server/test/src/services/correction/fix/make_return_type_nullable_test.dart
index ff7d59e..e661f34 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/make_return_type_nullable_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/make_return_type_nullable_test.dart
@@ -22,7 +22,7 @@
FixKind get kind => DartFixKind.MAKE_RETURN_TYPE_NULLABLE;
Future<void> test_function_async() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Future<String> f(String? s) async {
return s;
}
@@ -35,7 +35,7 @@
}
Future<void> test_function_asyncStar() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Stream<String> f(String? s) async* {
yield s;
}
@@ -48,7 +48,7 @@
}
Future<void> test_function_sync() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
String f(String? s) {
return s;
}
@@ -61,7 +61,7 @@
}
Future<void> test_function_syncStar() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Iterable<String> f(String? s) sync* {
yield s;
}
@@ -74,7 +74,7 @@
}
Future<void> test_getter_sync() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
String? f;
String get g => f;
@@ -89,7 +89,7 @@
}
Future<void> test_incompatibilityIsNotLimitedToNullability() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
int f() {
return '';
}
@@ -98,7 +98,7 @@
}
Future<void> test_localFunction_sync() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
String g(String? s) {
return s;
@@ -117,7 +117,7 @@
}
Future<void> test_method_sync() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
String m(String? s) {
return s;
@@ -134,7 +134,7 @@
}
Future<void> test_returnTypeHasTypeArguments() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
List<String> f() {
return null;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/make_variable_not_final_test.dart b/pkg/analysis_server/test/src/services/correction/fix/make_variable_not_final_test.dart
index 441cbbf..c87fde3 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/make_variable_not_final_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/make_variable_not_final_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.MAKE_VARIABLE_NOT_FINAL;
Future<void> test_hasType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
final int fff = 1;
fff = 2;
@@ -37,7 +37,7 @@
}
Future<void> test_noType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
final fff = 1;
fff = 2;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/make_variable_nullable_test.dart b/pkg/analysis_server/test/src/services/correction/fix/make_variable_nullable_test.dart
index 9d475df..39575528 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/make_variable_nullable_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/make_variable_nullable_test.dart
@@ -22,7 +22,7 @@
FixKind get kind => DartFixKind.MAKE_VARIABLE_NULLABLE;
Future<void> test_lhsNotIdentifier() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(C c) {
c.s = null;
}
@@ -34,7 +34,7 @@
}
Future<void> test_lhsNotLocalVariable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = '';
void f() {
s = null;
@@ -45,7 +45,7 @@
}
Future<void> test_multipleVariables() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
var s = '', t = '';
s = null;
@@ -57,7 +57,7 @@
}
Future<void> test_noKeywordOrType() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
late var s = '';
s = null;
@@ -74,7 +74,7 @@
}
Future<void> test_type() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
String s = '';
s = null;
@@ -91,7 +91,7 @@
}
Future<void> test_var() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
var s = '';
s = null;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/move_type_arguments_to_class_test.dart b/pkg/analysis_server/test/src/services/correction/fix/move_type_arguments_to_class_test.dart
index cbbf990..c3b99ff 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/move_type_arguments_to_class_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/move_type_arguments_to_class_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.MOVE_TYPE_ARGUMENTS_TO_CLASS;
Future<void> test_explicitConst() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
const C.named<int>();
}
@@ -39,7 +39,7 @@
}
Future<void> test_explicitNew() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
new C.named<int>();
}
@@ -58,7 +58,7 @@
}
Future<void> test_explicitNew_alreadyThere() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
new C<String>.named<int>();
}
@@ -70,7 +70,7 @@
}
Future<void> test_explicitNew_wrongNumber() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
new C.named<int, String>();
}
@@ -82,7 +82,7 @@
}
Future<void> test_implicitConst() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
const C c = C.named<int>();
print(c);
@@ -103,7 +103,7 @@
}
Future<void> test_implicitNew() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
C.named<int>();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart b/pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart
index 868dbab..941bdf4 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.directives_ordering;
Future<void> test_organizeImports() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
//ignore_for_file: unused_import
import 'dart:io';
diff --git a/pkg/analysis_server/test/src/services/correction/fix/qualify_reference_test.dart b/pkg/analysis_server/test/src/services/correction/fix/qualify_reference_test.dart
index 9e7d7ec..5c92c08 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/qualify_reference_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/qualify_reference_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.QUALIFY_REFERENCE;
Future<void> test_class_direct() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
static void m() {}
}
@@ -48,7 +48,7 @@
static void m() {}
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'a.dart';
class B extends A {
void f() {
@@ -65,7 +65,7 @@
static void m() {}
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'a.dart' as a;
class B extends a.A {
void f() {
@@ -77,7 +77,7 @@
}
Future<void> test_class_indirect() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static void m() {}
}
@@ -113,7 +113,7 @@
import 'a.dart';
class B extends A {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'b.dart';
class C extends B {
void f() {
@@ -125,7 +125,7 @@
}
Future<void> test_extension_direct() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
static void m() {}
}
@@ -153,7 +153,7 @@
static void m() {}
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'a.dart';
extension E on A {
void f() {
@@ -170,7 +170,7 @@
static void m() {}
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'a.dart' as a;
extension E on a.A {
void f() {
@@ -182,7 +182,7 @@
}
Future<void> test_extension_indirect() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
static void m() {}
}
@@ -218,7 +218,7 @@
import 'a.dart';
class B extends A {}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'b.dart';
extension E on B {
void f() {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_annotation_test.dart
index 126dd33..b693ead 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_annotation_test.dart
@@ -26,7 +26,7 @@
}
Future<void> test_factory() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
@factory
@@ -40,7 +40,7 @@
}
Future<void> test_immutable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
@immutable
@@ -54,7 +54,7 @@
}
Future<void> test_literal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
@literal
@@ -68,7 +68,7 @@
}
Future<void> test_override_field() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
@override
String name;
@@ -82,7 +82,7 @@
}
Future<void> test_override_getter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
@override
int get zero => 0;
@@ -96,7 +96,7 @@
}
Future<void> test_override_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
@override
void m() {}
@@ -110,7 +110,7 @@
}
Future<void> test_override_setter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
@override
set value(v) {}
@@ -124,7 +124,7 @@
}
Future<void> test_required_namedWithDefault() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
f({@required int x = 0}) {}
@@ -137,7 +137,7 @@
}
Future<void> test_required_positional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
f([@required int x]) {}
@@ -150,7 +150,7 @@
}
Future<void> test_required_required() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
f(@required int x) {}
@@ -163,7 +163,7 @@
}
Future<void> test_sealed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:meta/meta.dart';
@sealed
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_argument_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_argument_test.dart
index f324585..cb1dc00 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_argument_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_argument_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.avoid_redundant_argument_values;
Future<void> test_named_param() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f({bool valWithDefault = true, bool val}) {}
void main() {
@@ -41,7 +41,7 @@
}
Future<void> test_named_param_2() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f({bool valWithDefault = true, bool val}) {}
void main() {
@@ -58,7 +58,7 @@
}
Future<void> test_optional_positional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void g(int x, [int y = 0]) {}
void main() {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_await_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_await_test.dart
index a9857ed..97d8bf8 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_await_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_await_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.await_only_futures;
Future<void> test_intLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bad() async {
print(await 23);
}
@@ -37,7 +37,7 @@
}
Future<void> test_stringLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bad() async {
print(await 'hola');
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_comparison_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_comparison_test.dart
index 89a631b..356d591 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_comparison_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_comparison_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.REMOVE_COMPARISON;
Future<void> test_assertInitializer_first() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
String t;
C(String s) : assert(s != null), t = s;
@@ -36,7 +36,7 @@
}
Future<void> test_assertInitializer_last() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
String t;
C(String s) : t = s, assert(s != null);
@@ -51,7 +51,7 @@
}
Future<void> test_assertInitializer_middle() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
String t;
String u;
@@ -68,7 +68,7 @@
}
Future<void> test_assertInitializer_only() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
C(String s) : assert(s != null);
}
@@ -81,7 +81,7 @@
}
Future<void> test_assertStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
assert(s != null);
print(s);
@@ -95,7 +95,7 @@
}
Future<void> test_binaryExpression_and_left() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
print(s != null && s.isNotEmpty);
}
@@ -108,7 +108,7 @@
}
Future<void> test_binaryExpression_and_right() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
print(s.isNotEmpty && s != null);
}
@@ -121,7 +121,7 @@
}
Future<void> test_binaryExpression_or_left() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
print(s == null || s.isEmpty);
}
@@ -134,7 +134,7 @@
}
Future<void> test_binaryExpression_or_right() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
print(s.isEmpty || s == null);
}
@@ -147,7 +147,7 @@
}
Future<void> test_ifStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
if (s != null) {
print(s);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_const_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_const_test.dart
index 8051ea2..3f347cc3 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_const_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_const_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.REMOVE_CONST;
Future<void> test_explicitConst() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A();
}
@@ -42,7 +42,7 @@
}
Future<void> test_implicitConst() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
A();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_dead_code_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_dead_code_test.dart
index 93bea41..62618ac 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_dead_code_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_dead_code_test.dart
@@ -22,7 +22,7 @@
FixKind get kind => DartFixKind.REMOVE_DEAD_CODE;
Future<void> test_catch_afterCatchAll_catch() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
try {
} catch (e) {
@@ -43,7 +43,7 @@
}
Future<void> test_catch_afterCatchAll_on() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
try {
} on Object {
@@ -64,7 +64,7 @@
}
Future<void> test_catch_subtype() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
class B extends A {}
main() {
@@ -89,7 +89,7 @@
}
Future<void> test_condition() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(int p) {
if (true || p > 5) {
print(1);
@@ -106,7 +106,7 @@
}
Future<void> test_statements_one() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
int main() {
print(0);
return 42;
@@ -122,7 +122,7 @@
}
Future<void> test_statements_two() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
int main() {
print(0);
return 42;
@@ -150,7 +150,7 @@
@failingTest
Future<void> test_do_returnInBody() async {
// https://github.com/dart-lang/sdk/issues/43511
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(bool c) {
do {
print(c);
@@ -168,7 +168,7 @@
@failingTest
Future<void> test_for_returnInBody() async {
// https://github.com/dart-lang/sdk/issues/43511
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
for (int i = 0; i < 2; i++) {
print(i);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_duplicate_case_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_duplicate_case_test.dart
index a010515..0d8a6b1 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_duplicate_case_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_duplicate_case_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.no_duplicate_case_values;
Future<void> test_fallThroughFromPrevious() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void switchInt() {
switch (2) {
case 1:
@@ -58,7 +58,7 @@
}
Future<void> test_removeIntCase() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void switchInt() {
switch (2) {
case 1:
@@ -86,7 +86,7 @@
}
Future<void> test_removeStringCase() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void switchString() {
String v = 'a';
switch (v) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_empty_catch_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_empty_catch_test.dart
index de5aedd..ff75a69 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_empty_catch_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_empty_catch_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.empty_catches;
Future<void> test_incompleteCatch() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void foo() {
try {
1;
@@ -35,7 +35,7 @@
}
Future<void> test_singleCatch_finally_newLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void foo() {
try {
1;
@@ -57,7 +57,7 @@
}
Future<void> test_singleCatch_finally_sameLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void foo() {
try {} catch (e) {} finally {}
}
@@ -72,7 +72,7 @@
Future<void> test_singleCatch_noFinally() async {
// The catch can't be removed unless we also remove the try, which is more
// than this fix does at the moment.
- await resolveTestUnit('''
+ await resolveTestCode('''
void foo() {
try {
} catch (e) {}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_empty_constructor_body_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_empty_constructor_body_test.dart
index 6f1bb5e..3f93785 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_empty_constructor_body_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_empty_constructor_body_test.dart
@@ -25,7 +25,7 @@
String get lintCode => LintNames.empty_constructor_bodies;
Future<void> test_empty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
C() {}
}
@@ -38,7 +38,7 @@
}
Future<void> test_incompleteComment() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
A() {/*
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_empty_else_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_empty_else_test.dart
index 907e83a..b7521b3 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_empty_else_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_empty_else_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.avoid_empty_else;
Future<void> test_newLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void foo(bool cond) {
if (cond) {
//
@@ -42,7 +42,7 @@
}
Future<void> test_sameLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void foo(bool cond) {
if (cond) {
//
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_empty_statement_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_empty_statement_test.dart
index c7f0fe8..0b28f0f 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_empty_statement_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_empty_statement_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.empty_statements;
Future<void> test_insideBlock() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void foo() {
while(true) {
;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_if_null_operator_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_if_null_operator_test.dart
index b9b4921..3797ce9 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_if_null_operator_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_if_null_operator_test.dart
@@ -24,7 +24,7 @@
FixKind get kind => DartFixKind.REMOVE_IF_NULL_OPERATOR;
Future<void> test_immediateChild() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
int f(int a, int b) => a ?? b;
''');
await assertHasFix('''
@@ -33,7 +33,7 @@
}
Future<void> test_nestedChild() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
int f(int a, int b) => a ?? b * 2 + 1;
''');
await assertHasFix('''
@@ -51,7 +51,7 @@
String get lintCode => LintNames.unnecessary_null_in_if_null_operators;
Future<void> test_left() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var a = '';
var b = null ?? a;
''');
@@ -62,7 +62,7 @@
}
Future<void> test_right() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var a = '';
var b = a ?? null;
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_initializer_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_initializer_test.dart
index fe01b6d..7127fbd 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_initializer_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_initializer_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.avoid_init_to_null;
Future<void> test_field() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Test {
int x = null;
}
@@ -37,7 +37,7 @@
}
Future<void> test_forLoop() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f() {
for (var i = null; i != null; i++) {
}
@@ -52,7 +52,7 @@
}
Future<void> test_listOfVariableDeclarations() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
String a = 'a', b = null, c = 'c';
''');
await assertHasFix('''
@@ -61,7 +61,7 @@
}
Future<void> test_parameter_optionalNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f({String s = null}) {}
''');
await assertHasFix('''
@@ -70,7 +70,7 @@
}
Future<void> test_parameter_optionalPositional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f([String s = null]) {}
''');
await assertHasFix('''
@@ -79,7 +79,7 @@
}
Future<void> test_topLevel() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var x = null;
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_interpolation_braces_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_interpolation_braces_test.dart
index 46cc0ea..eaf6bc0 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_interpolation_braces_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_interpolation_braces_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.unnecessary_brace_in_string_interps;
Future<void> test_withSpace() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
var v = 42;
print('v: ${ v}');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_method_declaration_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_method_declaration_test.dart
index 6b673ad..d7d5d74 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_method_declaration_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_method_declaration_test.dart
@@ -25,7 +25,7 @@
String get lintCode => LintNames.unnecessary_overrides;
Future<void> test_getter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int foo;
}
@@ -46,7 +46,7 @@
}
Future<void> test_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int foo() => 0;
}
@@ -68,7 +68,7 @@
@FailingTest(issue: 'https://github.com/dart-lang/linter/issues/1997')
Future<void> test_method_generic() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A<T> {
T foo() {
throw 42;
@@ -102,7 +102,7 @@
int foo() => 0;
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
// @dart = 2.7
import 'a.dart';
@@ -122,7 +122,7 @@
@FailingTest(issue: 'https://github.com/dart-lang/linter/issues/1997')
Future<void> test_method_toString() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
@override
String toString() => super.toString();
@@ -137,7 +137,7 @@
@failingTest
Future<void> test_setter() async {
// The lint doesn't catch unnecessary setters.
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int foo;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_name_from_combinator_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_name_from_combinator_test.dart
index 3bf7a32..e833910 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_name_from_combinator_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_name_from_combinator_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.REMOVE_NAME_FROM_COMBINATOR;
Future<void> test_duplicateHiddenName_last() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' hide cos, sin, sin;
main() {
@@ -37,7 +37,7 @@
}
Future<void> test_duplicateHiddenName_middle() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' hide cos, cos, sin;
main() {
@@ -57,7 +57,7 @@
Future<void> test_duplicateHiddenName_only_last() async {
// It appears that the hint does not detect names that are duplicated across
// multiple combinators.
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' hide cos, sin hide sin;
main() {
@@ -77,7 +77,7 @@
Future<void> test_duplicateHiddenName_only_middle() async {
// It appears that the hint does not detect names that are duplicated across
// multiple combinators.
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' hide cos hide cos hide sin;
main() {
@@ -94,7 +94,7 @@
}
Future<void> test_duplicateShownName_last() async {
- await resolveTestUnit(
+ await resolveTestCode(
'''
import 'dart:math' show cos, sin, sin;
@@ -113,7 +113,7 @@
}
Future<void> test_duplicateShownName_middle() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' show cos, cos, sin;
f(x) {
@@ -130,7 +130,7 @@
}
Future<void> test_undefinedHiddenName_first() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' hide aaa, sin, tan;
f(x) {
@@ -147,7 +147,7 @@
}
Future<void> test_undefinedHiddenName_last() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' hide cos, sin, xxx;
f(x) {
@@ -164,7 +164,7 @@
}
Future<void> test_undefinedHiddenName_middle() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' hide cos, mmm, tan;
f(x) {
@@ -181,7 +181,7 @@
}
Future<void> test_undefinedHiddenName_only_first() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' hide aaa hide cos, sin;
main() {
@@ -198,7 +198,7 @@
}
Future<void> test_undefinedHiddenName_only_last() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' hide cos, sin hide aaa;
main() {
@@ -215,7 +215,7 @@
}
Future<void> test_undefinedHiddenName_only_middle() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' hide cos hide aaa hide sin;
main() {
@@ -232,7 +232,7 @@
}
Future<void> test_undefinedHiddenName_only_only() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' hide aaa;
var c = sin(0.3);
''');
@@ -243,7 +243,7 @@
}
Future<void> test_undefinedHiddenName_only_only_withAs() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' as math hide aaa;
var c = math.sin(0.3);
''');
@@ -254,7 +254,7 @@
}
Future<void> test_undefinedShownName_first() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' show aaa, sin, tan;
f(x) {
@@ -271,7 +271,7 @@
}
Future<void> test_undefinedShownName_last() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' show cos, sin, xxx;
f(x) {
@@ -288,7 +288,7 @@
}
Future<void> test_undefinedShownName_middle() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' show cos, mmm, tan;
f(x) {
@@ -305,7 +305,7 @@
}
Future<void> test_unusedShownName_first() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' show cos, sin, tan;
f(x) {
@@ -322,7 +322,7 @@
}
Future<void> test_unusedShownName_last() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' show cos, sin, tan;
f(x) {
@@ -339,7 +339,7 @@
}
Future<void> test_unusedShownName_middle() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math' show cos, sin, tan;
f(x) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_operator_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_operator_test.dart
index 62c35d6..22aa7e5 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_operator_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_operator_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_adjacent_string_concatenation;
Future<void> test_plus() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var s = 'a' + 'b';
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_parameters_in_getter_declaration_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_parameters_in_getter_declaration_test.dart
index 53a3e6b..8b96c68 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_parameters_in_getter_declaration_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_parameters_in_getter_declaration_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.REMOVE_PARAMETERS_IN_GETTER_DECLARATION;
Future<void> test_emptyList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int get foo() => 0;
}
@@ -33,7 +33,7 @@
}
Future<void> test_nonEmptyList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int get foo(int a) => 0;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_parentheses_in_getter_invocation_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_parentheses_in_getter_invocation_test.dart
index c968a3f..5f0d7e3 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_parentheses_in_getter_invocation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_parentheses_in_getter_invocation_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.REMOVE_PARENTHESIS_IN_GETTER_INVOCATION;
Future<void> test_noArguments() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int get foo => 0;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_question_mark_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_question_mark_test.dart
index 71ed805..007b6dc 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_question_mark_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_question_mark_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.REMOVE_QUESTION_MARK;
Future<void> test_catchClause() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
void f() {
try {
@@ -40,7 +40,7 @@
}
Future<void> test_extendsClause() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
class B extends A? {}
''');
@@ -51,7 +51,7 @@
}
Future<void> test_implementsClause() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
class B implements A? {}
''');
@@ -62,7 +62,7 @@
}
Future<void> test_onClause_class() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
mixin B on A? {}
''');
@@ -73,7 +73,7 @@
}
Future<void> test_withClause_class() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {}
class B with A? {}
''');
@@ -84,7 +84,7 @@
}
Future<void> test_withClause_mixin() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
mixin A {}
class B with A? {}
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_this_expression_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_this_expression_test.dart
index 8949517..aa1a132 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_this_expression_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_this_expression_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.unnecessary_this;
Future<void> test_constructorInitializer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int x;
A(int x) : this.x = x;
@@ -39,7 +39,7 @@
}
Future<void> test_methodInvocation_oneCharacterOperator() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
void foo() {
this.foo();
@@ -56,7 +56,7 @@
}
Future<void> test_propertyAccess_oneCharacterOperator() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
int x;
void foo() {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_type_annotation_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_type_annotation_test.dart
index b83f7d0..d4c97ab 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_type_annotation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_type_annotation_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.avoid_annotating_with_dynamic;
Future<void> test_insideFunctionTypedFormalParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bad(void foo(dynamic x)) {
return null;
}
@@ -37,7 +37,7 @@
}
Future<void> test_namedParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bad({dynamic defaultValue}) {
return null;
}
@@ -50,7 +50,7 @@
}
Future<void> test_normalParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bad(dynamic defaultValue) {
return null;
}
@@ -63,7 +63,7 @@
}
Future<void> test_optionalParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
bad([dynamic defaultValue]) {
return null;
}
@@ -82,7 +82,7 @@
String get lintCode => LintNames.avoid_return_types_on_setters;
Future<void> test_void() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void set speed2(int ms) {}
''');
await assertHasFix('''
@@ -97,7 +97,7 @@
String get lintCode => LintNames.avoid_types_on_closure_parameters;
Future<void> test_namedParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var x = ({Future<int> defaultValue}) => null;
''');
await assertHasFix('''
@@ -106,7 +106,7 @@
}
Future<void> test_normalParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var x = (Future<int> defaultValue) => null;
''');
await assertHasFix('''
@@ -115,7 +115,7 @@
}
Future<void> test_optionalParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var x = ([Future<int> defaultValue]) => null;
''');
await assertHasFix('''
@@ -136,7 +136,7 @@
String get lintCode => LintNames.type_init_formals;
Future<void> test_void() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int f;
C(int this.f);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_type_arguments_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_type_arguments_test.dart
index cc3a812..62bf7e6 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_type_arguments_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_type_arguments_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.REMOVE_TYPE_ARGUMENTS;
Future<void> test_explicitConst() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
const C.named<int>();
}
@@ -39,7 +39,7 @@
}
Future<void> test_explicitNew() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
new C.named<int>();
}
@@ -58,7 +58,7 @@
}
Future<void> test_implicitConst() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
const C c = C.named<int>();
print(c);
@@ -79,7 +79,7 @@
}
Future<void> test_implicitNew() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
C.named<int>();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unnecessary_cast_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unnecessary_cast_test.dart
index 576f52d..09cfd74 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unnecessary_cast_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unnecessary_cast_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.REMOVE_UNNECESSARY_CAST;
Future<void> test_assignment() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(Object p) {
if (p is String) {
String v = ((p as String));
@@ -40,7 +40,7 @@
}
Future<void> test_assignment_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(Object p, Object q) {
if (p is String) {
String v = ((p as String));
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unnecessary_const_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unnecessary_const_test.dart
index f9a1dbf..1f1e6f2 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unnecessary_const_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unnecessary_const_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.unnecessary_const;
Future<void> test_instanceCreation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C { const C(); }
const c = const C();
''');
@@ -35,7 +35,7 @@
}
Future<void> test_typedLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
const list = const [];
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unnecessary_new_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unnecessary_new_test.dart
index c00dcb2..dc6b443 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unnecessary_new_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unnecessary_new_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.unnecessary_new;
Future<void> test_constructor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A { A(); }
f() {
final a = new A();
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_catch_clause_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_catch_clause_test.dart
index 7f5f40a..d18763d 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_catch_clause_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_catch_clause_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.REMOVE_UNUSED_CATCH_CLAUSE;
Future<void> test_removeUnusedCatchClause() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
try {
throw 42;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_catch_stack_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_catch_stack_test.dart
index 31fc9a3..730f44e 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_catch_stack_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_catch_stack_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.REMOVE_UNUSED_CATCH_STACK;
Future<void> test_removeUnusedCatchStack() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
try {
throw 42;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_element_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_element_test.dart
index 12d377c..154a433 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_element_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_element_test.dart
@@ -22,7 +22,7 @@
FixKind get kind => DartFixKind.REMOVE_UNUSED_ELEMENT;
Future<void> test_class_notUsed_inClassMember() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class _A {
staticMethod() {
new _A();
@@ -35,7 +35,7 @@
}
Future<void> test_class_notUsed_isExpression() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class _A {}
main(p) {
if (p is _A) {
@@ -47,7 +47,7 @@
}
Future<void> test_class_notUsed_noReference() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class _A {
}
''');
@@ -56,7 +56,7 @@
}
Future<void> test_enum_notUsed_noReference() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
enum _MyEnum {A, B, C}
''');
await assertHasFix(r'''
@@ -66,7 +66,7 @@
}
Future<void> test_functionLocal_notUsed_noReference() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
f() {}
}
@@ -78,7 +78,7 @@
}
Future<void> test_functionTop_notUsed_noReference() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
_f() {}
main() {
}
@@ -90,7 +90,7 @@
}
Future<void> test_functionTypeAlias_notUsed_noReference() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
typedef _F(a, b);
main() {
}
@@ -102,7 +102,7 @@
}
Future<void> test_getter_notUsed_noReference() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
get _g => null;
}
@@ -114,7 +114,7 @@
}
Future<void> test_method_notUsed_noReference() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
static _m() {}
}
@@ -126,7 +126,7 @@
}
Future<void> test_setter_notUsed_noReference() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
set _s(x) {}
}
@@ -138,7 +138,7 @@
}
Future<void> test_staticMethod_extension_notUsed_noReference() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
extension _E on String {
static int m1() => 3;
int m2() => 7;
@@ -154,7 +154,7 @@
}
Future<void> test_staticMethod_mixim_notUsed_noReference() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
mixin _M {
static int m1() => 3;
}
@@ -170,7 +170,7 @@
}
Future<void> test_staticMethod_notUsed_noReference() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class _A {
static int m() => 7;
}
@@ -184,7 +184,7 @@
}
Future<void> test_topLevelVariable_notUsed() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
int _a = 1;
main() {
_a = 2;
@@ -195,7 +195,7 @@
}
Future<void> test_topLevelVariable_notUsed_noReference_first() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
int _a = 1, b = 2;
''');
await assertHasFix(r'''
@@ -204,7 +204,7 @@
}
Future<void> test_topLevelVariable_notUsed_noReference_last() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
int a = 1, _b = 2;
''');
await assertHasFix(r'''
@@ -213,7 +213,7 @@
}
Future<void> test_topLevelVariable_notUsed_noReference_only() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
int _a = 1;
main() {}
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_field_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_field_test.dart
index b92f401..8bf054c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_field_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_field_test.dart
@@ -21,7 +21,7 @@
@FailingTest(reason: 'Unimplemented')
Future<void> test_enumValue_notUsed_noReference() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
enum _E { a, b, c }
bool f(_E e) => e == _E.a || e == _E.b;
''');
@@ -32,7 +32,7 @@
}
Future<void> test_parameter_optional_first() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
A([this._f, int x]);
@@ -46,7 +46,7 @@
}
Future<void> test_parameter_optional_first_hasRequired() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
A(int x, [this._f, int y]);
@@ -60,7 +60,7 @@
}
Future<void> test_parameter_optional_last() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
A([int x, this._f]);
@@ -74,7 +74,7 @@
}
Future<void> test_parameter_optional_middle() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
A([int x, this._f, int y]);
@@ -88,7 +88,7 @@
}
Future<void> test_parameter_optional_only() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
A([this._f]);
@@ -102,7 +102,7 @@
}
Future<void> test_parameter_optional_only_hasRequired() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
A(int x, [this._f]);
@@ -116,7 +116,7 @@
}
Future<void> test_parameter_required_beforeOptional() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
A(this._f, [int x]);
@@ -130,7 +130,7 @@
}
Future<void> test_parameter_required_first() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
int x;
@@ -146,7 +146,7 @@
}
Future<void> test_parameter_required_last() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int x;
int _f;
@@ -162,7 +162,7 @@
}
Future<void> test_parameter_required_only() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
A(this._f);
@@ -176,7 +176,7 @@
}
Future<void> test_unusedField_notUsed_assign() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
main() {
@@ -193,7 +193,7 @@
}
Future<void> test_unusedField_notUsed_compoundAssign() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
main() {
@@ -210,7 +210,7 @@
}
Future<void> test_unusedField_notUsed_constructorFieldInitializers() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
A() : _f = 0;
@@ -224,7 +224,7 @@
}
Future<void> test_unusedField_notUsed_constructorFieldInitializers1() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
int y;
@@ -240,7 +240,7 @@
}
Future<void> test_unusedField_notUsed_constructorFieldInitializers2() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f;
int y;
@@ -256,7 +256,7 @@
}
Future<void> test_unusedField_notUsed_declarationList_first() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int _f, x;
A(this._f) {
@@ -275,7 +275,7 @@
}
Future<void> test_unusedField_notUsed_declarationList_last() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
class A {
int x, _f;
A(this._f) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_import_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_import_test.dart
index f54560f..3fb232f 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_import_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_import_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_all_diverseImports() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math';
import 'dart:math';
import 'dart:async';
@@ -42,7 +42,7 @@
}
Future<void> test_all_diverseImports2() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async';
import 'dart:math' as math;
import 'dart:async';
@@ -63,7 +63,7 @@
}
Future<void> test_all_singleLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math'; import 'dart:math'; import 'dart:math';
main() {
}
@@ -75,7 +75,7 @@
}
Future<void> test_anotherImportOnLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math'; import 'dart:async';
main() {
@@ -94,7 +94,7 @@
}
Future<void> test_duplicateImport() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math';
import 'dart:math';
@@ -112,7 +112,7 @@
}
Future<void> test_multipleOfSame_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math';
import 'dart:math';
import 'dart:math';
@@ -126,7 +126,7 @@
}
Future<void> test_severalLines() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import
'dart:math';
main() {
@@ -139,7 +139,7 @@
}
Future<void> test_single() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:math';
main() {
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_label_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_label_test.dart
index a709788..df57ba1 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_label_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_label_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.REMOVE_UNUSED_LABEL;
Future<void> test_unused_onWhile() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
x:
while (true) {
@@ -38,7 +38,7 @@
}
Future<void> test_unused_onWhile_sameLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f() {
x: while (true) {
break;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_local_variable_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_local_variable_test.dart
index 5d6b701..c73b174 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_local_variable_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_local_variable_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.REMOVE_UNUSED_LOCAL_VARIABLE;
Future<void> test_inArgumentList() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
var v = 1;
print(v = 2);
@@ -35,7 +35,7 @@
}
Future<void> test_inArgumentList2() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
var v = 1;
f(v = 1, 2);
@@ -51,7 +51,7 @@
}
Future<void> test_inArgumentList3() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
var v = 1;
f(v = 1, v = 2);
@@ -67,7 +67,7 @@
}
Future<void> test_inDeclarationList() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
var v = 1, v2 = 3;
v = 2;
@@ -83,7 +83,7 @@
}
Future<void> test_inDeclarationList2() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
var v = 1, v2 = 3;
print(v);
@@ -98,14 +98,14 @@
}
Future<void> test_notInFunctionBody() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
var a = [for (var v = 0;;) 0];
''');
await assertNoFix();
}
Future<void> test_withReferences() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
var v = 1;
v = 2;
@@ -120,7 +120,7 @@
Future<void> test_withReferences_beforeDeclaration() async {
// CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION
verifyNoTestUnitErrors = false;
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
main() {
v = 2;
var v = 1;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_parameter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_parameter_test.dart
index f35360f..fc174a5 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_parameter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_parameter_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.avoid_unused_constructor_parameters;
Future<void> test_first_optionalNamed_second_optionalNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int y;
C({int x = 0, this.y = 0});
@@ -39,7 +39,7 @@
}
Future<void> test_first_optionalPositional_second_optionalPositional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int y;
C([int x = 0, this.y = 0]);
@@ -54,7 +54,7 @@
}
Future<void> test_first_required_second_optionalInvalid() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
C(int a, int b = 1,);
}
@@ -67,7 +67,7 @@
}
Future<void> test_first_requiredPositional_second_optionalNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int y;
C(int x, {this.y = 0});
@@ -82,7 +82,7 @@
}
Future<void> test_first_requiredPositional_second_optionalPositional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int y;
C(int x, [this.y = 0]);
@@ -97,7 +97,7 @@
}
Future<void> test_first_requiredPositional_second_requiredPositional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int y;
C(int x, this.y);
@@ -112,7 +112,7 @@
}
Future<void> test_last_optionalNamed_noDefaultValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
C({int x});
}
@@ -125,7 +125,7 @@
}
Future<void> test_last_optionalNamed_previous_optionalNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int x;
C({this.x = 0, int y = 0});
@@ -140,7 +140,7 @@
}
Future<void> test_last_optionalNamed_previous_requiredPositional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int x;
C(this.x, {int y = 0});
@@ -155,7 +155,7 @@
}
Future<void> test_last_optionalPositional_noDefaultValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
C([int x]);
}
@@ -169,7 +169,7 @@
Future<void>
test_last_optionalPositional_previous_optionalPositional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int x;
C([this.x = 0, int y = 0]);
@@ -185,7 +185,7 @@
Future<void>
test_last_optionalPositional_previous_requiredPositional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int x;
C(this.x, [int y = 0]);
@@ -201,7 +201,7 @@
Future<void>
test_last_requiredPositional_previous_requiredPositional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
int x;
C(this.x, int y);
@@ -216,7 +216,7 @@
}
Future<void> test_only_optionalNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
C({int x = 0});
}
@@ -229,7 +229,7 @@
}
Future<void> test_only_optionalPositional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
C([int x = 0]);
}
@@ -242,7 +242,7 @@
}
Future<void> test_only_requiredPositional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
C(int x);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/rename_to_camel_case_test.dart b/pkg/analysis_server/test/src/services/correction/fix/rename_to_camel_case_test.dart
index e44d68d..9ae1f64 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/rename_to_camel_case_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/rename_to_camel_case_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.non_constant_identifier_names;
Future<void> test_localVariable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
int my_integer_variable = 42;
int foo;
@@ -43,7 +43,7 @@
}
Future<void> test_parameter_closure() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
[0, 1, 2].forEach((my_integer_variable) {
print(my_integer_variable);
@@ -60,7 +60,7 @@
}
Future<void> test_parameter_function() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(int my_integer_variable) {
print(my_integer_variable);
}
@@ -73,7 +73,7 @@
}
Future<void> test_parameter_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
main(int my_integer_variable) {
print(my_integer_variable);
@@ -90,7 +90,7 @@
}
Future<void> test_parameter_optionalNamed() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
foo({int my_integer_variable}) {
print(my_integer_variable);
}
@@ -99,7 +99,7 @@
}
Future<void> test_parameter_optionalPositional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main([int my_integer_variable]) {
print(my_integer_variable);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_boolean_with_bool_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_boolean_with_bool_test.dart
index a9ad68a..1e38a6f 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_boolean_with_bool_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_boolean_with_bool_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.REPLACE_BOOLEAN_WITH_BOOL;
Future<void> test_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
boolean v;
boolean w;
@@ -36,7 +36,7 @@
}
Future<void> test_single() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
boolean v;
print(v);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_cascade_with_dot_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_cascade_with_dot_test.dart
index 0429ffa..8cf92ad 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_cascade_with_dot_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_cascade_with_dot_test.dart
@@ -26,7 +26,7 @@
LintNames.avoid_single_cascade_in_expression_statements;
Future<void> test_assignment_index_normalCascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int> l) {
l..[0] = 0;
}
@@ -39,7 +39,7 @@
}
Future<void> test_assignment_index_propertyAccess_normalCascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
void foo() {
0..bar[1] = 2;
@@ -59,7 +59,7 @@
}
Future<void> test_assignment_property_normalCascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(C c) {
c..s = 0;
}
@@ -78,7 +78,7 @@
}
Future<void> test_getter_normalCascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
s..length;
}
@@ -91,7 +91,7 @@
}
Future<void> test_index_normalCascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
s..[0];
}
@@ -104,7 +104,7 @@
}
Future<void> test_method_normalCascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
s..substring(0, 3);
}
@@ -121,7 +121,7 @@
class ReplaceCascadeWithDotWithNullSafetyTest extends ReplaceCascadeWithDotTest
with WithNullSafetyLintMixin {
Future<void> test_assignment_index_nullAwareCascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int>? l) {
l?..[0] = 0;
}
@@ -134,7 +134,7 @@
}
Future<void> test_assignment_property_nullAwareCascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(C? c) {
c?..s = 0;
}
@@ -153,7 +153,7 @@
}
Future<void> test_getter_nullAwareCascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String? s) {
s?..length;
}
@@ -166,7 +166,7 @@
}
Future<void> test_index_nullAwareCascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String? s) {
s?..[0];
}
@@ -179,7 +179,7 @@
}
Future<void> test_method_nullAwareCascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String? s) {
s?..substring(0, 3);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_colon_with_equals_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_colon_with_equals_test.dart
index 698a9ed..852892b 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_colon_with_equals_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_colon_with_equals_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_equal_for_default_values;
Future<void> test_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f({int a: 1}) => null;
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_final_with_const_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_final_with_const_test.dart
index 164990c..e1ffdad 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_final_with_const_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_final_with_const_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_const_declarations;
Future<void> test_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
final int a = 1;
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_new_with_const_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_new_with_const_test.dart
index 4573b3a..a1607e5 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_new_with_const_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_new_with_const_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_const_constructors;
Future<void> test_new() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
const C();
}
@@ -45,7 +45,7 @@
}
Future<void> test_noKeyword() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class C {
const C();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_null_with_closure_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_null_with_closure_test.dart
index d553d5f..8c6d3b3 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_null_with_closure_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_null_with_closure_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.null_closures;
Future<void> test_named() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int> l) {
l.firstWhere((e) => e.isEven, orElse: null);
}
@@ -37,7 +37,7 @@
}
Future<void> test_named_withArgs() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
s.splitMapJoin('', onNonMatch: null);
}
@@ -50,7 +50,7 @@
}
Future<void> test_required() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int> l) {
l.firstWhere(null);
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_future_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_future_test.dart
index e40a0b2..0c42514 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_future_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_return_type_future_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.REPLACE_RETURN_TYPE_FUTURE;
Future<void> test_adjacentNodes_withImport() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async';
var v;int main() async => 0;
''');
@@ -34,7 +34,7 @@
}
Future<void> test_adjacentNodes_withoutImport() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var v;int main() async => 0;
''');
await assertHasFix('''
@@ -43,7 +43,7 @@
}
Future<void> test_complexTypeName_withImport() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async';
List<int> main() async {
}
@@ -59,7 +59,7 @@
@failingTest
Future<void> test_complexTypeName_withoutImport() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
List<int> main() async {
}
''');
@@ -74,7 +74,7 @@
}
Future<void> test_importedWithPrefix() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async' as al;
int main() async {
}
@@ -89,7 +89,7 @@
}
Future<void> test_simpleTypeName_withImport() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'dart:async';
int main() async => 0;
''');
@@ -103,7 +103,7 @@
@failingTest
Future<void> test_simpleTypeName_withoutImport() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
int main() async => 0;
''');
await assertHasFix('''
@@ -116,7 +116,7 @@
}
Future<void> test_withLibraryDirective_withImport() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
library main;
import 'dart:async';
int main() async {
@@ -133,7 +133,7 @@
}
Future<void> test_withLibraryDirective_withoutImport() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
library main;
int main() async {
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_var_with_dynamic_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_var_with_dynamic_test.dart
index 39f3c9f..02b4eae 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_var_with_dynamic_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_var_with_dynamic_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.REPLACE_VAR_WITH_DYNAMIC;
Future<void> test_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
Map<String, var> m;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_brackets_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_brackets_test.dart
index d265a95..21075fa 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_brackets_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_brackets_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.empty_statements;
Future<void> test_outOfBlock_otherLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(bool c) {
while(c)
;
@@ -40,7 +40,7 @@
}
Future<void> test_outOfBlock_sameLine() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(bool c) {
while(c);
print('hi');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_conditional_assignment_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_conditional_assignment_test.dart
index 881c3c8f..8964e95 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_conditional_assignment_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_conditional_assignment_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_conditional_assignment;
Future<void> test_withCodeBeforeAndAfter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Person {
String _fullName;
void foo() {
@@ -51,7 +51,7 @@
}
Future<void> test_withOneBlock() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Person {
String _fullName;
void foo() {
@@ -74,7 +74,7 @@
}
Future<void> test_withoutBlock() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Person {
String _fullName;
void foo() {
@@ -96,7 +96,7 @@
}
Future<void> test_withTwoBlock() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class Person {
String _fullName;
void foo() {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_eight_digit_hex_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_eight_digit_hex_test.dart
index 010ae73..bd4e2e1 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_eight_digit_hex_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_eight_digit_hex_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.use_full_hex_values_for_flutter_colors;
Future<void> test_notHex() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
library dart.ui;
var c = Color(1);
@@ -45,7 +45,7 @@
}
Future<void> test_short() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
library dart.ui;
var c = Color(0x000001);
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_extension_name_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_extension_name_test.dart
index cc1fb07..0bf4a84 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_extension_name_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_extension_name_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.REPLACE_WITH_EXTENSION_NAME;
Future<void> test_getter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {
static int get g => 0;
}
@@ -41,7 +41,7 @@
}
Future<void> test_method() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {
static int m() => 0;
}
@@ -67,7 +67,7 @@
static int m() => 0;
}
''');
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'ext.dart' as ext;
void f() {
@@ -84,7 +84,7 @@
}
Future<void> test_setter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
extension E on String {
static set s(int i) {}
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_filled_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_filled_test.dart
index cc0af18..cdfb2bc 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_filled_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_filled_test.dart
@@ -21,21 +21,21 @@
FixKind get kind => DartFixKind.REPLACE_WITH_FILLED;
Future<void> test_nonNullableElements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = new List<int>(3);
''');
await assertNoFix();
}
Future<void> test_nonNullableElements_inferred() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
List<int> l = List(3);
''');
await assertNoFix();
}
Future<void> test_nullableElements() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = new List<int?>(3);
''');
await assertHasFix('''
@@ -44,7 +44,7 @@
}
Future<void> test_nullableElements_inferred() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
List<int?> l = List(5);
''');
await assertHasFix('''
@@ -53,7 +53,7 @@
}
Future<void> test_trailingComma() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var l = List<int?>(3,);
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_identifier_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_identifier_test.dart
index 259bf0d..ce9487a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_identifier_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_identifier_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.avoid_types_on_closure_parameters;
Future<void> test_functionTypedFormalParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var functionWithFunction = (int f(int x)) => f(0);
''');
await assertHasFix('''
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_interpolation_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_interpolation_test.dart
index 191e1bb..0a630e7 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_interpolation_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_interpolation_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_interpolation_to_compose_strings;
Future<void> test_stringLiteral_binaryExpression_stringConcatenation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var b = ['b', 'c'];
var c = 'a' + b[0] + b[1];
''');
@@ -35,7 +35,7 @@
}
Future<void> test_stringLiteral_expression_toString() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var b = [1];
var c = 'a' + b[0].toString();
''');
@@ -46,7 +46,7 @@
}
Future<void> test_stringLiteral_indexExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var b = ['b'];
var c = 'a' + b[0];
''');
@@ -57,7 +57,7 @@
}
Future<void> test_stringLiteral_parenthesizedExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var b = ['b'];
var c = 'a' + (b[0]);
''');
@@ -68,7 +68,7 @@
}
Future<void> test_stringLiteral_parenthesizedExpression_toString() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var a = 1;
var b = 2;
var c = 'a' + (a + b).toString();
@@ -81,7 +81,7 @@
}
Future<void> test_stringLiteral_variable_notRaw_double_multi() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var b = 'b';
var c = """a""" + b;
''');
@@ -92,7 +92,7 @@
}
Future<void> test_stringLiteral_variable_notRaw_double_notMulti() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var b = 'b';
var c = "a" + b;
''');
@@ -103,7 +103,7 @@
}
Future<void> test_stringLiteral_variable_notRaw_single_multi() async {
- await resolveTestUnit("""
+ await resolveTestCode("""
var b = 'b';
var c = '''a''' + b;
""");
@@ -114,7 +114,7 @@
}
Future<void> test_stringLiteral_variable_notRaw_single_notMulti() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var b = 'b';
var c = 'a' + b;
''');
@@ -125,7 +125,7 @@
}
Future<void> test_stringLiteral_variable_raw_single_notMulti() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var b = 'b';
var c = r'a' + b;
''');
@@ -133,7 +133,7 @@
}
Future<void> test_stringLiteral_variable_withEscapes() async {
- await resolveTestUnit(r'''
+ await resolveTestCode(r'''
var b = 'b';
var c = '\$a' + b;
''');
@@ -144,7 +144,7 @@
}
Future<void> test_variable_adjacentStrings() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var a = 'a';
var c = a + 'b' 'c';
''');
@@ -155,7 +155,7 @@
}
Future<void> test_variable_stringLiteral_noRuntogther() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var a = 'a';
var c = a + ' b';
''');
@@ -166,7 +166,7 @@
}
Future<void> test_variable_stringLiteral_runtogther() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var a = 'a';
var c = a + 'b';
''');
@@ -177,7 +177,7 @@
}
Future<void> test_variable_stringLiteral_variable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
var a = 'a';
var z = 'z';
var c = a + '...' + z;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_is_empty_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_is_empty_test.dart
index 815abe6..ebff731 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_is_empty_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_is_empty_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_is_empty;
Future<void> test_constantOnLeft_equal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List c) {
if (0 == c.length) {}
}
@@ -37,7 +37,7 @@
}
Future<void> test_constantOnLeft_greaterThan() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List c) {
if (1 > c.length) {}
}
@@ -50,7 +50,7 @@
}
Future<void> test_constantOnLeft_greaterThanOrEqual() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List c) {
if (0 >= c.length) {}
}
@@ -63,7 +63,7 @@
}
Future<void> test_constantOnRight_equal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List c) {
if (c.length == 0) {}
}
@@ -76,7 +76,7 @@
}
Future<void> test_constantOnRight_lessThan() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List c) {
if (c.length < 1) {}
}
@@ -89,7 +89,7 @@
}
Future<void> test_constantOnRight_lessThanOrEqual() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List c) {
if (c.length <= 0) {}
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_is_not_empty_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_is_not_empty_test.dart
index 67d0e67..b7bdd71 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_is_not_empty_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_is_not_empty_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_is_empty;
Future<void> test_constantOnLeft_lessThanOrEqual() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List c) {
if (1 <= c.length) {}
}
@@ -37,7 +37,7 @@
}
Future<void> test_constantOnLeft_notEqual() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List c) {
if (0 != c.length) {}
}
@@ -50,7 +50,7 @@
}
Future<void> test_constantOnRight_greaterThanOrEqual() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List c) {
if (c.length >= 1) {}
}
@@ -63,7 +63,7 @@
}
Future<void> test_constantOnRight_notEqual() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List c) {
if (c.length != 0) {}
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_not_null_aware_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_not_null_aware_test.dart
index 2ddd88c..1009ac6 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_not_null_aware_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_not_null_aware_test.dart
@@ -22,7 +22,7 @@
FixKind get kind => DartFixKind.REPLACE_WITH_NOT_NULL_AWARE;
Future<void> test_getter_cascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
s?..length;
}
@@ -35,7 +35,7 @@
}
Future<void> test_getter_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
s?.length;
}
@@ -48,7 +48,7 @@
}
Future<void> test_index_cascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int> x) {
x?..[0];
}
@@ -61,7 +61,7 @@
}
Future<void> test_index_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int> x) {
x?[0];
}
@@ -74,7 +74,7 @@
}
Future<void> test_method_cascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
s?..indexOf('a');
}
@@ -87,7 +87,7 @@
}
Future<void> test_method_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(String s) {
s?.indexOf('a');
}
@@ -100,7 +100,7 @@
}
Future<void> test_setter_cascade() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(C c) {
c?..s = 0;
}
@@ -119,7 +119,7 @@
}
Future<void> test_setter_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(C c) {
c?.s = 0;
}
@@ -138,7 +138,7 @@
}
Future<void> test_spread() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int> x) {
[...?x];
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_null_aware_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_null_aware_test.dart
index 526cecc..226c4f7 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_null_aware_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_null_aware_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.REPLACE_WITH_NULL_AWARE;
Future<void> test_chain() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(x) {
x?.a.b.c;
}
@@ -33,7 +33,7 @@
}
Future<void> test_methodInvocation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(x) {
x?.a.b();
}
@@ -46,7 +46,7 @@
}
Future<void> test_propertyAccess() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(x) {
x?.a().b;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_tear_off_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_tear_off_test.dart
index cf9cc3d..772ecd7 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_tear_off_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_tear_off_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.unnecessary_lambdas;
Future<void> test_function_oneParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Function f() => (name) {
print(name);
};
@@ -35,7 +35,7 @@
}
Future<void> test_function_zeroParameters() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void foo(){}
Function finalVar() {
return () {
@@ -52,7 +52,7 @@
}
Future<void> test_lambda_asArgument() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void foo() {
bool isPair(int a) => a % 2 == 0;
final finalList = <int>[];
@@ -70,7 +70,7 @@
}
Future<void> test_method_oneParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
final l = <int>[];
var a = (x) => l.indexOf(x);
''');
@@ -81,7 +81,7 @@
}
Future<void> test_method_zeroParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
final Object a = '';
Function finalVar() {
return () {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_var_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_var_test.dart
index 3e8258f..d069876 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_var_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_var_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.omit_local_variable_types;
Future<void> test_for() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int> list) {
for (int i = 0; i < list.length; i++) {
print(i);
@@ -41,7 +41,7 @@
}
Future<void> test_forEach() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int> list) {
for (int i in list) {
print(i);
@@ -58,7 +58,7 @@
}
Future<void> test_forEach_final() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(List<int> list) {
for (final int i in list) {
print(i);
@@ -75,7 +75,7 @@
}
Future<void> test_generic_instanceCreation_withArguments() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
C<int> f() {
C<int> c = C<int>();
return c;
@@ -92,7 +92,7 @@
}
Future<void> test_generic_instanceCreation_withoutArguments() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
C<int> f() {
C<int> c = C();
return c;
@@ -109,7 +109,7 @@
}
Future<void> test_generic_listLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
List f() {
List<int> l = [];
return l;
@@ -124,7 +124,7 @@
}
Future<void> test_generic_listLiteral_const() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
String f() {
const List<String> values = const ['a'];
return values[0];
@@ -139,7 +139,7 @@
}
Future<void> test_generic_mapLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Map f() {
Map<String, int> m = {};
return m;
@@ -154,7 +154,7 @@
}
Future<void> test_generic_mapLiteral_const() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Map f() {
const Map<String, int> m = const {};
return m;
@@ -169,7 +169,7 @@
}
Future<void> test_generic_setLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Set f() {
Set<int> s = {};
return s;
@@ -184,7 +184,7 @@
}
Future<void> test_generic_setLiteral_ambiguous() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Set f() {
Set s = {};
return s;
@@ -194,7 +194,7 @@
}
Future<void> test_generic_setLiteral_const() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
String f() {
const Set<String> s = const {'a'};
return s.first;
@@ -209,7 +209,7 @@
}
Future<void> test_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
String f() {
String s = '';
return s;
@@ -224,7 +224,7 @@
}
Future<void> test_simple_const() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
String f() {
const String s = '';
return s;
@@ -239,7 +239,7 @@
}
Future<void> test_simple_final() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
String f() {
final String s = '';
return s;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/sort_child_property_last_test.dart b/pkg/analysis_server/test/src/services/correction/fix/sort_child_property_last_test.dart
index ad2dd11..686d8f2 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/sort_child_property_last_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/sort_child_property_last_test.dart
@@ -33,7 +33,7 @@
/// More coverage in the `sort_child_properties_last_test.dart` assist test.
Future<void> test_sort() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
main() {
Column(
diff --git a/pkg/analysis_server/test/src/services/correction/fix/update_sdk_constraints_test.dart b/pkg/analysis_server/test/src/services/correction/fix/update_sdk_constraints_test.dart
index 5fc9bb4..d6f6cf6 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/update_sdk_constraints_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/update_sdk_constraints_test.dart
@@ -92,7 +92,7 @@
environment:
sdk: $from
''');
- await resolveTestUnit(content ??
+ await resolveTestCode(content ??
'''
Future<int> zero() async => 0;
''');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/use_const_test.dart b/pkg/analysis_server/test/src/services/correction/fix/use_const_test.dart
index fca39ddf..62e0701 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/use_const_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/use_const_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.USE_CONST;
Future<void> test_explicitNew() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class A {
const A();
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/use_effective_integer_division_test.dart b/pkg/analysis_server/test/src/services/correction/fix/use_effective_integer_division_test.dart
index d47bc80..d8a6c78 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/use_effective_integer_division_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/use_effective_integer_division_test.dart
@@ -20,7 +20,7 @@
FixKind get kind => DartFixKind.USE_EFFECTIVE_INTEGER_DIVISION;
Future<void> test_normalDivision() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main() {
var a = 5;
var b = 2;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/use_eq_eq_null_test.dart b/pkg/analysis_server/test/src/services/correction/fix/use_eq_eq_null_test.dart
index c2203bb..89ecb3f 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/use_eq_eq_null_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/use_eq_eq_null_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.USE_EQ_EQ_NULL;
Future<void> test_isNull() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
p is Null;
}
@@ -34,7 +34,7 @@
}
Future<void> test_isNull_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p, q) {
p is Null;
q is Null;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/use_is_not_empty_test.dart b/pkg/analysis_server/test/src/services/correction/fix/use_is_not_empty_test.dart
index 14cdc4b..04a82ac 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/use_is_not_empty_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/use_is_not_empty_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.prefer_is_not_empty;
Future<void> test_notIsEmpty() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
f(List<int> l) {
if (!l.isEmpty) {}
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/use_not_eq_null_test.dart b/pkg/analysis_server/test/src/services/correction/fix/use_not_eq_null_test.dart
index f4c8590..a22c3f8 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/use_not_eq_null_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/use_not_eq_null_test.dart
@@ -21,7 +21,7 @@
FixKind get kind => DartFixKind.USE_NOT_EQ_NULL;
Future<void> test_isNotNull() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p) {
p is! Null;
}
@@ -34,7 +34,7 @@
}
Future<void> test_isNotNull_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
main(p, q) {
p is! Null;
q is! Null;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/use_rethrow_test.dart b/pkg/analysis_server/test/src/services/correction/fix/use_rethrow_test.dart
index 4d8c8a10..6d78eb0 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/use_rethrow_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/use_rethrow_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.use_rethrow_when_possible;
Future<void> test_rethrow() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void bad1() {
try {} catch (e) {
throw e;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/wrap_in_future_test.dart b/pkg/analysis_server/test/src/services/correction/fix/wrap_in_future_test.dart
index 3736686..b86e482 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/wrap_in_future_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/wrap_in_future_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.avoid_returning_null_for_future;
Future<void> test_asyncFor() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
Future<String> f() {
return null;
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/wrap_in_text_test.dart b/pkg/analysis_server/test/src/services/correction/fix/wrap_in_text_test.dart
index 7c67cbd..bca0c26 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/wrap_in_text_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/wrap_in_text_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_literal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
Widget f() => Center(child: 'aaa');
''');
@@ -39,7 +39,7 @@
}
Future<void> test_notString() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
Widget center(int i) => Center(child: i);
''');
@@ -47,7 +47,7 @@
}
Future<void> test_parameterType_notClass() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
typedef F = void Function();
void foo({F a}) {}
@@ -60,7 +60,7 @@
}
Future<void> test_parameterType_notWidget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void f(int i) {
f('a');
}
@@ -69,7 +69,7 @@
}
Future<void> test_variable() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
Widget center(String s) => Center(child: s);
''');
diff --git a/pkg/analysis_server/test/src/services/flutter/container_properties_test.dart b/pkg/analysis_server/test/src/services/flutter/container_properties_test.dart
index 5947dcc..a546043 100644
--- a/pkg/analysis_server/test/src/services/flutter/container_properties_test.dart
+++ b/pkg/analysis_server/test/src/services/flutter/container_properties_test.dart
@@ -20,7 +20,7 @@
@reflectiveTest
class ContainerPropertiesTest extends WidgetDescriptionBase {
Future<void> test_container_existing() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -49,7 +49,7 @@
}
Future<void> test_container_virtual() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -82,7 +82,7 @@
@reflectiveTest
class ContainerPropertyAlignmentTest extends WidgetDescriptionBase {
Future<void> test_read_hasAlign_notSimple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -99,7 +99,7 @@
}
Future<void> test_read_hasAlign_simple() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -131,7 +131,7 @@
}
Future<void> test_read_hasContainer() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -163,7 +163,7 @@
}
Future<void> test_read_hasContainer_directional() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -195,7 +195,7 @@
}
Future<void> test_write_hasAlign_change() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -227,7 +227,7 @@
}
Future<void> test_write_hasAlign_remove() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -256,7 +256,7 @@
}
Future<void> test_write_hasContainer_add() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -287,7 +287,7 @@
}
Future<void> test_write_hasContainer_change() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -319,7 +319,7 @@
}
Future<void> test_write_hasContainer_remove() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -348,7 +348,7 @@
}
Future<void> test_write_hasPadding_add() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -381,7 +381,7 @@
}
Future<void> test_write_noContainer_add() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -438,7 +438,7 @@
@reflectiveTest
class ContainerPropertyPaddingTest extends WidgetDescriptionBase {
Future<void> test_read_hasContainer_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -516,7 +516,7 @@
}
Future<void> test_read_hasContainer_fromLTRB() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -594,7 +594,7 @@
}
Future<void> test_read_hasContainer_only() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -664,7 +664,7 @@
}
Future<void> test_read_hasContainer_symmetric() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -742,7 +742,7 @@
}
Future<void> test_read_hasPadding_only() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -812,7 +812,7 @@
}
Future<void> test_write_hasAlign_add_only() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -846,7 +846,7 @@
}
Future<void> test_write_hasContainer_add_only() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -878,7 +878,7 @@
}
Future<void> test_write_hasContainer_change_all() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -911,7 +911,7 @@
}
Future<void> test_write_hasContainer_change_only() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -944,7 +944,7 @@
}
Future<void> test_write_hasContainer_change_remove() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -976,7 +976,7 @@
}
Future<void> test_write_hasContainer_change_symmetric_both() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -1009,7 +1009,7 @@
}
Future<void> test_write_hasContainer_change_symmetric_horizontal() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -1042,7 +1042,7 @@
}
Future<void> test_write_hasContainer_change_symmetric_vertical() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -1075,7 +1075,7 @@
}
Future<void> test_write_hasPadding_change_only() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -1108,7 +1108,7 @@
}
Future<void> test_write_noContainer_add_only() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
diff --git a/pkg/analysis_server/test/src/services/flutter/widget_descriptions_test.dart b/pkg/analysis_server/test/src/services/flutter/widget_descriptions_test.dart
index dc0567d..a29b993 100644
--- a/pkg/analysis_server/test/src/services/flutter/widget_descriptions_test.dart
+++ b/pkg/analysis_server/test/src/services/flutter/widget_descriptions_test.dart
@@ -18,7 +18,7 @@
@reflectiveTest
class GetDescriptionTest extends WidgetDescriptionBase {
Future<void> test_documentation_fieldFormalParameter() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyWidget {
/// my doc
final int f;
@@ -35,7 +35,7 @@
Future<void> test_documentation_fieldFormalParameter_unresolvedField() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
class MyWidget {
MyWidget(this.f);
}
@@ -49,7 +49,7 @@
}
Future<void> test_kind_named_notSet() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -72,7 +72,7 @@
}
Future<void> test_kind_named_set() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -99,7 +99,7 @@
}
Future<void> test_kind_required() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -126,7 +126,7 @@
}
Future<void> test_nested_notSet() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -150,7 +150,7 @@
}
Future<void> test_nested_set() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -203,7 +203,7 @@
}
Future<void> test_notInstanceCreation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
void main() {
42;
}
@@ -213,7 +213,7 @@
}
Future<void> test_type_double() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -235,7 +235,7 @@
}
Future<void> test_type_enum() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -293,7 +293,7 @@
}
Future<void> test_type_int() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -316,7 +316,7 @@
Future<void> test_unresolvedInstanceCreation() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
void main() {
new Foo();
}
@@ -329,7 +329,7 @@
@reflectiveTest
class SetPropertyValueSelfTest extends WidgetDescriptionBase {
Future<void> test_expression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -353,7 +353,7 @@
}
Future<void> test_expression_formatError() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -376,7 +376,7 @@
}
Future<void> test_format_dontFormatOther() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void functionbefore() {
@@ -419,7 +419,7 @@
}
Future<void> test_invalidId() async {
- await resolveTestUnit('');
+ await resolveTestCode('');
var result = await descriptions.setPropertyValue(42, null);
@@ -431,7 +431,7 @@
}
Future<void> test_named_addValue_beforeChild() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -468,7 +468,7 @@
}
Future<void> test_named_addValue_beforeChildren() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -505,7 +505,7 @@
}
Future<void> test_named_addValue_hasComma() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -532,7 +532,7 @@
}
Future<void> test_named_addValue_noComma() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -559,7 +559,7 @@
}
Future<void> test_named_addValue_sortedByName_first() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -596,7 +596,7 @@
}
Future<void> test_named_addValue_sortedByName_last() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -633,7 +633,7 @@
}
Future<void> test_named_addValue_sortedByName_middle() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -672,7 +672,7 @@
}
Future<void> test_named_changeValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -696,7 +696,7 @@
}
Future<void> test_named_removeValue_last() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -717,7 +717,7 @@
}
Future<void> test_named_removeValue_notLast() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -738,7 +738,7 @@
}
Future<void> test_nested_addValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -769,7 +769,7 @@
}
Future<void> test_nested_addValue_materialize() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -800,7 +800,7 @@
}
Future<void> test_required_changeValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -824,7 +824,7 @@
}
Future<void> test_required_removeValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
@@ -843,7 +843,7 @@
}
Future<void> test_type_enum_addValue() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
void main() {
diff --git a/pkg/analysis_server/test/src/utilities/flutter_test.dart b/pkg/analysis_server/test/src/utilities/flutter_test.dart
index 446b4dd..0d8276a 100644
--- a/pkg/analysis_server/test/src/utilities/flutter_test.dart
+++ b/pkg/analysis_server/test/src/utilities/flutter_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_getWidgetPresentationText_icon() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
var w = const Icon(Icons.book);
''');
@@ -38,7 +38,7 @@
Future<void> test_getWidgetPresentationText_icon_withoutArguments() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
var w = const Icon();
''');
@@ -47,7 +47,7 @@
}
Future<void> test_getWidgetPresentationText_notWidget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
var w = new Object();
''');
@@ -56,7 +56,7 @@
}
Future<void> test_getWidgetPresentationText_text() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
var w = const Text('foo');
''');
@@ -65,7 +65,7 @@
}
Future<void> test_getWidgetPresentationText_text_longText() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
var w = const Text('${'abc' * 100}');
''');
@@ -78,7 +78,7 @@
Future<void> test_getWidgetPresentationText_text_withoutArguments() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
var w = const Text();
''');
@@ -88,7 +88,7 @@
Future<void> test_getWidgetPresentationText_unresolved() async {
verifyNoTestUnitErrors = false;
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/material.dart';
var w = new Foo();
''');
@@ -97,7 +97,7 @@
}
Future<void> test_identifyWidgetExpression_node_instanceCreation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
@@ -153,7 +153,7 @@
}
Future<void> test_identifyWidgetExpression_node_invocation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
@@ -186,7 +186,7 @@
}
Future<void> test_identifyWidgetExpression_node_namedExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
@@ -201,7 +201,7 @@
Future<void>
test_identifyWidgetExpression_node_prefixedIdentifier_identifier() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
abstract class Foo extends Widget {
@@ -218,7 +218,7 @@
Future<void>
test_identifyWidgetExpression_node_prefixedIdentifier_prefix() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
abstract class Foo extends Widget {
@@ -234,7 +234,7 @@
}
Future<void> test_identifyWidgetExpression_node_simpleIdentifier() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main(Widget widget) {
@@ -246,7 +246,7 @@
}
Future<void> test_identifyWidgetExpression_null() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
@@ -269,7 +269,7 @@
}
Future<void> test_identifyWidgetExpression_parent_argumentList() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
@@ -285,7 +285,7 @@
Future<void>
test_identifyWidgetExpression_parent_assignmentExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
@@ -316,7 +316,7 @@
Future<void>
test_identifyWidgetExpression_parent_conditionalExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main(bool condition, Widget w1, Widget w2) {
@@ -332,7 +332,7 @@
Future<void>
test_identifyWidgetExpression_parent_expressionFunctionBody() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main(Widget widget) => widget; // ref
@@ -343,7 +343,7 @@
Future<void>
test_identifyWidgetExpression_parent_expressionStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main(Widget widget) {
@@ -355,7 +355,7 @@
}
Future<void> test_identifyWidgetExpression_parent_forElement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main(bool b) {
@@ -371,7 +371,7 @@
}
Future<void> test_identifyWidgetExpression_parent_ifElement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main(bool b) {
@@ -393,7 +393,7 @@
}
Future<void> test_identifyWidgetExpression_parent_listLiteral() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main(Widget widget) {
@@ -405,7 +405,7 @@
}
Future<void> test_identifyWidgetExpression_parent_namedExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
@@ -420,7 +420,7 @@
}
Future<void> test_identifyWidgetExpression_parent_returnStatement() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main(Widget widget) {
@@ -432,7 +432,7 @@
}
Future<void> test_isWidget() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
class MyStatelessWidget extends StatelessWidget {}
@@ -458,7 +458,7 @@
}
Future<void> test_isWidgetCreation() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
var a = new Object();
@@ -474,7 +474,7 @@
}
Future<void> test_isWidgetExpression() async {
- await resolveTestUnit('''
+ await resolveTestCode('''
import 'package:flutter/widgets.dart';
main() {
diff --git a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
index b4571c0..65fdea6 100644
--- a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
@@ -282,8 +282,10 @@
for (String excludedPath in excludeList) {
Context context = resourceProvider.pathContext;
if (context.isRelative(excludedPath)) {
- excludedPath =
- context.join(optionsFile.parent.path, excludedPath);
+ excludedPath = posix.joinAll([
+ ...context.split(optionsFile.parent.path),
+ ...posix.split(excludedPath),
+ ]);
}
patterns.add(Glob(excludedPath, context: context));
}
diff --git a/pkg/analyzer/lib/src/pubspec/pubspec_validator.dart b/pkg/analyzer/lib/src/pubspec/pubspec_validator.dart
index 9e9b8a6..83c2031 100644
--- a/pkg/analyzer/lib/src/pubspec/pubspec_validator.dart
+++ b/pkg/analyzer/lib/src/pubspec/pubspec_validator.dart
@@ -219,8 +219,9 @@
var context = provider.pathContext;
var normalizedPath = context.joinAll(path.posix.split(pathEntry));
var packageRoot = context.dirname(source.fullName);
- var dependencyPath =
- path.canonicalize(context.join(packageRoot, normalizedPath));
+ var dependencyPath = context.join(packageRoot, normalizedPath);
+ dependencyPath = context.absolute(dependencyPath);
+ dependencyPath = context.normalize(dependencyPath);
var packageFolder = provider.getFolder(dependencyPath);
if (!packageFolder.exists) {
_reportErrorForNode(reporter, node.value,
diff --git a/pkg/dartdev/lib/dartdev.dart b/pkg/dartdev/lib/dartdev.dart
index e2648b5..1a75867 100644
--- a/pkg/dartdev/lib/dartdev.dart
+++ b/pkg/dartdev/lib/dartdev.dart
@@ -24,7 +24,6 @@
import 'src/core.dart';
import 'src/events.dart';
import 'src/experiments.dart';
-import 'src/sdk.dart';
import 'src/utils.dart';
import 'src/vm_interop_handler.dart';
@@ -224,10 +223,7 @@
addCommand(CompileCommand());
addCommand(FixCommand());
addCommand(FormatCommand(verbose: verbose));
- addCommand(MigrateCommand(
- verbose: verbose,
- hidden: Runtime.runtime.stableChannel,
- ));
+ addCommand(MigrateCommand(verbose: verbose));
addCommand(PubCommand());
addCommand(RunCommand(verbose: verbose));
addCommand(TestCommand());
diff --git a/pkg/nnbd_migration/lib/migration_cli.dart b/pkg/nnbd_migration/lib/migration_cli.dart
index 5d998c3..7fc65a7 100644
--- a/pkg/nnbd_migration/lib/migration_cli.dart
+++ b/pkg/nnbd_migration/lib/migration_cli.dart
@@ -229,23 +229,14 @@
static const String migrationGuideLink =
'See https://dart.dev/go/null-safety-migration for a migration guide.';
- static const String preFlagFlipCaveat =
- 'Note: this tool is currently running on an SDK version where null '
- 'safety is not yet enabled by default. You may encounter issues in the '
- 'migration process - some aspects of the toolchain assume that they are '
- 'running on an SDK where null safety has been enabled by default.';
-
/// Return whether the SDK has null safety on by default.
static bool get nullSafetyOnByDefault => IsEnabledByDefault.non_nullable;
final bool verbose;
- @override
- final bool hidden;
-
ArgParser _argParser;
- MigrateCommand({this.verbose = false, this.hidden = false}) {
+ MigrateCommand({this.verbose = false}) {
MigrationCli._defineOptions(argParser, !verbose);
}
@@ -258,9 +249,7 @@
}
@override
- String get description => nullSafetyOnByDefault
- ? '$cmdDescription\n\n$migrationGuideLink'
- : '$cmdDescription\n\n$preFlagFlipCaveat\n\n$migrationGuideLink';
+ String get description => '$cmdDescription\n\n$migrationGuideLink';
@override
String get invocation {
@@ -718,11 +707,6 @@
logger.stdout('Migrating ${options.directory}');
logger.stdout('');
- if (!MigrateCommand.nullSafetyOnByDefault) {
- logger.stdout(MigrateCommand.preFlagFlipCaveat);
- logger.stdout('');
- }
-
logger.stdout(MigrateCommand.migrationGuideLink);
logger.stdout('');
@@ -1229,14 +1213,16 @@
/*late*/ bool _shouldDrawProgress;
/// The width of the terminal, in terms of characters.
- /*late*/ int _width;
+ /*late*/
+ int _width;
final Logger _logger;
/// The inner width of the terminal, in terms of characters.
///
/// This represents the number of characters available for drawing progress.
- /*late*/ int _innerWidth;
+ /*late*/
+ int _innerWidth;
final int _totalTickCount;
diff --git a/pkg/vm_service/CHANGELOG.md b/pkg/vm_service/CHANGELOG.md
index d686205..bbb753e 100644
--- a/pkg/vm_service/CHANGELOG.md
+++ b/pkg/vm_service/CHANGELOG.md
@@ -1,11 +1,19 @@
# Changelog
+
## 5.4.0
+- Update to version `3.41.0` of the spec.
+- Added `PortList` class.
+- Added `getPorts` RPC.
+- Added optional properties `portId`, `allocationLocation`, and `debugName` to
+ `InstanceRef` and `Instance`.
+
+## 5.3.1
+- Rename `State` class to `_State` to avoid class name conflicts with Flutter.
+
+## 5.3.0
- Added support for `dart:io` extensions version 1.5.
- Added combination getter/setter `socketProfilingEnabled`.
- Deprecated `startSocketProfiling` and `pauseSocketProfiling`.
-
-## 5.3.0
-- Added support for `dart:io` extensions version 1.4.
- Update to version `3.40.0` of the spec.
- Added `IsolateFlag` class.
- Added `isolateFlags` property to `Isolate`.
diff --git a/pkg/vm_service/example/vm_service_assert.dart b/pkg/vm_service/example/vm_service_assert.dart
index e2ae6d1..617bd7c 100644
--- a/pkg/vm_service/example/vm_service_assert.dart
+++ b/pkg/vm_service/example/vm_service_assert.dart
@@ -192,6 +192,7 @@
if (obj == "MirrorReference") return obj;
if (obj == "Null") return obj;
if (obj == "PlainInstance") return obj;
+ if (obj == "ReceivePort") return obj;
if (obj == "RegExp") return obj;
if (obj == "StackTrace") return obj;
if (obj == "String") return obj;
@@ -912,6 +913,13 @@
return obj;
}
+vms.PortList assertPortList(vms.PortList obj) {
+ assertNotNull(obj);
+ assertString(obj.type);
+ assertListOfInstanceRef(obj.ports);
+ return obj;
+}
+
vms.ProfileFunction assertProfileFunction(vms.ProfileFunction obj) {
assertNotNull(obj);
assertString(obj.kind);
diff --git a/pkg/vm_service/java/.gitignore b/pkg/vm_service/java/.gitignore
index ae6691f..8803d45 100644
--- a/pkg/vm_service/java/.gitignore
+++ b/pkg/vm_service/java/.gitignore
@@ -25,6 +25,7 @@
src/org/dartlang/vm/service/consumer/InvokeConsumer.java
src/org/dartlang/vm/service/consumer/KillConsumer.java
src/org/dartlang/vm/service/consumer/PauseConsumer.java
+src/org/dartlang/vm/service/consumer/PortListConsumer.java
src/org/dartlang/vm/service/consumer/ProcessMemoryUsageConsumer.java
src/org/dartlang/vm/service/consumer/ProtocolListConsumer.java
src/org/dartlang/vm/service/consumer/ReloadSourcesConsumer.java
@@ -95,6 +96,7 @@
src/org/dartlang/vm/service/element/NullRef.java
src/org/dartlang/vm/service/element/Obj.java
src/org/dartlang/vm/service/element/ObjRef.java
+src/org/dartlang/vm/service/element/PortList.java
src/org/dartlang/vm/service/element/ProcessMemoryItem.java
src/org/dartlang/vm/service/element/ProcessMemoryUsage.java
src/org/dartlang/vm/service/element/ProfileFunction.java
diff --git a/pkg/vm_service/java/version.properties b/pkg/vm_service/java/version.properties
index d0564a6..ae41aeb 100644
--- a/pkg/vm_service/java/version.properties
+++ b/pkg/vm_service/java/version.properties
@@ -1 +1 @@
-version=3.40
+version=3.41
diff --git a/pkg/vm_service/lib/src/dart_io_extensions.dart b/pkg/vm_service/lib/src/dart_io_extensions.dart
index 6dbca6f4..2fe6ce2 100644
--- a/pkg/vm_service/lib/src/dart_io_extensions.dart
+++ b/pkg/vm_service/lib/src/dart_io_extensions.dart
@@ -237,12 +237,12 @@
}
/// A [Response] containing the enabled state of a service extension.
-abstract class State extends Response {
- State({@required this.enabled});
+abstract class _State extends Response {
+ _State({@required this.enabled});
// TODO(bkonyi): make this part of the vm_service.dart library so we can
// call super._fromJson.
- State._fromJson(Map<String, dynamic> json) : enabled = json['enabled'] {
+ _State._fromJson(Map<String, dynamic> json) : enabled = json['enabled'] {
type = json['type'];
}
@@ -251,7 +251,7 @@
/// A [HttpTimelineLoggingState] provides information about the current state of HTTP
/// request logging for a given isolate.
-class HttpTimelineLoggingState extends State {
+class HttpTimelineLoggingState extends _State {
static HttpTimelineLoggingState parse(Map json) =>
json == null ? null : HttpTimelineLoggingState._fromJson(json);
@@ -263,7 +263,7 @@
/// A [SocketProfilingState] provides information about the current state of
/// socket profiling for a given isolate.
-class SocketProfilingState extends State {
+class SocketProfilingState extends _State {
static SocketProfilingState parse(Map json) =>
json == null ? null : SocketProfilingState._fromJson(json);
diff --git a/pkg/vm_service/lib/src/vm_service.dart b/pkg/vm_service/lib/src/vm_service.dart
index fd20c5b..4dfc752 100644
--- a/pkg/vm_service/lib/src/vm_service.dart
+++ b/pkg/vm_service/lib/src/vm_service.dart
@@ -28,7 +28,7 @@
HeapSnapshotObjectNoData,
HeapSnapshotObjectNullData;
-const String vmServiceVersion = '3.40.0';
+const String vmServiceVersion = '3.41.0';
/// @optional
const String optional = 'optional';
@@ -157,6 +157,7 @@
'Null': NullVal.parse,
'@Object': ObjRef.parse,
'Object': Obj.parse,
+ 'PortList': PortList.parse,
'ProfileFunction': ProfileFunction.parse,
'ProtocolList': ProtocolList.parse,
'Protocol': Protocol.parse,
@@ -209,6 +210,7 @@
'getIsolateGroupMemoryUsage': const ['MemoryUsage'],
'getScripts': const ['ScriptList'],
'getObject': const ['Obj'],
+ 'getPorts': const ['PortList'],
'getRetainingPath': const ['RetainingPath'],
'getProcessMemoryUsage': const ['ProcessMemoryUsage'],
'getStack': const ['Stack'],
@@ -688,6 +690,12 @@
int count,
});
+ /// The `getPorts` RPC is used to retrieve the list of `ReceivePort` instances
+ /// for a given isolate.
+ ///
+ /// See [PortList].
+ Future<PortList> getPorts(String isolateId);
+
/// The `getRetainingPath` RPC is used to lookup a path from an object
/// specified by `targetId` to a GC root (i.e., the object which is preventing
/// this object from being garbage collected).
@@ -1318,6 +1326,11 @@
count: params['count'],
);
break;
+ case 'getPorts':
+ response = await _serviceImplementation.getPorts(
+ params['isolateId'],
+ );
+ break;
case 'getRetainingPath':
response = await _serviceImplementation.getRetainingPath(
params['isolateId'],
@@ -1771,6 +1784,10 @@
});
@override
+ Future<PortList> getPorts(String isolateId) =>
+ _call('getPorts', {'isolateId': isolateId});
+
+ @override
Future<RetainingPath> getRetainingPath(
String isolateId, String targetId, int limit) =>
_call('getRetainingPath',
@@ -2432,6 +2449,9 @@
/// An instance of the Dart class BoundedType.
static const String kBoundedType = 'BoundedType';
+
+ /// An instance of the Dart class ReceivePort.
+ static const String kReceivePort = 'ReceivePort';
}
/// A `SentinelKind` is used to distinguish different kinds of `Sentinel`
@@ -4239,6 +4259,27 @@
@optional
ContextRef closureContext;
+ /// The port ID for a ReceivePort.
+ ///
+ /// Provided for instance kinds:
+ /// - ReceivePort
+ @optional
+ int portId;
+
+ /// The stack trace associated with the allocation of a ReceivePort.
+ ///
+ /// Provided for instance kinds:
+ /// - ReceivePort
+ @optional
+ InstanceRef allocationLocation;
+
+ /// A name associated with a ReceivePort used for debugging purposes.
+ ///
+ /// Provided for instance kinds:
+ /// - ReceivePort
+ @optional
+ String debugName;
+
InstanceRef({
@required this.kind,
@required this.classRef,
@@ -4252,6 +4293,9 @@
this.pattern,
this.closureFunction,
this.closureContext,
+ this.portId,
+ this.allocationLocation,
+ this.debugName,
}) : super(id: id);
InstanceRef._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -4269,6 +4313,10 @@
createServiceObject(json['closureFunction'], const ['FuncRef']);
closureContext =
createServiceObject(json['closureContext'], const ['ContextRef']);
+ portId = json['portId'];
+ allocationLocation =
+ createServiceObject(json['allocationLocation'], const ['InstanceRef']);
+ debugName = json['debugName'];
}
@override
@@ -4288,6 +4336,9 @@
_setIfNotNull(json, 'pattern', pattern?.toJson());
_setIfNotNull(json, 'closureFunction', closureFunction?.toJson());
_setIfNotNull(json, 'closureContext', closureContext?.toJson());
+ _setIfNotNull(json, 'portId', portId);
+ _setIfNotNull(json, 'allocationLocation', allocationLocation?.toJson());
+ _setIfNotNull(json, 'debugName', debugName);
return json;
}
@@ -4318,6 +4369,7 @@
/// - Double (suitable for passing to Double.parse())
/// - Int (suitable for passing to int.parse())
/// - String (value may be truncated)
+ /// - StackTrace
@optional
String valueAsString;
@@ -4554,6 +4606,27 @@
@optional
InstanceRef bound;
+ /// The port ID for a ReceivePort.
+ ///
+ /// Provided for instance kinds:
+ /// - ReceivePort
+ @optional
+ int portId;
+
+ /// The stack trace associated with the allocation of a ReceivePort.
+ ///
+ /// Provided for instance kinds:
+ /// - ReceivePort
+ @optional
+ InstanceRef allocationLocation;
+
+ /// A name associated with a ReceivePort used for debugging purposes.
+ ///
+ /// Provided for instance kinds:
+ /// - ReceivePort
+ @optional
+ String debugName;
+
Instance({
@required this.kind,
@required this.classRef,
@@ -4582,6 +4655,9 @@
this.parameterIndex,
this.targetType,
this.bound,
+ this.portId,
+ this.allocationLocation,
+ this.debugName,
}) : super(id: id);
Instance._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
@@ -4627,6 +4703,10 @@
parameterIndex = json['parameterIndex'];
targetType = createServiceObject(json['targetType'], const ['InstanceRef']);
bound = createServiceObject(json['bound'], const ['InstanceRef']);
+ portId = json['portId'];
+ allocationLocation =
+ createServiceObject(json['allocationLocation'], const ['InstanceRef']);
+ debugName = json['debugName'];
}
@override
@@ -4663,6 +4743,9 @@
_setIfNotNull(json, 'parameterIndex', parameterIndex);
_setIfNotNull(json, 'targetType', targetType?.toJson());
_setIfNotNull(json, 'bound', bound?.toJson());
+ _setIfNotNull(json, 'portId', portId);
+ _setIfNotNull(json, 'allocationLocation', allocationLocation?.toJson());
+ _setIfNotNull(json, 'debugName', debugName);
return json;
}
@@ -5743,6 +5826,37 @@
String toString() => '[Obj type: ${type}, id: ${id}]';
}
+/// A `PortList` contains a list of ports associated with some isolate.
+///
+/// See [getPort].
+class PortList extends Response {
+ static PortList parse(Map<String, dynamic> json) =>
+ json == null ? null : PortList._fromJson(json);
+
+ List<InstanceRef> ports;
+
+ PortList({
+ @required this.ports,
+ });
+
+ PortList._fromJson(Map<String, dynamic> json) : super._fromJson(json) {
+ ports = List<InstanceRef>.from(
+ createServiceObject(json['ports'], const ['InstanceRef']) ?? []);
+ }
+
+ @override
+ Map<String, dynamic> toJson() {
+ var json = <String, dynamic>{};
+ json['type'] = 'PortList';
+ json.addAll({
+ 'ports': ports.map((f) => f.toJson()).toList(),
+ });
+ return json;
+ }
+
+ String toString() => '[PortList type: ${type}, ports: ${ports}]';
+}
+
/// A `ProfileFunction` contains profiling information about a Dart or native
/// function.
///
diff --git a/pkg/vm_service/pubspec.yaml b/pkg/vm_service/pubspec.yaml
index 690f8b6..0c77a68 100644
--- a/pkg/vm_service/pubspec.yaml
+++ b/pkg/vm_service/pubspec.yaml
@@ -2,7 +2,7 @@
description: >-
A library to communicate with a service implementing the Dart VM
service protocol.
-version: 5.3.0
+version: 5.4.0
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/vm_service
diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc
index 4b381cb..905cb26 100644
--- a/runtime/lib/isolate.cc
+++ b/runtime/lib/isolate.cc
@@ -51,11 +51,12 @@
return Smi::New(hash);
}
-DEFINE_NATIVE_ENTRY(RawReceivePortImpl_factory, 0, 1) {
+DEFINE_NATIVE_ENTRY(RawReceivePortImpl_factory, 0, 2) {
ASSERT(
TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0)).IsNull());
+ GET_NON_NULL_NATIVE_ARGUMENT(String, debug_name, arguments->NativeArgAt(1));
Dart_Port port_id = PortMap::CreatePort(isolate->message_handler());
- return ReceivePort::New(port_id, false /* not control port */);
+ return ReceivePort::New(port_id, debug_name, false /* not control port */);
}
DEFINE_NATIVE_ENTRY(RawReceivePortImpl_get_id, 0, 1) {
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 3a010c2..458e9a1 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -1095,7 +1095,7 @@
const Array& fields = Array::Handle(klass.fields());
const intptr_t num_fields = fields.Length();
- const Array& functions = Array::Handle(klass.functions());
+ const Array& functions = Array::Handle(klass.current_functions());
const intptr_t num_functions = functions.Length();
Instance& member_mirror = Instance::Handle();
@@ -1140,7 +1140,7 @@
Exceptions::PropagateError(error);
}
- const Array& functions = Array::Handle(klass.functions());
+ const Array& functions = Array::Handle(klass.current_functions());
const intptr_t num_functions = functions.Length();
Instance& constructor_mirror = Instance::Handle();
diff --git a/runtime/lib/stacktrace.cc b/runtime/lib/stacktrace.cc
index c2d8657..4b2afb9 100644
--- a/runtime/lib/stacktrace.cc
+++ b/runtime/lib/stacktrace.cc
@@ -224,4 +224,12 @@
return stacktrace;
}
+bool HasStack() {
+ Thread* thread = Thread::Current();
+ StackFrameIterator frames(ValidationPolicy::kDontValidateFrames, thread,
+ StackFrameIterator::kNoCrossThreadIteration);
+ StackFrame* frame = frames.NextFrame();
+ return frame != nullptr;
+}
+
} // namespace dart
diff --git a/runtime/lib/stacktrace.h b/runtime/lib/stacktrace.h
index 9c8abae..a804d62 100644
--- a/runtime/lib/stacktrace.h
+++ b/runtime/lib/stacktrace.h
@@ -21,6 +21,9 @@
// Creates a StackTrace object to be attached to an exception.
StackTracePtr GetStackTraceForException();
+// Returns false if there is no Dart stack available.
+bool HasStack();
+
} // namespace dart
#endif // RUNTIME_LIB_STACKTRACE_H_
diff --git a/runtime/observatory/lib/src/models/objects/instance.dart b/runtime/observatory/lib/src/models/objects/instance.dart
index ab8d6d6..a0400c5 100644
--- a/runtime/observatory/lib/src/models/objects/instance.dart
+++ b/runtime/observatory/lib/src/models/objects/instance.dart
@@ -120,6 +120,9 @@
/// An instance of the Dart class TypeRef.
typeRef,
+
+ /// An instance of the Dart class RawReceivePort
+ receivePort,
}
bool isTypedData(InstanceKind? kind) {
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index 7215ef7..8352f38 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -2781,6 +2781,8 @@
return M.InstanceKind.typeParameter;
case 'TypeRef':
return M.InstanceKind.typeRef;
+ case 'ReceivePort':
+ return M.InstanceKind.receivePort;
}
var message = 'Unrecognized instance kind: $s';
Logger.root.severe(message);
diff --git a/runtime/observatory/tests/service/get_ports_public_rpc_test.dart b/runtime/observatory/tests/service/get_ports_public_rpc_test.dart
new file mode 100644
index 0000000..cc511f7
--- /dev/null
+++ b/runtime/observatory/tests/service/get_ports_public_rpc_test.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:isolate' hide Isolate;
+import 'package:observatory/service_io.dart';
+import 'package:test/test.dart';
+
+import 'test_helper.dart';
+
+var port1;
+var port2;
+var port3;
+
+void warmup() {
+ port1 = RawReceivePort(null, 'port1');
+ port2 = RawReceivePort((_) {});
+ port3 = RawReceivePort((_) {}, 'port3');
+ port3.close();
+ RawReceivePort((_) {}, 'port4');
+}
+
+int countNameMatches(ports, name) {
+ var matches = 0;
+ for (var port in ports) {
+ if (port['debugName'] == name) {
+ matches++;
+ }
+ }
+ return matches;
+}
+
+final tests = <IsolateTest>[
+ (Isolate isolate) async {
+ dynamic result = await isolate.invokeRpcNoUpgrade('getPorts', {});
+ expect(result['type'], 'PortList');
+ expect(result['ports'], isList);
+ final ports = result['ports'];
+ // There are at least three ports: the three created in warm up that
+ // weren't closed. Some OSes will have other ports open but we do not try
+ // and test for these.
+ expect(ports.length, greaterThanOrEqualTo(3));
+ expect(countNameMatches(ports, 'port1'), 1);
+ expect(countNameMatches(ports, 'port3'), 0);
+ expect(countNameMatches(ports, 'port4'), 1);
+ expect(countNameMatches(ports, ''), greaterThanOrEqualTo(1));
+ },
+];
+
+main(args) async => runIsolateTests(args, tests, testeeBefore: warmup);
diff --git a/runtime/observatory/tests/service/get_version_rpc_test.dart b/runtime/observatory/tests/service/get_version_rpc_test.dart
index 8b56393..c8b0244 100644
--- a/runtime/observatory/tests/service/get_version_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_version_rpc_test.dart
@@ -9,12 +9,12 @@
var tests = <VMTest>[
(VM vm) async {
- var result = await vm.invokeRpcNoUpgrade('getVersion', {});
- expect(result['type'], equals('Version'));
- expect(result['major'], equals(3));
- expect(result['minor'], equals(40));
- expect(result['_privateMajor'], equals(0));
- expect(result['_privateMinor'], equals(0));
+ final result = await vm.invokeRpcNoUpgrade('getVersion', {});
+ expect(result['type'], 'Version');
+ expect(result['major'], 3);
+ expect(result['minor'], 41);
+ expect(result['_privateMajor'], 0);
+ expect(result['_privateMinor'], 0);
},
];
diff --git a/runtime/observatory_2/lib/src/models/objects/instance.dart b/runtime/observatory_2/lib/src/models/objects/instance.dart
index 66965e9..e52cdd7 100644
--- a/runtime/observatory_2/lib/src/models/objects/instance.dart
+++ b/runtime/observatory_2/lib/src/models/objects/instance.dart
@@ -120,6 +120,9 @@
/// An instance of the Dart class TypeRef.
typeRef,
+
+ /// An instance of the Dart class RawReceivePort
+ receivePort,
}
bool isTypedData(InstanceKind kind) {
diff --git a/runtime/observatory_2/lib/src/service/object.dart b/runtime/observatory_2/lib/src/service/object.dart
index 046513d..9b6ac2d 100644
--- a/runtime/observatory_2/lib/src/service/object.dart
+++ b/runtime/observatory_2/lib/src/service/object.dart
@@ -2790,6 +2790,8 @@
return M.InstanceKind.typeParameter;
case 'TypeRef':
return M.InstanceKind.typeRef;
+ case 'ReceivePort':
+ return M.InstanceKind.receivePort;
}
var message = 'Unrecognized instance kind: $s';
Logger.root.severe(message);
diff --git a/runtime/observatory_2/tests/service_2/get_ports_public_rpc_test.dart b/runtime/observatory_2/tests/service_2/get_ports_public_rpc_test.dart
new file mode 100644
index 0000000..179823f
--- /dev/null
+++ b/runtime/observatory_2/tests/service_2/get_ports_public_rpc_test.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:isolate' hide Isolate;
+import 'package:observatory_2/service_io.dart';
+import 'package:test/test.dart';
+
+import 'test_helper.dart';
+
+var port1;
+var port2;
+var port3;
+
+void warmup() {
+ port1 = RawReceivePort(null, 'port1');
+ port2 = RawReceivePort((_) {});
+ port3 = RawReceivePort((_) {}, 'port3');
+ port3.close();
+ RawReceivePort((_) {}, 'port4');
+}
+
+int countNameMatches(ports, name) {
+ var matches = 0;
+ for (var port in ports) {
+ if (port['debugName'] == name) {
+ matches++;
+ }
+ }
+ return matches;
+}
+
+final tests = <IsolateTest>[
+ (Isolate isolate) async {
+ dynamic result = await isolate.invokeRpcNoUpgrade('getPorts', {});
+ expect(result['type'], 'PortList');
+ expect(result['ports'], isList);
+ final ports = result['ports'];
+ // There are at least three ports: the three created in warm up that
+ // weren't closed. Some OSes will have other ports open but we do not try
+ // and test for these.
+ expect(ports.length, greaterThanOrEqualTo(3));
+ expect(countNameMatches(ports, 'port1'), 1);
+ expect(countNameMatches(ports, 'port3'), 0);
+ expect(countNameMatches(ports, 'port4'), 1);
+ expect(countNameMatches(ports, ''), greaterThanOrEqualTo(1));
+ },
+];
+
+main(args) async => runIsolateTests(args, tests, testeeBefore: warmup);
diff --git a/runtime/observatory_2/tests/service_2/get_version_rpc_test.dart b/runtime/observatory_2/tests/service_2/get_version_rpc_test.dart
index d5450e5..df37cb9 100644
--- a/runtime/observatory_2/tests/service_2/get_version_rpc_test.dart
+++ b/runtime/observatory_2/tests/service_2/get_version_rpc_test.dart
@@ -12,7 +12,7 @@
var result = await vm.invokeRpcNoUpgrade('getVersion', {});
expect(result['type'], equals('Version'));
expect(result['major'], equals(3));
- expect(result['minor'], equals(40));
+ expect(result['minor'], equals(41));
expect(result['_privateMajor'], equals(0));
expect(result['_privateMinor'], equals(0));
},
diff --git a/runtime/tests/vm/dart_2/splay_test.dart b/runtime/tests/vm/dart_2/splay_test.dart
index 824fe01..06a2951 100644
--- a/runtime/tests/vm/dart_2/splay_test.dart
+++ b/runtime/tests/vm/dart_2/splay_test.dart
@@ -9,6 +9,10 @@
// used for old nodes. Because of the way splay trees work, the engine
// also has to deal with a lot of changes to the large tree object
// graph.
+//
+// This file is copied into another directory and the default opt out scheme of
+// CFE using the pattern 'vm/dart_2' doesn't work, so opt it out explicitly.
+// @dart=2.9
// VMOptions=
// VMOptions=--no_concurrent_mark --no_concurrent_sweep
diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h
index b7ef75aa..8b15f7b 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -54,7 +54,7 @@
V(CapabilityImpl_factory, 1) \
V(CapabilityImpl_equals, 2) \
V(CapabilityImpl_get_hashcode, 1) \
- V(RawReceivePortImpl_factory, 1) \
+ V(RawReceivePortImpl_factory, 2) \
V(RawReceivePortImpl_get_id, 1) \
V(RawReceivePortImpl_get_sendport, 1) \
V(RawReceivePortImpl_closeInternal, 1) \
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index 3458a33..5930f2f 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -953,7 +953,7 @@
}
// Finalize function signatures and check for conflicts in super classes and
// interfaces.
- array = cls.functions();
+ array = cls.current_functions();
Function& function = Function::Handle(zone);
const intptr_t num_functions = array.Length();
for (intptr_t i = 0; i < num_functions; i++) {
@@ -1315,7 +1315,7 @@
}
}
THR_Print("\n");
- const Array& functions_array = Array::Handle(cls.functions());
+ const Array& functions_array = Array::Handle(cls.current_functions());
Function& function = Function::Handle();
intptr_t len = functions_array.Length();
for (intptr_t i = 0; i < len; i++) {
diff --git a/runtime/vm/compiler/aot/dispatch_table_generator.cc b/runtime/vm/compiler/aot/dispatch_table_generator.cc
index 073a227..415b1ef 100644
--- a/runtime/vm/compiler/aot/dispatch_table_generator.cc
+++ b/runtime/vm/compiler/aot/dispatch_table_generator.cc
@@ -445,7 +445,7 @@
obj = classes_->At(cid);
if (obj.IsClass()) {
klass = Class::RawCast(obj.raw());
- functions = klass.functions();
+ functions = klass.current_functions();
if (!functions.IsNull()) {
for (intptr_t j = 0; j < functions.Length(); j++) {
function ^= functions.At(j);
@@ -561,7 +561,7 @@
klass = Class::RawCast(obj.raw());
GrowableArray<Interval>& subclasss_cid_ranges = cid_subclass_ranges[cid];
- functions = klass.functions();
+ functions = klass.current_functions();
if (!functions.IsNull()) {
const int16_t depth = cid_depth[cid];
for (intptr_t j = 0; j < functions.Length(); j++) {
diff --git a/runtime/vm/compiler/aot/precompiler.cc b/runtime/vm/compiler/aot/precompiler.cc
index d1b5da2..f652626 100644
--- a/runtime/vm/compiler/aot/precompiler.cc
+++ b/runtime/vm/compiler/aot/precompiler.cc
@@ -1210,7 +1210,7 @@
}
// Check for @pragma on any functions in the class.
- members = cls.functions();
+ members = cls.current_functions();
for (intptr_t k = 0; k < members.Length(); k++) {
function ^= members.At(k);
if (function.has_pragma()) {
@@ -1292,7 +1292,7 @@
if (!cls.is_allocated()) continue;
- functions = cls.functions();
+ functions = cls.current_functions();
for (intptr_t k = 0; k < functions.Length(); k++) {
function ^= functions.At(k);
@@ -1459,7 +1459,7 @@
ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
while (it.HasNext()) {
cls = it.GetNextClass();
- functions = cls.functions();
+ functions = cls.current_functions();
const intptr_t length = functions.Length();
for (intptr_t j = 0; j < length; j++) {
@@ -1562,7 +1562,7 @@
ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
while (it.HasNext()) {
cls = it.GetNextClass();
- functions = cls.functions();
+ functions = cls.current_functions();
for (intptr_t j = 0; j < functions.Length(); j++) {
function ^= functions.At(j);
bool retain = possibly_retained_functions_.ContainsKey(function);
@@ -2068,7 +2068,7 @@
if (members.Length() > 0) {
retain = true;
}
- members = cls.functions();
+ members = cls.current_functions();
if (members.Length() > 0) {
retain = true;
}
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler.cc b/runtime/vm/compiler/backend/flow_graph_compiler.cc
index 2290612..b1e6deb 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler.cc
@@ -2038,7 +2038,7 @@
Class& cls = Class::Handle(zone, raw_class);
if (cls.IsNull()) return false;
if (!cls.is_finalized()) return false;
- if (Array::Handle(cls.functions()).IsNull()) return false;
+ if (Array::Handle(cls.current_functions()).IsNull()) return false;
if (class_is_abstract_return != NULL) {
*class_is_abstract_return = cls.is_abstract();
diff --git a/runtime/vm/compiler/cha.cc b/runtime/vm/compiler/cha.cc
index f50e651..b7160d3 100644
--- a/runtime/vm/compiler/cha.cc
+++ b/runtime/vm/compiler/cha.cc
@@ -135,6 +135,7 @@
return true;
}
+ SafepointReadRwLocker ml(thread_, thread_->isolate_group()->program_lock());
const GrowableObjectArray& cls_direct_subclasses =
GrowableObjectArray::Handle(thread_->zone(), cls.direct_subclasses());
if (cls_direct_subclasses.IsNull()) {
diff --git a/runtime/vm/compiler/frontend/kernel_fingerprints.cc b/runtime/vm/compiler/frontend/kernel_fingerprints.cc
index ed382e7..f42a953 100644
--- a/runtime/vm/compiler/frontend/kernel_fingerprints.cc
+++ b/runtime/vm/compiler/frontend/kernel_fingerprints.cc
@@ -798,7 +798,7 @@
String& name = String::Handle(zone, klass.Name());
const Array& fields = Array::Handle(zone, klass.fields());
- const Array& functions = Array::Handle(zone, klass.functions());
+ const Array& functions = Array::Handle(zone, klass.current_functions());
const Array& interfaces = Array::Handle(zone, klass.interfaces());
AbstractType& type = AbstractType::Handle(zone);
diff --git a/runtime/vm/compiler/jit/compiler.cc b/runtime/vm/compiler/jit/compiler.cc
index 72e16f6..2657e52 100644
--- a/runtime/vm/compiler/jit/compiler.cc
+++ b/runtime/vm/compiler/jit/compiler.cc
@@ -1006,7 +1006,9 @@
Thread* thread = Thread::Current();
Zone* zone = thread->zone();
Object& result = Object::Handle(zone);
- Array& functions = Array::Handle(zone, cls.functions());
+ // We don't expect functions() to change as the class was finalized.
+ ASSERT(cls.is_finalized());
+ Array& functions = Array::Handle(zone, cls.current_functions());
Function& func = Function::Handle(zone);
// Compile all the regular functions.
for (int i = 0; i < functions.Length(); i++) {
@@ -1030,7 +1032,7 @@
Zone* zone = thread->zone();
Error& error = Error::Handle(zone, cls.EnsureIsFinalized(thread));
ASSERT(error.IsNull());
- Array& functions = Array::Handle(zone, cls.functions());
+ Array& functions = Array::Handle(zone, cls.current_functions());
Function& func = Function::Handle(zone);
// Compile all the regular functions.
for (int i = 0; i < functions.Length(); i++) {
diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h
index bd58afd..e2196c5 100644
--- a/runtime/vm/compiler/runtime_offsets_extracted.h
+++ b/runtime/vm/compiler/runtime_offsets_extracted.h
@@ -504,7 +504,7 @@
static constexpr dart::compiler::target::word PatchClass_InstanceSize = 24;
static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 8;
static constexpr dart::compiler::target::word Pointer_InstanceSize = 12;
-static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 12;
+static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 20;
static constexpr dart::compiler::target::word RedirectionData_InstanceSize = 16;
static constexpr dart::compiler::target::word RegExp_InstanceSize = 60;
static constexpr dart::compiler::target::word Script_InstanceSize = 56;
@@ -1031,7 +1031,7 @@
static constexpr dart::compiler::target::word PatchClass_InstanceSize = 48;
static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 16;
static constexpr dart::compiler::target::word Pointer_InstanceSize = 24;
-static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 24;
+static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 40;
static constexpr dart::compiler::target::word RedirectionData_InstanceSize = 32;
static constexpr dart::compiler::target::word RegExp_InstanceSize = 120;
static constexpr dart::compiler::target::word Script_InstanceSize = 96;
@@ -1549,7 +1549,7 @@
static constexpr dart::compiler::target::word PatchClass_InstanceSize = 24;
static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 8;
static constexpr dart::compiler::target::word Pointer_InstanceSize = 12;
-static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 12;
+static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 20;
static constexpr dart::compiler::target::word RedirectionData_InstanceSize = 16;
static constexpr dart::compiler::target::word RegExp_InstanceSize = 60;
static constexpr dart::compiler::target::word Script_InstanceSize = 56;
@@ -2077,7 +2077,7 @@
static constexpr dart::compiler::target::word PatchClass_InstanceSize = 48;
static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 16;
static constexpr dart::compiler::target::word Pointer_InstanceSize = 24;
-static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 24;
+static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 40;
static constexpr dart::compiler::target::word RedirectionData_InstanceSize = 32;
static constexpr dart::compiler::target::word RegExp_InstanceSize = 120;
static constexpr dart::compiler::target::word Script_InstanceSize = 96;
@@ -2594,7 +2594,7 @@
static constexpr dart::compiler::target::word PatchClass_InstanceSize = 24;
static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 8;
static constexpr dart::compiler::target::word Pointer_InstanceSize = 12;
-static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 12;
+static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 20;
static constexpr dart::compiler::target::word RedirectionData_InstanceSize = 16;
static constexpr dart::compiler::target::word RegExp_InstanceSize = 60;
static constexpr dart::compiler::target::word Script_InstanceSize = 56;
@@ -3115,7 +3115,7 @@
static constexpr dart::compiler::target::word PatchClass_InstanceSize = 48;
static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 16;
static constexpr dart::compiler::target::word Pointer_InstanceSize = 24;
-static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 24;
+static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 40;
static constexpr dart::compiler::target::word RedirectionData_InstanceSize = 32;
static constexpr dart::compiler::target::word RegExp_InstanceSize = 120;
static constexpr dart::compiler::target::word Script_InstanceSize = 96;
@@ -3627,7 +3627,7 @@
static constexpr dart::compiler::target::word PatchClass_InstanceSize = 24;
static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 8;
static constexpr dart::compiler::target::word Pointer_InstanceSize = 12;
-static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 12;
+static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 20;
static constexpr dart::compiler::target::word RedirectionData_InstanceSize = 16;
static constexpr dart::compiler::target::word RegExp_InstanceSize = 60;
static constexpr dart::compiler::target::word Script_InstanceSize = 56;
@@ -4149,7 +4149,7 @@
static constexpr dart::compiler::target::word PatchClass_InstanceSize = 48;
static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 16;
static constexpr dart::compiler::target::word Pointer_InstanceSize = 24;
-static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 24;
+static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 40;
static constexpr dart::compiler::target::word RedirectionData_InstanceSize = 32;
static constexpr dart::compiler::target::word RegExp_InstanceSize = 120;
static constexpr dart::compiler::target::word Script_InstanceSize = 96;
@@ -4722,7 +4722,7 @@
static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 20;
static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 8;
static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 12;
-static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 12;
+static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 20;
static constexpr dart::compiler::target::word AOT_RedirectionData_InstanceSize =
16;
static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 60;
@@ -5303,7 +5303,7 @@
static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 40;
static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 16;
static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 24;
-static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 40;
static constexpr dart::compiler::target::word AOT_RedirectionData_InstanceSize =
32;
static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 120;
@@ -5888,7 +5888,7 @@
static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 40;
static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 16;
static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 24;
-static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 40;
static constexpr dart::compiler::target::word AOT_RedirectionData_InstanceSize =
32;
static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 120;
@@ -6461,7 +6461,7 @@
static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 20;
static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 8;
static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 12;
-static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 12;
+static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 20;
static constexpr dart::compiler::target::word AOT_RedirectionData_InstanceSize =
16;
static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 60;
@@ -7035,7 +7035,7 @@
static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 40;
static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 16;
static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 24;
-static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 40;
static constexpr dart::compiler::target::word AOT_RedirectionData_InstanceSize =
32;
static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 120;
@@ -7613,7 +7613,7 @@
static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 40;
static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 16;
static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 24;
-static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 24;
+static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 40;
static constexpr dart::compiler::target::word AOT_RedirectionData_InstanceSize =
32;
static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 120;
diff --git a/runtime/vm/dart_entry.cc b/runtime/vm/dart_entry.cc
index aec36e8..89f06a9 100644
--- a/runtime/vm/dart_entry.cc
+++ b/runtime/vm/dart_entry.cc
@@ -750,6 +750,31 @@
return result.raw();
}
+ObjectPtr DartLibraryCalls::LookupOpenPorts() {
+ Thread* thread = Thread::Current();
+ Zone* zone = thread->zone();
+ Function& function = Function::Handle(
+ zone, thread->isolate()->object_store()->lookup_open_ports());
+ const int kTypeArgsLen = 0;
+ const int kNumArguments = 0;
+ if (function.IsNull()) {
+ Library& isolate_lib = Library::Handle(zone, Library::IsolateLibrary());
+ ASSERT(!isolate_lib.IsNull());
+ const String& class_name = String::Handle(
+ zone, isolate_lib.PrivateName(Symbols::_RawReceivePortImpl()));
+ const String& function_name = String::Handle(
+ zone, isolate_lib.PrivateName(Symbols::_lookupOpenPorts()));
+ function = Resolver::ResolveStatic(isolate_lib, class_name, function_name,
+ kTypeArgsLen, kNumArguments,
+ Object::empty_array());
+ ASSERT(!function.IsNull());
+ thread->isolate()->object_store()->set_lookup_open_ports(function);
+ }
+ const Object& result = Object::Handle(
+ zone, DartEntry::InvokeFunction(function, Object::empty_array()));
+ return result.raw();
+}
+
ObjectPtr DartLibraryCalls::HandleMessage(const Object& handler,
const Instance& message) {
Thread* thread = Thread::Current();
diff --git a/runtime/vm/dart_entry.h b/runtime/vm/dart_entry.h
index 4f81b28..1527c11 100644
--- a/runtime/vm/dart_entry.h
+++ b/runtime/vm/dart_entry.h
@@ -284,6 +284,9 @@
// Returns the handler if one has been registered for this port id.
static ObjectPtr LookupHandler(Dart_Port port_id);
+ // Returns a list of open ReceivePorts.
+ static ObjectPtr LookupOpenPorts();
+
// Returns null on success, a RawError on failure.
static ObjectPtr HandleMessage(const Object& handler,
const Instance& dart_message);
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index ecbb6f9..feb43ae 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -3248,7 +3248,8 @@
TokenPosition end_pos,
GrowableObjectArray* bytecode_function_list,
GrowableObjectArray* code_function_list) {
- Zone* zone = Thread::Current()->zone();
+ Thread* thread = Thread::Current();
+ Zone* zone = thread->zone();
Class& cls = Class::Handle(zone);
Array& functions = Array::Handle(zone);
GrowableObjectArray& closures = GrowableObjectArray::Handle(zone);
@@ -3302,7 +3303,7 @@
// Note: we need to check the functions of this class even if
// the class is defined in a different 'script'. There could
// be mixin functions from the given script in this class.
- functions = cls.functions();
+ functions = cls.current_functions();
if (!functions.IsNull()) {
const intptr_t num_functions = functions.Length();
for (intptr_t pos = 0; pos < num_functions; pos++) {
@@ -3441,7 +3442,7 @@
// is no longjump base on the stack.
continue;
}
- functions = cls.functions();
+ functions = cls.current_functions();
if (!functions.IsNull()) {
const intptr_t num_functions = functions.Length();
for (intptr_t pos = 0; pos < num_functions; pos++) {
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 3f7e002..03f4c83 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -2395,8 +2395,9 @@
args.SetAt(2, Instance::Handle(state->BuildArgs(thread)));
args.SetAt(3, Instance::Handle(state->BuildMessage(thread)));
args.SetAt(4, is_spawn_uri ? Bool::True() : Bool::False());
- args.SetAt(5, ReceivePort::Handle(ReceivePort::New(
- isolate->main_port(), true /* control port */)));
+ args.SetAt(5, ReceivePort::Handle(
+ ReceivePort::New(isolate->main_port(), String::Handle(),
+ true /* control port */)));
args.SetAt(6, capabilities);
const Library& lib = Library::Handle(Library::IsolateLibrary());
diff --git a/runtime/vm/kernel.cc b/runtime/vm/kernel.cc
index 19070a4..7dc1096 100644
--- a/runtime/vm/kernel.cc
+++ b/runtime/vm/kernel.cc
@@ -369,7 +369,7 @@
&token_positions);
}
}
- temp_array = klass.functions();
+ temp_array = klass.current_functions();
for (intptr_t i = 0; i < temp_array.Length(); ++i) {
temp_function ^= temp_array.At(i);
entry_script = temp_function.script();
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index eaf97ca..4b878a8 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -7,6 +7,7 @@
#include <memory>
#include "include/dart_api.h"
+#include "lib/stacktrace.h"
#include "platform/assert.h"
#include "platform/text_buffer.h"
#include "platform/unaligned.h"
@@ -3053,7 +3054,7 @@
}
FunctionPtr Class::FunctionFromIndex(intptr_t idx) const {
- const Array& funcs = Array::Handle(functions());
+ const Array& funcs = Array::Handle(current_functions());
if ((idx < 0) || (idx >= funcs.Length())) {
return Function::null();
}
@@ -3064,7 +3065,7 @@
}
FunctionPtr Class::ImplicitClosureFunctionFromIndex(intptr_t idx) const {
- const Array& funcs = Array::Handle(functions());
+ const Array& funcs = Array::Handle(current_functions());
if ((idx < 0) || (idx >= funcs.Length())) {
return Function::null();
}
@@ -3089,7 +3090,7 @@
REUSABLE_FUNCTION_HANDLESCOPE(thread);
Array& funcs = thread->ArrayHandle();
Function& function = thread->FunctionHandle();
- funcs = functions();
+ funcs = current_functions();
ASSERT(!funcs.IsNull());
Function& implicit_closure = Function::Handle(thread->zone());
const intptr_t len = funcs.Length();
@@ -3694,8 +3695,8 @@
return Function::null();
}
IsolateGroup* group = thread->isolate_group();
- Function& result =
- Function::Handle(owner.LookupDynamicFunctionUnsafe(getter_name));
+ Function& result = Function::Handle(
+ Resolver::ResolveDynamicFunction(thread->zone(), owner, getter_name));
if (result.IsNull()) {
SafepointWriteRwLocker ml(thread, group->program_lock());
result = owner.LookupDynamicFunctionUnsafe(getter_name);
@@ -5347,7 +5348,7 @@
}
FunctionPtr Class::LookupDynamicFunctionUnsafe(const String& name) const {
- return LookupFunctionUnsafe(name, kInstance);
+ return LookupFunctionReadLocked(name, kInstance);
}
FunctionPtr Class::LookupDynamicFunctionAllowPrivate(const String& name) const {
@@ -5355,7 +5356,9 @@
}
FunctionPtr Class::LookupStaticFunction(const String& name) const {
- return LookupFunctionUnsafe(name, kStatic);
+ Thread* thread = Thread::Current();
+ SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
+ return LookupFunctionReadLocked(name, kStatic);
}
FunctionPtr Class::LookupStaticFunctionAllowPrivate(const String& name) const {
@@ -5363,7 +5366,9 @@
}
FunctionPtr Class::LookupConstructor(const String& name) const {
- return LookupFunctionUnsafe(name, kConstructor);
+ Thread* thread = Thread::Current();
+ SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
+ return LookupFunctionReadLocked(name, kConstructor);
}
FunctionPtr Class::LookupConstructorAllowPrivate(const String& name) const {
@@ -5371,7 +5376,9 @@
}
FunctionPtr Class::LookupFactory(const String& name) const {
- return LookupFunctionUnsafe(name, kFactory);
+ Thread* thread = Thread::Current();
+ SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
+ return LookupFunctionReadLocked(name, kFactory);
}
FunctionPtr Class::LookupFactoryAllowPrivate(const String& name) const {
@@ -5382,8 +5389,8 @@
return LookupFunctionAllowPrivate(name, kAny);
}
-FunctionPtr Class::LookupFunctionUnsafe(const String& name) const {
- return LookupFunctionUnsafe(name, kAny);
+FunctionPtr Class::LookupFunctionReadLocked(const String& name) const {
+ return LookupFunctionReadLocked(name, kAny);
}
// Returns true if 'prefix' and 'accessor_name' match 'name'.
@@ -5435,11 +5442,16 @@
return Function::null();
}
-FunctionPtr Class::LookupFunctionUnsafe(const String& name,
- MemberKind kind) const {
+FunctionPtr Class::LookupFunctionReadLocked(const String& name,
+ MemberKind kind) const {
ASSERT(!IsNull());
Thread* thread = Thread::Current();
RELEASE_ASSERT(is_finalized());
+ // Caller needs to ensure they grab program_lock because this method
+ // can be invoked with either ReadRwLock or WriteRwLock.
+#if defined(DEBUG)
+ ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadReader());
+#endif
REUSABLE_ARRAY_HANDLESCOPE(thread);
REUSABLE_FUNCTION_HANDLESCOPE(thread);
Array& funcs = thread->ArrayHandle();
@@ -5448,7 +5460,10 @@
const intptr_t len = funcs.Length();
Function& function = thread->FunctionHandle();
if (len >= kFunctionLookupHashTreshold) {
- // Cache functions hash table to allow multi threaded access.
+ // TODO(dartbug.com/36097): We require currently a read lock in the resolver
+ // to avoid read-write race access to this hash table.
+ // If we want to increase resolver speed by avoiding the need for read lock,
+ // we could make change this hash table to be lock-free for the reader.
const Array& hash_table =
Array::Handle(thread->zone(), raw_ptr()->functions_hash_table_);
if (!hash_table.IsNull()) {
@@ -5494,7 +5509,7 @@
REUSABLE_FUNCTION_HANDLESCOPE(thread);
REUSABLE_STRING_HANDLESCOPE(thread);
Array& funcs = thread->ArrayHandle();
- funcs = functions();
+ funcs = current_functions();
ASSERT(!funcs.IsNull());
const intptr_t len = funcs.Length();
Function& function = thread->FunctionHandle();
@@ -5530,7 +5545,7 @@
REUSABLE_FUNCTION_HANDLESCOPE(thread);
REUSABLE_STRING_HANDLESCOPE(thread);
Array& funcs = thread->ArrayHandle();
- funcs = functions();
+ funcs = current_functions();
intptr_t len = funcs.Length();
Function& function = thread->FunctionHandle();
String& function_name = thread->StringHandle();
@@ -12482,7 +12497,7 @@
// are not included above, but can be referenced through a library's
// anonymous classes. Example: dart-core:identical.dart.
Function& func = Function::Handle();
- Array& functions = Array::Handle(cls.functions());
+ Array& functions = Array::Handle(cls.current_functions());
for (intptr_t j = 0; j < functions.Length(); j++) {
func ^= functions.At(j);
if (func.is_external()) {
@@ -24343,6 +24358,7 @@
}
ReceivePortPtr ReceivePort::New(Dart_Port id,
+ const String& debug_name,
bool is_control_port,
Heap::Space space) {
ASSERT(id != ILLEGAL_PORT);
@@ -24350,6 +24366,8 @@
Zone* zone = thread->zone();
const SendPort& send_port =
SendPort::Handle(zone, SendPort::New(id, thread->isolate()->origin_id()));
+ const StackTrace& allocation_location_ =
+ HasStack() ? GetCurrentStackTrace(0) : StackTrace::Handle();
ReceivePort& result = ReceivePort::Handle(zone);
{
@@ -24358,6 +24376,9 @@
NoSafepointScope no_safepoint;
result ^= raw;
result.StorePointer(&result.raw_ptr()->send_port_, send_port.raw());
+ result.StorePointer(&result.raw_ptr()->debug_name_, debug_name.raw());
+ result.StorePointer(&result.raw_ptr()->allocation_location_,
+ allocation_location_.raw());
}
if (is_control_port) {
PortMap::SetPortState(id, PortMap::kControlPort);
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 01d448d..aa9b52e 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -1298,18 +1298,23 @@
// Returns true if non-static fields are defined.
bool HasInstanceFields() const;
- ArrayPtr functions() const {
+ ArrayPtr current_functions() const {
// We rely on the fact that any loads from the array are dependent loads
// and avoid the load-acquire barrier here.
return raw_ptr()->functions_;
}
+ ArrayPtr functions() const {
+ DEBUG_ASSERT(
+ IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
+ return current_functions();
+ }
void SetFunctions(const Array& value) const;
void AddFunction(const Function& function) const;
FunctionPtr FunctionFromIndex(intptr_t idx) const;
intptr_t FindImplicitClosureFunctionIndex(const Function& needle) const;
FunctionPtr ImplicitClosureFunctionFromIndex(intptr_t idx) const;
- FunctionPtr LookupFunctionUnsafe(const String& name) const;
+ FunctionPtr LookupFunctionReadLocked(const String& name) const;
FunctionPtr LookupDynamicFunctionUnsafe(const String& name) const;
FunctionPtr LookupDynamicFunctionAllowPrivate(const String& name) const;
@@ -1761,7 +1766,8 @@
void InitEmptyFields();
static FunctionPtr CheckFunctionType(const Function& func, MemberKind kind);
- FunctionPtr LookupFunctionUnsafe(const String& name, MemberKind kind) const;
+ FunctionPtr LookupFunctionReadLocked(const String& name,
+ MemberKind kind) const;
FunctionPtr LookupFunctionAllowPrivate(const String& name,
MemberKind kind) const;
FieldPtr LookupField(const String& name, MemberKind kind) const;
@@ -10980,10 +10986,17 @@
InstancePtr handler() const { return raw_ptr()->handler_; }
void set_handler(const Instance& value) const;
+ StackTracePtr allocation_location() const {
+ return raw_ptr()->allocation_location_;
+ }
+
+ StringPtr debug_name() const { return raw_ptr()->debug_name_; }
+
static intptr_t InstanceSize() {
return RoundedAllocationSize(sizeof(ReceivePortLayout));
}
static ReceivePortPtr New(Dart_Port id,
+ const String& debug_name,
bool is_control_port,
Heap::Space space = Heap::kNew);
diff --git a/runtime/vm/object_reload.cc b/runtime/vm/object_reload.cc
index 4d33fbc..866ae6c 100644
--- a/runtime/vm/object_reload.cc
+++ b/runtime/vm/object_reload.cc
@@ -498,7 +498,7 @@
patch.set_library_kernel_offset(lib.kernel_offset());
}
- const Array& funcs = Array::Handle(functions());
+ const Array& funcs = Array::Handle(current_functions());
Function& func = Function::Handle();
Object& owner = Object::Handle();
for (intptr_t i = 0; i < funcs.Length(); i++) {
@@ -537,7 +537,7 @@
void Class::MigrateImplicitStaticClosures(IsolateReloadContext* irc,
const Class& new_cls) const {
- const Array& funcs = Array::Handle(functions());
+ const Array& funcs = Array::Handle(current_functions());
Thread* thread = Thread::Current();
Function& old_func = Function::Handle();
String& selector = String::Handle();
diff --git a/runtime/vm/object_service.cc b/runtime/vm/object_service.cc
index fe34f62..0af790b 100644
--- a/runtime/vm/object_service.cc
+++ b/runtime/vm/object_service.cc
@@ -142,7 +142,7 @@
}
{
JSONArray functions_array(&jsobj, "functions");
- const Array& function_array = Array::Handle(functions());
+ const Array& function_array = Array::Handle(current_functions());
Function& function = Function::Handle();
if (!function_array.IsNull()) {
for (intptr_t i = 0; i < function_array.Length(); i++) {
@@ -1557,7 +1557,15 @@
}
void ReceivePort::PrintJSONImpl(JSONStream* stream, bool ref) const {
- Instance::PrintJSONImpl(stream, ref);
+ JSONObject obj(stream);
+ Instance::PrintSharedInstanceJSON(&obj, ref);
+ const StackTrace& allocation_location_ =
+ StackTrace::Handle(allocation_location());
+ const String& debug_name_ = String::Handle(debug_name());
+ obj.AddProperty("kind", "ReceivePort");
+ obj.AddProperty64("portId", Id());
+ obj.AddProperty("debugName", debug_name_.ToCString());
+ obj.AddProperty("allocationLocation", allocation_location_);
}
void SendPort::PrintJSONImpl(JSONStream* stream, bool ref) const {
diff --git a/runtime/vm/object_store.cc b/runtime/vm/object_store.cc
index 3bdec6c7..fb463b3 100644
--- a/runtime/vm/object_store.cc
+++ b/runtime/vm/object_store.cc
@@ -259,7 +259,7 @@
if (FLAG_async_debugger) {
// Disable debugging and inlining of all functions on the
// _AsyncStarStreamController class.
- const Array& functions = Array::Handle(zone, cls.functions());
+ const Array& functions = Array::Handle(zone, cls.current_functions());
for (intptr_t i = 0; i < functions.Length(); i++) {
function ^= functions.At(i);
if (function.IsNull()) {
diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h
index f436b1a..fe789af 100644
--- a/runtime/vm/object_store.h
+++ b/runtime/vm/object_store.h
@@ -160,6 +160,7 @@
RW(Instance, stack_overflow) \
RW(Instance, out_of_memory) \
RW(Function, lookup_port_handler) \
+ RW(Function, lookup_open_ports) \
RW(Function, handle_message_function) \
RW(Function, growable_list_factory) \
RW(Function, simple_instance_of_function) \
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index 5cab797..4d4ba5b 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -52,7 +52,7 @@
// Class has no fields and no functions yet.
EXPECT_EQ(Array::Handle(cls.fields()).Length(), 0);
- EXPECT_EQ(Array::Handle(cls.functions()).Length(), 0);
+ EXPECT_EQ(Array::Handle(cls.current_functions()).Length(), 0);
// Setup the interfaces in the class.
// Normally the class finalizer is resolving super types and interfaces
@@ -306,7 +306,7 @@
// EmptyClass has no fields and no functions.
EXPECT_EQ(Array::Handle(empty_class.fields()).Length(), 0);
- EXPECT_EQ(Array::Handle(empty_class.functions()).Length(), 0);
+ EXPECT_EQ(Array::Handle(empty_class.current_functions()).Length(), 0);
ClassFinalizer::FinalizeTypesInClass(empty_class);
empty_class.Finalize();
@@ -321,7 +321,7 @@
// No fields, functions, or super type for the OneFieldClass.
EXPECT_EQ(Array::Handle(empty_class.fields()).Length(), 0);
- EXPECT_EQ(Array::Handle(empty_class.functions()).Length(), 0);
+ EXPECT_EQ(Array::Handle(empty_class.current_functions()).Length(), 0);
EXPECT_EQ(empty_class.super_type(), AbstractType::null());
ClassFinalizer::FinalizeTypesInClass(one_field_class);
@@ -4086,7 +4086,7 @@
array = cls.fields();
EXPECT(!array.IsNull());
EXPECT(array.IsArray());
- array = cls.functions();
+ array = cls.current_functions();
EXPECT(!array.IsNull());
EXPECT(array.IsArray());
@@ -4094,7 +4094,7 @@
array = cls.fields();
EXPECT(!array.IsNull());
EXPECT(array.IsArray());
- array = cls.functions();
+ array = cls.current_functions();
EXPECT(!array.IsNull());
EXPECT(array.IsArray());
@@ -4102,7 +4102,7 @@
array = cls.fields();
EXPECT(!array.IsNull());
EXPECT(array.IsArray());
- array = cls.functions();
+ array = cls.current_functions();
EXPECT(!array.IsNull());
EXPECT(array.IsArray());
}
diff --git a/runtime/vm/program_visitor.cc b/runtime/vm/program_visitor.cc
index 483ce9b..a0917e3 100644
--- a/runtime/vm/program_visitor.cc
+++ b/runtime/vm/program_visitor.cc
@@ -128,7 +128,7 @@
if (!visitor_->IsFunctionVisitor()) return;
- class_functions_ = cls.functions();
+ class_functions_ = cls.current_functions();
for (intptr_t j = 0; j < class_functions_.Length(); j++) {
class_function_ ^= class_functions_.At(j);
AddToWorklist(class_function_);
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 00f4860..21a02e7 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -2788,7 +2788,9 @@
VISIT_FROM(ObjectPtr, send_port_)
SendPortPtr send_port_;
InstancePtr handler_;
- VISIT_TO(ObjectPtr, handler_)
+ StringPtr debug_name_;
+ StackTracePtr allocation_location_;
+ VISIT_TO(ObjectPtr, allocation_location_)
};
class TransferableTypedDataLayout : public InstanceLayout {
diff --git a/runtime/vm/raw_object_fields.cc b/runtime/vm/raw_object_fields.cc
index 8b6b184..6a6bc68 100644
--- a/runtime/vm/raw_object_fields.cc
+++ b/runtime/vm/raw_object_fields.cc
@@ -182,6 +182,8 @@
F(ExternalTypedData, length_) \
F(ReceivePort, send_port_) \
F(ReceivePort, handler_) \
+ F(ReceivePort, debug_name_) \
+ F(ReceivePort, allocation_location_) \
F(StackTrace, async_link_) \
F(StackTrace, code_array_) \
F(StackTrace, pc_offset_array_) \
diff --git a/runtime/vm/resolver.cc b/runtime/vm/resolver.cc
index cdf4fac..a361c5a5 100644
--- a/runtime/vm/resolver.cc
+++ b/runtime/vm/resolver.cc
@@ -57,6 +57,7 @@
const bool is_dyn_call = demangled.raw() != function_name.raw();
+ Thread* thread = Thread::Current();
bool need_to_create_method_extractor = false;
while (!cls.IsNull()) {
if (is_dyn_call) {
@@ -68,7 +69,11 @@
}
if (!function.IsNull()) return function.raw();
- function = lookup(cls, demangled);
+ ASSERT(cls.is_finalized());
+ {
+ SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
+ function = lookup(cls, demangled);
+ }
#if !defined(DART_PRECOMPILED_RUNTIME)
// In JIT we might need to lazily create a dyn:* forwarder.
if (is_dyn_call && !function.IsNull()) {
@@ -80,6 +85,7 @@
// Getter invocation might actually be a method extraction.
if (is_getter) {
+ SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
function = lookup(cls, demangled_getter_name);
if (!function.IsNull()) {
if (allow_add && FLAG_lazy_dispatchers) {
@@ -159,7 +165,7 @@
return ResolveDynamicAnyArgsWithCustomLookup(
zone, receiver_class, function_name, /*allow_add=*/false,
std::mem_fn(static_cast<FunctionPtr (Class::*)(const String&) const>(
- &Class::LookupFunctionUnsafe)));
+ &Class::LookupFunctionReadLocked)));
}
FunctionPtr Resolver::ResolveDynamicFunction(Zone* zone,
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 3a89d30..db9f85b 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -3146,6 +3146,30 @@
return true;
}
+static const MethodParameter* get_ports_params[] = {
+ RUNNABLE_ISOLATE_PARAMETER,
+ NULL,
+};
+
+static bool GetPorts(Thread* thread, JSONStream* js) {
+ // Ensure the array and handles created below are promptly destroyed.
+ StackZone zone(thread);
+ HANDLESCOPE(thread);
+ const GrowableObjectArray& ports = GrowableObjectArray::Handle(
+ GrowableObjectArray::RawCast(DartLibraryCalls::LookupOpenPorts()));
+ JSONObject jsobj(js);
+ jsobj.AddProperty("type", "PortList");
+ {
+ Instance& port = Instance::Handle(zone.GetZone());
+ JSONArray arr(&jsobj, "ports");
+ for (int i = 0; i < ports.Length(); ++i) {
+ port ^= ports.At(i);
+ arr.AddValue(port);
+ }
+ }
+ return true;
+}
+
#if !defined(DART_PRECOMPILED_RUNTIME)
static const char* const report_enum_names[] = {
SourceReport::kCallSitesStr,
@@ -4393,12 +4417,12 @@
return true;
}
-static const MethodParameter* get_ports_params[] = {
+static const MethodParameter* get_ports_private_params[] = {
RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
-static bool GetPorts(Thread* thread, JSONStream* js) {
+static bool GetPortsPrivate(Thread* thread, JSONStream* js) {
MessageHandler* message_handler = thread->isolate()->message_handler();
PortMap::PrintPortsForMessageHandler(message_handler, js);
return true;
@@ -5058,6 +5082,8 @@
get_inbound_references_params },
{ "getInstances", GetInstances,
get_instances_params },
+ { "getPorts", GetPorts,
+ get_ports_params },
{ "getIsolate", GetIsolate,
get_isolate_params },
{ "_getIsolateObjectStore", GetIsolateObjectStore,
@@ -5078,8 +5104,8 @@
get_object_store_params },
{ "_getPersistentHandles", GetPersistentHandles,
get_persistent_handles_params, },
- { "_getPorts", GetPorts,
- get_ports_params },
+ { "_getPorts", GetPortsPrivate,
+ get_ports_private_params },
{ "getProcessMemoryUsage", GetProcessMemoryUsage,
get_process_memory_usage_params },
{ "_getReachableSize", GetReachableSize,
diff --git a/runtime/vm/service.h b/runtime/vm/service.h
index bf1d99b..9d09af1 100644
--- a/runtime/vm/service.h
+++ b/runtime/vm/service.h
@@ -15,7 +15,7 @@
namespace dart {
#define SERVICE_PROTOCOL_MAJOR_VERSION 3
-#define SERVICE_PROTOCOL_MINOR_VERSION 40
+#define SERVICE_PROTOCOL_MINOR_VERSION 41
class Array;
class EmbedderServiceHandler;
diff --git a/runtime/vm/service/service.md b/runtime/vm/service/service.md
index b8d0906..6fe2fb8 100644
--- a/runtime/vm/service/service.md
+++ b/runtime/vm/service/service.md
@@ -1,8 +1,8 @@
-# Dart VM Service Protocol 3.40
+# Dart VM Service Protocol 3.41
> Please post feedback to the [observatory-discuss group][discuss-list]
-This document describes of _version 3.40_ of the Dart VM Service Protocol. This
+This document describes of _version 3.41_ of the Dart VM Service Protocol. This
protocol is used to communicate with a running Dart Virtual Machine.
To use the Service Protocol, start the VM with the *--observe* flag.
@@ -47,6 +47,7 @@
- [getIsolateGroup](#getisolategroup)
- [getMemoryUsage](#getmemoryusage)
- [getObject](#getobject)
+ - [getPorts](#getports)
- [getProcessMemoryUsage](#getprocessmemoryusage)
- [getRetainingPath](#getretainingpath)
- [getScripts](#getscripts)
@@ -113,6 +114,7 @@
- [NativeFunction](#nativefunction)
- [Null](#null)
- [Object](#object)
+ - [PortList](#portlist)
- [ReloadReport](#reloadreport)
- [Response](#response)
- [RetainingObject](#retainingobject)
@@ -936,6 +938,17 @@
Float32x4List, and Float64x2List. These parameters are otherwise
ignored.
+### getPorts
+
+```
+PortList getPorts(string isolateId)
+```
+
+The _getPorts_ RPC is used to retrieve the list of `ReceivePort` instances for a
+given isolate.
+
+See [PortList](#portlist).
+
### getRetainingPath
```
@@ -2426,6 +2439,24 @@
// Provided for instance kinds:
// Closure
@Context closureContext [optional];
+
+ // The port ID for a ReceivePort.
+ //
+ // Provided for instance kinds:
+ // ReceivePort
+ int portId [optional];
+
+ // The stack trace associated with the allocation of a ReceivePort.
+ //
+ // Provided for instance kinds:
+ // ReceivePort
+ @Instance allocationLocation [optional];
+
+ // A name associated with a ReceivePort used for debugging purposes.
+ //
+ // Provided for instance kinds:
+ // ReceivePort
+ string debugName [optional];
}
```
@@ -2446,6 +2477,7 @@
// Double (suitable for passing to Double.parse())
// Int (suitable for passing to int.parse())
// String (value may be truncated)
+ // StackTrace
string valueAsString [optional];
// The valueAsString for String references may be truncated. If so,
@@ -2658,6 +2690,24 @@
// BoundedType
// TypeParameter
@Instance bound [optional];
+
+ // The port ID for a ReceivePort.
+ //
+ // Provided for instance kinds:
+ // ReceivePort
+ int portId [optional];
+
+ // The stack trace associated with the allocation of a ReceivePort.
+ //
+ // Provided for instance kinds:
+ // ReceivePort
+ @Instance allocationLocation [optional];
+
+ // A name associated with a ReceivePort used for debugging purposes.
+ //
+ // Provided for instance kinds:
+ // ReceivePort
+ string debugName [optional];
}
```
@@ -2742,6 +2792,9 @@
// An instance of the Dart class BoundedType.
BoundedType,
+
+ // An instance of the Dart class ReceivePort.
+ ReceivePort,
}
```
@@ -3184,6 +3237,18 @@
An _Object_ is a persistent object that is owned by some isolate.
+### PortList
+
+```
+class PortList extends Response {
+ @Instance[] ports;
+}
+```
+
+A _PortList_ contains a list of ports associated with some isolate.
+
+See [getPort](#getPort).
+
### ProfileFunction
```
@@ -3855,5 +3920,6 @@
3.38 | Added `isSystemIsolate` property to `@Isolate` and `Isolate`, `isSystemIsolateGroup` property to `@IsolateGroup` and `IsolateGroup`, and properties `systemIsolates` and `systemIsolateGroups` to `VM`.
3.39 | Removed the following deprecated RPCs and objects: `getClientName`, `getWebSocketTarget`, `setClientName`, `requireResumeApproval`, `ClientName`, and `WebSocketTarget`.
3.40 | Added `IsolateFlag` object and `isolateFlags` property to `Isolate`.
+3.41 | Added `PortList` object, `ReceivePort` `InstanceKind`, and `getPorts` RPC.
[discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observatory-discuss
diff --git a/runtime/vm/service/service_extension.md b/runtime/vm/service/service_extension.md
index 9f806c3..e5cc8ea 100644
--- a/runtime/vm/service/service_extension.md
+++ b/runtime/vm/service/service_extension.md
@@ -216,11 +216,13 @@
### HttpTimelineLoggingState
```
-class HttpTimelineLoggingState extends State {
+class HttpTimelineLoggingState extends Response {
+ // Whether Http timeline logging is enabled.
+ bool enabled;
}
```
-See [httpEnableTimelineLogging](#httpenabletimelinelogging) and [State](#state).
+See [httpEnableTimelineLogging](#httpenabletimelinelogging).
### OpenFileList
@@ -234,11 +236,13 @@
### SocketProfilingState
```
-class SocketProfilingState extends State {
+class SocketProfilingState extends Response {
+ // Whether socket profiling is enabled.
+ bool enabled;
}
```
-See [socketProfilingEnabled](#socketProfilingEnabled) and [State](#state)
+See [socketProfilingEnabled](#socketProfilingEnabled).
### SpawnedProcess
@@ -358,16 +362,6 @@
The _Success_ type is used to indicate that an operation completed successfully.
-### State
-
-```
-class State extends Response {
- bool enabled;
-}
-```
-
-The _State_ type is used to represent a response to a state request.
-
### Version
```
diff --git a/runtime/vm/source_report.cc b/runtime/vm/source_report.cc
index 4f5dcec..ba45ab6 100644
--- a/runtime/vm/source_report.cc
+++ b/runtime/vm/source_report.cc
@@ -568,7 +568,7 @@
}
}
- functions = cls.functions();
+ functions = cls.current_functions();
for (int i = 0; i < functions.Length(); i++) {
func ^= functions.At(i);
// Skip getter functions of static const field.
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index ba7cc2c..55b1ba1 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -449,6 +449,7 @@
V(_handleMessage, "_handleMessage") \
V(_instanceOf, "_instanceOf") \
V(_lookupHandler, "_lookupHandler") \
+ V(_lookupOpenPorts, "_lookupOpenPorts") \
V(_name, "_name") \
V(_onData, "_onData") \
V(_rehashObjects, "_rehashObjects") \
diff --git a/sdk/lib/_internal/vm/lib/isolate_patch.dart b/sdk/lib/_internal/vm/lib/isolate_patch.dart
index 91a567d..8f8b02c 100644
--- a/sdk/lib/_internal/vm/lib/isolate_patch.dart
+++ b/sdk/lib/_internal/vm/lib/isolate_patch.dart
@@ -22,7 +22,8 @@
@patch
class ReceivePort {
@patch
- factory ReceivePort() => new _ReceivePortImpl();
+ factory ReceivePort([String debugName = '']) =>
+ new _ReceivePortImpl(debugName);
@patch
factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) {
@@ -62,15 +63,16 @@
* event is received.
*/
@patch
- factory RawReceivePort([Function? handler]) {
- _RawReceivePortImpl result = new _RawReceivePortImpl();
+ factory RawReceivePort([Function? handler, String debugName = '']) {
+ _RawReceivePortImpl result = new _RawReceivePortImpl(debugName);
result.handler = handler;
return result;
}
}
class _ReceivePortImpl extends Stream implements ReceivePort {
- _ReceivePortImpl() : this.fromRawReceivePort(new RawReceivePort());
+ _ReceivePortImpl([String debugName = ''])
+ : this.fromRawReceivePort(new RawReceivePort(null, debugName));
_ReceivePortImpl.fromRawReceivePort(this._rawPort)
: _controller = new StreamController(sync: true) {
@@ -128,11 +130,21 @@
@pragma("vm:entry-point")
class _RawReceivePortImpl implements RawReceivePort {
- factory _RawReceivePortImpl() native "RawReceivePortImpl_factory";
+ factory _RawReceivePortImpl(String debugName) {
+ final port = _RawReceivePortImpl._(debugName);
+ _portMap[port._get_id()] = {
+ 'port': port,
+ 'handler': null,
+ };
+ return port;
+ }
+
+ factory _RawReceivePortImpl._(String debugName)
+ native "RawReceivePortImpl_factory";
close() {
// Close the port and remove it from the handler map.
- _handlerMap.remove(this._closeInternal());
+ _portMap.remove(this._closeInternal());
}
SendPort get sendPort {
@@ -155,10 +167,15 @@
// Called from the VM to retrieve the handler for a message.
@pragma("vm:entry-point", "call")
static _lookupHandler(int id) {
- var result = _handlerMap[id];
+ var result = _portMap[id]?['handler'];
return result;
}
+ @pragma("vm:entry-point", "call")
+ static _lookupOpenPorts() {
+ return _portMap.values.map((e) => e['port']).toList();
+ }
+
// Called from the VM to dispatch to the handler.
@pragma("vm:entry-point", "call")
static void _handleMessage(Function handler, var message) {
@@ -173,22 +190,18 @@
_closeInternal() native "RawReceivePortImpl_closeInternal";
void set handler(Function? value) {
- _handlerMap[this._get_id()] = value;
+ final id = this._get_id();
+ if (!_portMap.containsKey(id)) {
+ _portMap[id] = {
+ 'port': this,
+ 'handler': value,
+ };
+ } else {
+ _portMap[id]!['handler'] = value;
+ }
}
- // TODO(iposva): Ideally keep this map in the VM.
- // id to handler mapping.
- static _initHandlerMap() {
- // TODO(18511): Workaround bad CheckSmi hoisting.
- var tempMap = new HashMap();
- // Collect feedback that not all keys are Smis.
- tempMap["."] = 1;
- tempMap["."] = 2;
-
- return new HashMap();
- }
-
- static final Map _handlerMap = _initHandlerMap();
+ static final _portMap = <dynamic, Map<String, dynamic>>{};
}
@pragma("vm:entry-point")
diff --git a/sdk/lib/isolate/isolate.dart b/sdk/lib/isolate/isolate.dart
index 0c5747e..b7650dd 100644
--- a/sdk/lib/isolate/isolate.dart
+++ b/sdk/lib/isolate/isolate.dart
@@ -671,9 +671,12 @@
* receive messages. See [Stream.asBroadcastStream] for transforming the port
* to a broadcast stream.
*
+ * The optional `debugName` parameter can be set to associate a name with
+ * this port that can be displayed in tooling.
+ *
* A receive port is closed by canceling its subscription.
*/
- external factory ReceivePort();
+ external factory ReceivePort([String debugName = '']);
/**
* Creates a [ReceivePort] from a [RawReceivePort].
@@ -718,8 +721,12 @@
* A [RawReceivePort] is low level and does not work with [Zone]s. It
* can not be paused. The data-handler must be set before the first
* event is received.
+ *
+ * The optional `debugName` parameter can be set to associate a name with
+ * this port that can be displayed in tooling.
+ *
*/
- external factory RawReceivePort([Function? handler]);
+ external factory RawReceivePort([Function? handler, String debugName = '']);
/**
* Sets the handler that is invoked for every incoming message.
diff --git a/tools/VERSION b/tools/VERSION
index 3ad189b..fb8bbdd 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 11
PATCH 0
-PRERELEASE 269
+PRERELEASE 270
PRERELEASE_PATCH 0
\ No newline at end of file