Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1717)

Unified Diff: pkg/analyzer/test/generated/simple_resolver_test.dart

Issue 2624793002: Make error producing tests ansynchronous. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/generated/simple_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/simple_resolver_test.dart b/pkg/analyzer/test/generated/simple_resolver_test.dart
index b4e6bab8afbab301b6dbb39f48e7c346f86476d1..db6a8bd7b1d9d5eaa94d1e4473fd98653bc563af 100644
--- a/pkg/analyzer/test/generated/simple_resolver_test.dart
+++ b/pkg/analyzer/test/generated/simple_resolver_test.dart
@@ -27,7 +27,7 @@ main() {
@reflectiveTest
class SimpleResolverTest extends ResolverTestCase {
- void test_argumentResolution_required_matching() {
+ test_argumentResolution_required_matching() async {
Source source = addSource(r'''
class A {
void f() {
@@ -38,7 +38,7 @@ class A {
_validateArgumentResolution(source, [0, 1, 2]);
}
- void test_argumentResolution_required_tooFew() {
+ test_argumentResolution_required_tooFew() async {
Source source = addSource(r'''
class A {
void f() {
@@ -49,7 +49,7 @@ class A {
_validateArgumentResolution(source, [0, 1]);
}
- void test_argumentResolution_required_tooMany() {
+ test_argumentResolution_required_tooMany() async {
Source source = addSource(r'''
class A {
void f() {
@@ -60,7 +60,7 @@ class A {
_validateArgumentResolution(source, [0, 1, -1]);
}
- void test_argumentResolution_requiredAndNamed_extra() {
+ test_argumentResolution_requiredAndNamed_extra() async {
Source source = addSource(r'''
class A {
void f() {
@@ -71,7 +71,7 @@ class A {
_validateArgumentResolution(source, [0, 1, 2, -1]);
}
- void test_argumentResolution_requiredAndNamed_matching() {
+ test_argumentResolution_requiredAndNamed_matching() async {
Source source = addSource(r'''
class A {
void f() {
@@ -82,7 +82,7 @@ class A {
_validateArgumentResolution(source, [0, 1, 2]);
}
- void test_argumentResolution_requiredAndNamed_missing() {
+ test_argumentResolution_requiredAndNamed_missing() async {
Source source = addSource(r'''
class A {
void f() {
@@ -93,7 +93,7 @@ class A {
_validateArgumentResolution(source, [0, 1, 3]);
}
- void test_argumentResolution_requiredAndPositional_fewer() {
+ test_argumentResolution_requiredAndPositional_fewer() async {
Source source = addSource(r'''
class A {
void f() {
@@ -104,7 +104,7 @@ class A {
_validateArgumentResolution(source, [0, 1, 2]);
}
- void test_argumentResolution_requiredAndPositional_matching() {
+ test_argumentResolution_requiredAndPositional_matching() async {
Source source = addSource(r'''
class A {
void f() {
@@ -115,7 +115,7 @@ class A {
_validateArgumentResolution(source, [0, 1, 2, 3]);
}
- void test_argumentResolution_requiredAndPositional_more() {
+ test_argumentResolution_requiredAndPositional_more() async {
Source source = addSource(r'''
class A {
void f() {
@@ -126,7 +126,7 @@ class A {
_validateArgumentResolution(source, [0, 1, 2, -1]);
}
- void test_argumentResolution_setter_propagated() {
+ test_argumentResolution_setter_propagated() async {
Source source = addSource(r'''
main() {
var a = new A();
@@ -159,7 +159,7 @@ class A {
expect(setter.parameters[0], same(parameter));
}
- void test_argumentResolution_setter_propagated_propertyAccess() {
+ test_argumentResolution_setter_propagated_propertyAccess() async {
Source source = addSource(r'''
main() {
var a = new A();
@@ -195,7 +195,7 @@ class B {
expect(setter.parameters[0], same(parameter));
}
- void test_argumentResolution_setter_static() {
+ test_argumentResolution_setter_static() async {
Source source = addSource(r'''
main() {
A a = new A();
@@ -227,7 +227,7 @@ class A {
expect(setter.parameters[0], same(parameter));
}
- void test_argumentResolution_setter_static_propertyAccess() {
+ test_argumentResolution_setter_static_propertyAccess() async {
Source source = addSource(r'''
main() {
A a = new A();
@@ -262,7 +262,7 @@ class B {
expect(setter.parameters[0], same(parameter));
}
- void test_breakTarget_labeled() {
+ test_breakTarget_labeled() async {
// Verify that the target of the label is correctly found and is recorded
// as the unlabeled portion of the statement.
String text = r'''
@@ -288,7 +288,7 @@ void f() {
expect(break2.target, same(forStatement));
}
- void test_breakTarget_unlabeledBreakFromDo() {
+ test_breakTarget_unlabeledBreakFromDo() async {
String text = r'''
void f() {
do {
@@ -304,7 +304,7 @@ void f() {
expect(breakStatement.target, same(doStatement));
}
- void test_breakTarget_unlabeledBreakFromFor() {
+ test_breakTarget_unlabeledBreakFromFor() async {
String text = r'''
void f() {
for (int i = 0; i < 10; i++) {
@@ -320,7 +320,7 @@ void f() {
expect(breakStatement.target, same(forStatement));
}
- void test_breakTarget_unlabeledBreakFromForEach() {
+ test_breakTarget_unlabeledBreakFromForEach() async {
String text = r'''
void f() {
for (x in []) {
@@ -336,7 +336,7 @@ void f() {
expect(breakStatement.target, same(forStatement));
}
- void test_breakTarget_unlabeledBreakFromSwitch() {
+ test_breakTarget_unlabeledBreakFromSwitch() async {
String text = r'''
void f() {
while (true) {
@@ -355,7 +355,7 @@ void f() {
expect(breakStatement.target, same(switchStatement));
}
- void test_breakTarget_unlabeledBreakFromWhile() {
+ test_breakTarget_unlabeledBreakFromWhile() async {
String text = r'''
void f() {
while (true) {
@@ -371,7 +371,7 @@ void f() {
expect(breakStatement.target, same(whileStatement));
}
- void test_breakTarget_unlabeledBreakToOuterFunction() {
+ test_breakTarget_unlabeledBreakToOuterFunction() async {
// Verify that unlabeled break statements can't resolve to loops in an
// outer function.
String text = r'''
@@ -389,7 +389,7 @@ void f() {
expect(breakStatement.target, isNull);
}
- void test_class_definesCall() {
+ test_class_definesCall() async {
Source source = addSource(r'''
class A {
int call(int x) { return x; }
@@ -397,20 +397,20 @@ class A {
int f(A a) {
return a(0);
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_class_extends_implements() {
+ test_class_extends_implements() async {
Source source = addSource(r'''
class A extends B implements C {}
class B {}
class C {}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_commentReference_class() {
+ test_commentReference_class() async {
Source source = addSource(r'''
f() {}
/** [A] [new A] [A.n] [new A.n] [m] [f] */
@@ -419,11 +419,11 @@ class A {
A.n() {}
m() {}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_commentReference_parameter() {
+ test_commentReference_parameter() async {
Source source = addSource(r'''
class A {
A() {}
@@ -431,19 +431,19 @@ class A {
/** [e] [f] */
m(e, f()) {}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_commentReference_singleLine() {
+ test_commentReference_singleLine() async {
Source source = addSource(r'''
/// [A]
class A {}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_continueTarget_labeled() {
+ test_continueTarget_labeled() async {
// Verify that the target of the label is correctly found and is recorded
// as the unlabeled portion of the statement.
String text = r'''
@@ -469,7 +469,7 @@ void f() {
expect(continue2.target, same(forStatement));
}
- void test_continueTarget_unlabeledContinueFromDo() {
+ test_continueTarget_unlabeledContinueFromDo() async {
String text = r'''
void f() {
do {
@@ -485,7 +485,7 @@ void f() {
expect(continueStatement.target, same(doStatement));
}
- void test_continueTarget_unlabeledContinueFromFor() {
+ test_continueTarget_unlabeledContinueFromFor() async {
String text = r'''
void f() {
for (int i = 0; i < 10; i++) {
@@ -501,7 +501,7 @@ void f() {
expect(continueStatement.target, same(forStatement));
}
- void test_continueTarget_unlabeledContinueFromForEach() {
+ test_continueTarget_unlabeledContinueFromForEach() async {
String text = r'''
void f() {
for (x in []) {
@@ -517,7 +517,7 @@ void f() {
expect(continueStatement.target, same(forStatement));
}
- void test_continueTarget_unlabeledContinueFromWhile() {
+ test_continueTarget_unlabeledContinueFromWhile() async {
String text = r'''
void f() {
while (true) {
@@ -533,7 +533,7 @@ void f() {
expect(continueStatement.target, same(whileStatement));
}
- void test_continueTarget_unlabeledContinueSkipsSwitch() {
+ test_continueTarget_unlabeledContinueSkipsSwitch() async {
String text = r'''
void f() {
while (true) {
@@ -552,7 +552,7 @@ void f() {
expect(continueStatement.target, same(whileStatement));
}
- void test_continueTarget_unlabeledContinueToOuterFunction() {
+ test_continueTarget_unlabeledContinueToOuterFunction() async {
// Verify that unlabeled continue statements can't resolve to loops in an
// outer function.
String text = r'''
@@ -570,13 +570,13 @@ void f() {
expect(continueStatement.target, isNull);
}
- void test_empty() {
+ test_empty() async {
Source source = addSource("");
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_entryPoint_exported() {
+ test_entryPoint_exported() async {
addNamedSource(
"/two.dart",
r'''
@@ -592,11 +592,11 @@ export 'two.dart';''');
FunctionElement main = library.entryPoint;
expect(main, isNotNull);
expect(main.library, isNot(same(library)));
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_entryPoint_local() {
+ test_entryPoint_local() async {
Source source = addNamedSource(
"/one.dart",
r'''
@@ -607,20 +607,20 @@ main() {}''');
FunctionElement main = library.entryPoint;
expect(main, isNotNull);
expect(main.library, same(library));
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_entryPoint_none() {
+ test_entryPoint_none() async {
Source source = addNamedSource("/one.dart", "library one;");
LibraryElement library = resolve2(source);
expect(library, isNotNull);
expect(library.entryPoint, isNull);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_enum_externalLibrary() {
+ test_enum_externalLibrary() async {
addNamedSource(
"/my_lib.dart",
r'''
@@ -631,11 +631,11 @@ import 'my_lib.dart';
main() {
EEE e = null;
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_extractedMethodAsConstant() {
+ test_extractedMethodAsConstant() async {
Source source = addSource(r'''
abstract class Comparable<T> {
int compareTo(T other);
@@ -644,11 +644,11 @@ abstract class Comparable<T> {
class A {
void sort([compare = Comparable.compare]) {}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_fieldFormalParameter() {
+ test_fieldFormalParameter() async {
Source source = addSource(r'''
class A {
int x;
@@ -669,22 +669,22 @@ class A {
SimpleIdentifier identifierX = initializer.expression;
expect(identifierX.staticElement, paramElement);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_forEachLoops_nonConflicting() {
+ test_forEachLoops_nonConflicting() async {
Source source = addSource(r'''
f() {
List list = [1,2,3];
for (int x in list) {}
for (int x in list) {}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_forLoops_nonConflicting() {
+ test_forLoops_nonConflicting() async {
Source source = addSource(r'''
f() {
for (int i = 0; i < 3; i++) {
@@ -692,11 +692,11 @@ f() {
for (int i = 0; i < 3; i++) {
}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_functionTypeAlias() {
+ test_functionTypeAlias() async {
Source source = addSource(r'''
typedef bool P(e);
class A {
@@ -705,11 +705,11 @@ class A {
if (p(e)) {}
}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_getter_and_setter_fromMixins_bare_identifier() {
+ test_getter_and_setter_fromMixins_bare_identifier() async {
Source source = addSource('''
class B {}
class M1 {
@@ -727,7 +727,7 @@ class C extends B with M1, M2 {
}
''');
LibraryElement library = resolve2(source);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
// Verify that both the getter and setter for "x" in C.f() refer to the
// accessors defined in M2.
@@ -748,7 +748,7 @@ class C extends B with M1, M2 {
}
@failingTest
- void test_getter_and_setter_fromMixins_property_access() {
+ test_getter_and_setter_fromMixins_property_access() async {
// TODO(paulberry): it appears that auxiliaryElements isn't properly set on
// a SimpleIdentifier that's inside a property access. This bug should be
// fixed.
@@ -768,7 +768,7 @@ void main() {
}
''');
LibraryElement library = resolve2(source);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
// Verify that both the getter and setter for "x" in "new C().x" refer to
// the accessors defined in M2.
@@ -790,7 +790,7 @@ void main() {
'M2');
}
- void test_getter_fromMixins_bare_identifier() {
+ test_getter_fromMixins_bare_identifier() async {
Source source = addSource('''
class B {}
class M1 {
@@ -806,7 +806,7 @@ class C extends B with M1, M2 {
}
''');
LibraryElement library = resolve2(source);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
// Verify that the getter for "x" in C.f() refers to the getter defined in
// M2.
@@ -819,7 +819,7 @@ class C extends B with M1, M2 {
'M2');
}
- void test_getter_fromMixins_property_access() {
+ test_getter_fromMixins_property_access() async {
Source source = addSource('''
class B {}
class M1 {
@@ -834,7 +834,7 @@ void main() {
}
''');
LibraryElement library = resolve2(source);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
// Verify that the getter for "x" in "new C().x" refers to the getter
// defined in M2.
@@ -851,7 +851,7 @@ void main() {
'M2');
}
- void test_getterAndSetterWithDifferentTypes() {
+ test_getterAndSetterWithDifferentTypes() async {
Source source = addSource(r'''
class A {
int get f => 0;
@@ -860,12 +860,12 @@ class A {
g (A a) {
a.f = a.f.toString();
}''');
- assertErrors(
+ await assertErrors(
source, [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]);
verify([source]);
}
- void test_hasReferenceToSuper() {
+ test_hasReferenceToSuper() async {
Source source = addSource(r'''
class A {}
class B {toString() => super.toString();}''');
@@ -877,11 +877,11 @@ class B {toString() => super.toString();}''');
expect(classes, hasLength(2));
expect(classes[0].hasReferenceToSuper, isFalse);
expect(classes[1].hasReferenceToSuper, isTrue);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_import_hide() {
+ test_import_hide() async {
addNamedSource(
"/lib1.dart",
r'''
@@ -903,11 +903,11 @@ main() {
foo = 0;
}
A a;''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_import_prefix() {
+ test_import_prefix() async {
addNamedSource(
"/two.dart",
r'''
@@ -923,11 +923,11 @@ import 'two.dart' as _two;
main() {
_two.f(0);
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_import_prefix_doesNotExist() {
+ test_import_prefix_doesNotExist() async {
//
// The primary purpose of this test is to ensure that we are only getting a
// single error generated when the only problem is that an imported file
@@ -952,11 +952,11 @@ class H extends D<p.W> {
H(int i) : super(i);
}
''');
- assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
+ await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
verify([source]);
}
- void test_import_show_doesNotExist() {
+ test_import_show_doesNotExist() async {
//
// The primary purpose of this test is to ensure that we are only getting a
// single error generated when the only problem is that an imported file
@@ -981,11 +981,11 @@ class H extends D<W> {
H(int i) : super(i);
}
''');
- assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
+ await assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
verify([source]);
}
- void test_import_spaceInUri() {
+ test_import_spaceInUri() async {
addNamedSource(
"/sub folder/lib.dart",
r'''
@@ -999,11 +999,11 @@ import 'sub folder/lib.dart';
main() {
foo();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_indexExpression_typeParameters() {
+ test_indexExpression_typeParameters() async {
Source source = addSource(r'''
f() {
List<int> a;
@@ -1013,21 +1013,21 @@ f() {
List<List<List<int>>> c;
c[0][0][0];
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_indexExpression_typeParameters_invalidAssignmentWarning() {
+ test_indexExpression_typeParameters_invalidAssignmentWarning() async {
Source source = addSource(r'''
f() {
List<List<int>> b;
b[0][0] = 'hi';
}''');
- assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
+ await assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
verify([source]);
}
- void test_indirectOperatorThroughCall() {
+ test_indirectOperatorThroughCall() async {
Source source = addSource(r'''
class A {
B call() { return new B(); }
@@ -1044,11 +1044,11 @@ g(int x) {}
main() {
g(f()[0]);
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invoke_dynamicThroughGetter() {
+ test_invoke_dynamicThroughGetter() async {
Source source = addSource(r'''
class A {
List get X => [() => 0];
@@ -1056,11 +1056,11 @@ class A {
X.last;
}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_isValidMixin_badSuperclass() {
+ test_isValidMixin_badSuperclass() async {
Source source = addSource(r'''
class A extends B {}
class B {}
@@ -1071,11 +1071,12 @@ class C = Object with A;''');
expect(unit, isNotNull);
ClassElement a = unit.getType('A');
expect(a.isValidMixin, isFalse);
- assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
+ await assertErrors(
+ source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
verify([source]);
}
- void test_isValidMixin_badSuperclass_withSuperMixins() {
+ test_isValidMixin_badSuperclass_withSuperMixins() async {
resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
Source source = addSource(r'''
class A extends B {}
@@ -1087,11 +1088,11 @@ class C = Object with A;''');
expect(unit, isNotNull);
ClassElement a = unit.getType('A');
expect(a.isValidMixin, isTrue);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_isValidMixin_constructor() {
+ test_isValidMixin_constructor() async {
Source source = addSource(r'''
class A {
A() {}
@@ -1103,11 +1104,12 @@ class C = Object with A;''');
expect(unit, isNotNull);
ClassElement a = unit.getType('A');
expect(a.isValidMixin, isFalse);
- assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
+ await assertErrors(
+ source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
verify([source]);
}
- void test_isValidMixin_constructor_withSuperMixins() {
+ test_isValidMixin_constructor_withSuperMixins() async {
resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
Source source = addSource(r'''
class A {
@@ -1120,11 +1122,12 @@ class C = Object with A;''');
expect(unit, isNotNull);
ClassElement a = unit.getType('A');
expect(a.isValidMixin, isFalse);
- assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
+ await assertErrors(
+ source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
verify([source]);
}
- void test_isValidMixin_factoryConstructor() {
+ test_isValidMixin_factoryConstructor() async {
Source source = addSource(r'''
class A {
factory A() => null;
@@ -1136,11 +1139,11 @@ class C = Object with A;''');
expect(unit, isNotNull);
ClassElement a = unit.getType('A');
expect(a.isValidMixin, isTrue);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_isValidMixin_factoryConstructor_withSuperMixins() {
+ test_isValidMixin_factoryConstructor_withSuperMixins() async {
resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
Source source = addSource(r'''
class A {
@@ -1153,11 +1156,11 @@ class C = Object with A;''');
expect(unit, isNotNull);
ClassElement a = unit.getType('A');
expect(a.isValidMixin, isTrue);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_isValidMixin_super() {
+ test_isValidMixin_super() async {
Source source = addSource(r'''
class A {
toString() {
@@ -1171,11 +1174,11 @@ class C = Object with A;''');
expect(unit, isNotNull);
ClassElement a = unit.getType('A');
expect(a.isValidMixin, isFalse);
- assertErrors(source, [CompileTimeErrorCode.MIXIN_REFERENCES_SUPER]);
+ await assertErrors(source, [CompileTimeErrorCode.MIXIN_REFERENCES_SUPER]);
verify([source]);
}
- void test_isValidMixin_super_withSuperMixins() {
+ test_isValidMixin_super_withSuperMixins() async {
resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
Source source = addSource(r'''
class A {
@@ -1190,11 +1193,11 @@ class C = Object with A;''');
expect(unit, isNotNull);
ClassElement a = unit.getType('A');
expect(a.isValidMixin, isTrue);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_isValidMixin_valid() {
+ test_isValidMixin_valid() async {
Source source = addSource('''
class A {}
class C = Object with A;''');
@@ -1204,11 +1207,11 @@ class C = Object with A;''');
expect(unit, isNotNull);
ClassElement a = unit.getType('A');
expect(a.isValidMixin, isTrue);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_isValidMixin_valid_withSuperMixins() {
+ test_isValidMixin_valid_withSuperMixins() async {
resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
Source source = addSource('''
class A {}
@@ -1219,11 +1222,11 @@ class C = Object with A;''');
expect(unit, isNotNull);
ClassElement a = unit.getType('A');
expect(a.isValidMixin, isTrue);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_labels_switch() {
+ test_labels_switch() async {
Source source = addSource(r'''
void doSwitch(int target) {
switch (target) {
@@ -1237,11 +1240,11 @@ void doSwitch(int target) {
}''');
LibraryElement library = resolve2(source);
expect(library, isNotNull);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_localVariable_types_invoked() {
+ test_localVariable_types_invoked() async {
Source source = addSource(r'''
const A = null;
main() {
@@ -1264,7 +1267,7 @@ main() {
expect(found[0], isTrue);
}
- void test_metadata_class() {
+ test_metadata_class() async {
Source source = addSource(r'''
const A = null;
@A class C<A> {}''');
@@ -1276,7 +1279,7 @@ const A = null;
expect(classes, hasLength(1));
List<ElementAnnotation> annotations = classes[0].metadata;
expect(annotations, hasLength(1));
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
CompilationUnit unit = resolveCompilationUnit(source, library);
NodeList<CompilationUnitMember> declarations = unit.declarations;
@@ -1294,7 +1297,7 @@ const A = null;
expect(actualElement, same(expectedElement));
}
- void test_metadata_field() {
+ test_metadata_field() async {
Source source = addSource(r'''
const A = null;
class C {
@@ -1309,11 +1312,11 @@ class C {
FieldElement field = classes[0].fields[0];
List<ElementAnnotation> annotations = field.metadata;
expect(annotations, hasLength(1));
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_metadata_fieldFormalParameter() {
+ test_metadata_fieldFormalParameter() async {
Source source = addSource(r'''
const A = null;
class C {
@@ -1332,11 +1335,11 @@ class C {
expect(parameters, hasLength(1));
List<ElementAnnotation> annotations = parameters[0].metadata;
expect(annotations, hasLength(1));
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_metadata_function() {
+ test_metadata_function() async {
Source source = addSource(r'''
const A = null;
@A f() {}''');
@@ -1348,11 +1351,11 @@ const A = null;
expect(functions, hasLength(1));
List<ElementAnnotation> annotations = functions[0].metadata;
expect(annotations, hasLength(1));
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_metadata_functionTypedParameter() {
+ test_metadata_functionTypedParameter() async {
Source source = addSource(r'''
const A = null;
f(@A int p(int x)) {}''');
@@ -1366,11 +1369,11 @@ f(@A int p(int x)) {}''');
expect(parameters, hasLength(1));
List<ElementAnnotation> annotations1 = parameters[0].metadata;
expect(annotations1, hasLength(1));
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_metadata_libraryDirective() {
+ test_metadata_libraryDirective() async {
Source source = addSource(r'''
@A library lib;
const A = null;''');
@@ -1378,11 +1381,11 @@ const A = null;''');
expect(library, isNotNull);
List<ElementAnnotation> annotations = library.metadata;
expect(annotations, hasLength(1));
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_metadata_method() {
+ test_metadata_method() async {
Source source = addSource(r'''
const A = null;
class C {
@@ -1397,11 +1400,11 @@ class C {
MethodElement method = classes[0].methods[0];
List<ElementAnnotation> annotations = method.metadata;
expect(annotations, hasLength(1));
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_metadata_namedParameter() {
+ test_metadata_namedParameter() async {
Source source = addSource(r'''
const A = null;
f({@A int p : 0}) {}''');
@@ -1415,11 +1418,11 @@ f({@A int p : 0}) {}''');
expect(parameters, hasLength(1));
List<ElementAnnotation> annotations1 = parameters[0].metadata;
expect(annotations1, hasLength(1));
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_metadata_positionalParameter() {
+ test_metadata_positionalParameter() async {
Source source = addSource(r'''
const A = null;
f([@A int p = 0]) {}''');
@@ -1433,11 +1436,11 @@ f([@A int p = 0]) {}''');
expect(parameters, hasLength(1));
List<ElementAnnotation> annotations1 = parameters[0].metadata;
expect(annotations1, hasLength(1));
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_metadata_simpleParameter() {
+ test_metadata_simpleParameter() async {
Source source = addSource(r'''
const A = null;
f(@A p1, @A int p2) {}''');
@@ -1453,11 +1456,11 @@ f(@A p1, @A int p2) {}''');
expect(annotations1, hasLength(1));
List<ElementAnnotation> annotations2 = parameters[1].metadata;
expect(annotations2, hasLength(1));
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_metadata_typedef() {
+ test_metadata_typedef() async {
Source source = addSource(r'''
const A = null;
@A typedef F<A>();''');
@@ -1469,7 +1472,7 @@ const A = null;
expect(aliases, hasLength(1));
List<ElementAnnotation> annotations = aliases[0].metadata;
expect(annotations, hasLength(1));
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
CompilationUnit unit = resolveCompilationUnit(source, library);
NodeList<CompilationUnitMember> declarations = unit.declarations;
@@ -1487,7 +1490,7 @@ const A = null;
expect(actualElement, same(expectedElement));
}
- void test_method_fromMixin() {
+ test_method_fromMixin() async {
Source source = addSource(r'''
class B {
bar() => 1;
@@ -1500,11 +1503,11 @@ class C extends B with A {
bar() => super.bar();
foo() => super.foo();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_method_fromMixins() {
+ test_method_fromMixins() async {
Source source = addSource('''
class B {}
class M1 {
@@ -1519,7 +1522,7 @@ void main() {
}
''');
LibraryElement library = resolve2(source);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
// Verify that the "f" in "new C().f()" refers to the "f" defined in M2.
FunctionDeclaration main =
@@ -1535,7 +1538,7 @@ void main() {
'M2');
}
- void test_method_fromMixins_bare_identifier() {
+ test_method_fromMixins_bare_identifier() async {
Source source = addSource('''
class B {}
class M1 {
@@ -1551,7 +1554,7 @@ class C extends B with M1, M2 {
}
''');
LibraryElement library = resolve2(source);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
// Verify that the call to f() in C.g() refers to the method defined in M2.
ClassElement classC = library.definingCompilationUnit.types[3];
@@ -1568,7 +1571,7 @@ class C extends B with M1, M2 {
'M2');
}
- void test_method_fromMixins_invked_from_outside_class() {
+ test_method_fromMixins_invked_from_outside_class() async {
Source source = addSource('''
class B {}
class M1 {
@@ -1583,7 +1586,7 @@ void main() {
}
''');
LibraryElement library = resolve2(source);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
// Verify that the call to f() in "new C().f()" refers to the method
// defined in M2.
@@ -1600,7 +1603,7 @@ void main() {
'M2');
}
- void test_method_fromSuperclassMixin() {
+ test_method_fromSuperclassMixin() async {
Source source = addSource(r'''
class A {
void m1() {}
@@ -1612,11 +1615,11 @@ class C extends B {
f(C c) {
c.m1();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_methodCascades() {
+ test_methodCascades() async {
Source source = addSource(r'''
class A {
void m1() {}
@@ -1627,11 +1630,11 @@ class A {
..m2();
}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_methodCascades_withSetter() {
+ test_methodCascades_withSetter() async {
Source source = addSource(r'''
class A {
String name;
@@ -1645,19 +1648,19 @@ class A {
}
}''');
// failing with error code: INVOCATION_OF_NON_FUNCTION
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_resolveAgainstNull() {
+ test_resolveAgainstNull() async {
Source source = addSource(r'''
f(var p) {
return null == p;
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
}
- void test_setter_fromMixins_bare_identifier() {
+ test_setter_fromMixins_bare_identifier() async {
Source source = addSource('''
class B {}
class M1 {
@@ -1673,7 +1676,7 @@ class C extends B with M1, M2 {
}
''');
LibraryElement library = resolve2(source);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
// Verify that the setter for "x" in C.f() refers to the setter defined in
// M2.
@@ -1691,7 +1694,7 @@ class C extends B with M1, M2 {
'M2');
}
- void test_setter_fromMixins_property_access() {
+ test_setter_fromMixins_property_access() async {
Source source = addSource('''
class B {}
class M1 {
@@ -1706,7 +1709,7 @@ void main() {
}
''');
LibraryElement library = resolve2(source);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
// Verify that the setter for "x" in "new C().x" refers to the setter
// defined in M2.
@@ -1724,7 +1727,7 @@ void main() {
'M2');
}
- void test_setter_inherited() {
+ test_setter_inherited() async {
Source source = addSource(r'''
class A {
int get x => 0;
@@ -1734,11 +1737,11 @@ class B extends A {
int get x => super.x == null ? 0 : super.x;
int f() => x = 1;
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_setter_static() {
+ test_setter_static() async {
Source source = addSource(r'''
set s(x) {
}
@@ -1746,12 +1749,12 @@ set s(x) {
main() {
s = 123;
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
@failingTest
- void test_staticInvocation() {
+ test_staticInvocation() async {
Source source = addSource(r'''
class A {
static int get g => (a,b) => 0;
@@ -1761,7 +1764,7 @@ class B {
A.g(1,0);
}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}

Powered by Google App Engine
This is Rietveld 408576698