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

Unified Diff: pkg/analyzer/test/generated/hint_code_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/hint_code_test.dart
diff --git a/pkg/analyzer/test/generated/hint_code_test.dart b/pkg/analyzer/test/generated/hint_code_test.dart
index a0e694571f098f1004ae5b496fc606e8f36b4e7e..f37bb9cef8c9ca705a2bf5bea364316390850b73 100644
--- a/pkg/analyzer/test/generated/hint_code_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_test.dart
@@ -65,7 +65,7 @@ class JS {
}, resourceProvider: resourceProvider);
}
- void test_abstractSuperMemberReference_getter() {
+ test_abstractSuperMemberReference_getter() async {
Source source = addSource(r'''
abstract class A {
int get test;
@@ -77,11 +77,11 @@ class B extends A {
}
}
''');
- assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
+ await assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
verify([source]);
}
- void test_abstractSuperMemberReference_method_invocation() {
+ test_abstractSuperMemberReference_method_invocation() async {
Source source = addSource(r'''
abstract class A {
void test();
@@ -92,11 +92,11 @@ class B extends A {
}
}
''');
- assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
+ await assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
verify([source]);
}
- void test_abstractSuperMemberReference_method_reference() {
+ test_abstractSuperMemberReference_method_reference() async {
Source source = addSource(r'''
abstract class A {
void test();
@@ -107,11 +107,11 @@ class B extends A {
}
}
''');
- assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
+ await assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
verify([source]);
}
- void test_abstractSuperMemberReference_setter() {
+ test_abstractSuperMemberReference_setter() async {
Source source = addSource(r'''
abstract class A {
void set test(int v);
@@ -122,11 +122,11 @@ class B extends A {
}
}
''');
- assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
+ await assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
verify([source]);
}
- void test_argumentTypeNotAssignable_functionType() {
+ test_argumentTypeNotAssignable_functionType() async {
Source source = addSource(r'''
m() {
var a = new A();
@@ -135,39 +135,39 @@ m() {
class A {
n(void f(int i)) {}
}''');
- assertErrors(source, [HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
+ await assertErrors(source, [HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
verify([source]);
}
- void test_argumentTypeNotAssignable_message() {
+ test_argumentTypeNotAssignable_message() async {
// The implementation of HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE assumes that
// StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE has the same message.
expect(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE.message,
HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE.message);
}
- void test_argumentTypeNotAssignable_type() {
+ test_argumentTypeNotAssignable_type() async {
Source source = addSource(r'''
m() {
var i = '';
n(i);
}
n(int i) {}''');
- assertErrors(source, [HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
+ await assertErrors(source, [HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
verify([source]);
}
- void test_canBeNullAfterNullAware_false_methodInvocation() {
+ test_canBeNullAfterNullAware_false_methodInvocation() async {
Source source = addSource(r'''
m(x) {
x?.a()?.b();
}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_canBeNullAfterNullAware_false_null() {
+ test_canBeNullAfterNullAware_false_null() async {
Source source = addSource(r'''
m(x) {
x?.a.hashCode;
@@ -178,197 +178,197 @@ m(x) {
x?.b().toString();
}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_canBeNullAfterNullAware_false_propertyAccess() {
+ test_canBeNullAfterNullAware_false_propertyAccess() async {
Source source = addSource(r'''
m(x) {
x?.a?.b;
}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_canBeNullAfterNullAware_methodInvocation() {
+ test_canBeNullAfterNullAware_methodInvocation() async {
Source source = addSource(r'''
m(x) {
x?.a.b();
}
''');
- assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+ await assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
verify([source]);
}
- void test_canBeNullAfterNullAware_parenthesized() {
+ test_canBeNullAfterNullAware_parenthesized() async {
Source source = addSource(r'''
m(x) {
(x?.a).b;
}
''');
- assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+ await assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
verify([source]);
}
- void test_canBeNullAfterNullAware_propertyAccess() {
+ test_canBeNullAfterNullAware_propertyAccess() async {
Source source = addSource(r'''
m(x) {
x?.a.b;
}
''');
- assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+ await assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
verify([source]);
}
- void test_deadCode_deadBlock_conditionalElse() {
+ test_deadCode_deadBlock_conditionalElse() async {
Source source = addSource(r'''
f() {
true ? 1 : 2;
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadBlock_conditionalElse_nested() {
+ test_deadCode_deadBlock_conditionalElse_nested() async {
// test that a dead else-statement can't generate additional violations
Source source = addSource(r'''
f() {
true ? true : false && false;
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadBlock_conditionalIf() {
+ test_deadCode_deadBlock_conditionalIf() async {
Source source = addSource(r'''
f() {
false ? 1 : 2;
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadBlock_conditionalIf_nested() {
+ test_deadCode_deadBlock_conditionalIf_nested() async {
// test that a dead then-statement can't generate additional violations
Source source = addSource(r'''
f() {
false ? false && false : true;
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadBlock_else() {
+ test_deadCode_deadBlock_else() async {
Source source = addSource(r'''
f() {
if(true) {} else {}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadBlock_else_nested() {
+ test_deadCode_deadBlock_else_nested() async {
// test that a dead else-statement can't generate additional violations
Source source = addSource(r'''
f() {
if(true) {} else {if (false) {}}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadBlock_if() {
+ test_deadCode_deadBlock_if() async {
Source source = addSource(r'''
f() {
if(false) {}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadBlock_if_nested() {
+ test_deadCode_deadBlock_if_nested() async {
// test that a dead then-statement can't generate additional violations
Source source = addSource(r'''
f() {
if(false) {if(false) {}}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadBlock_while() {
+ test_deadCode_deadBlock_while() async {
Source source = addSource(r'''
f() {
while(false) {}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadBlock_while_nested() {
+ test_deadCode_deadBlock_while_nested() async {
// test that a dead while body can't generate additional violations
Source source = addSource(r'''
f() {
while(false) {if(false) {}}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadCatch_catchFollowingCatch() {
+ test_deadCode_deadCatch_catchFollowingCatch() async {
Source source = addSource(r'''
class A {}
f() {
try {} catch (e) {} catch (e) {}
}''');
- assertErrors(source, [HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]);
+ await assertErrors(source, [HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]);
verify([source]);
}
- void test_deadCode_deadCatch_catchFollowingCatch_nested() {
+ test_deadCode_deadCatch_catchFollowingCatch_nested() async {
// test that a dead catch clause can't generate additional violations
Source source = addSource(r'''
class A {}
f() {
try {} catch (e) {} catch (e) {if(false) {}}
}''');
- assertErrors(source, [HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]);
+ await assertErrors(source, [HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]);
verify([source]);
}
- void test_deadCode_deadCatch_catchFollowingCatch_object() {
+ test_deadCode_deadCatch_catchFollowingCatch_object() async {
Source source = addSource(r'''
f() {
try {} on Object catch (e) {} catch (e) {}
}''');
- assertErrors(source, [HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]);
+ await assertErrors(source, [HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]);
verify([source]);
}
- void test_deadCode_deadCatch_catchFollowingCatch_object_nested() {
+ test_deadCode_deadCatch_catchFollowingCatch_object_nested() async {
// test that a dead catch clause can't generate additional violations
Source source = addSource(r'''
f() {
try {} on Object catch (e) {} catch (e) {if(false) {}}
}''');
- assertErrors(source, [HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]);
+ await assertErrors(source, [HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]);
verify([source]);
}
- void test_deadCode_deadCatch_onCatchSubtype() {
+ test_deadCode_deadCatch_onCatchSubtype() async {
Source source = addSource(r'''
class A {}
class B extends A {}
f() {
try {} on A catch (e) {} on B catch (e) {}
}''');
- assertErrors(source, [HintCode.DEAD_CODE_ON_CATCH_SUBTYPE]);
+ await assertErrors(source, [HintCode.DEAD_CODE_ON_CATCH_SUBTYPE]);
verify([source]);
}
- void test_deadCode_deadCatch_onCatchSubtype_nested() {
+ test_deadCode_deadCatch_onCatchSubtype_nested() async {
// test that a dead catch clause can't generate additional violations
Source source = addSource(r'''
class A {}
@@ -376,11 +376,11 @@ class B extends A {}
f() {
try {} on A catch (e) {} on B catch (e) {if(false) {}}
}''');
- assertErrors(source, [HintCode.DEAD_CODE_ON_CATCH_SUBTYPE]);
+ await assertErrors(source, [HintCode.DEAD_CODE_ON_CATCH_SUBTYPE]);
verify([source]);
}
- void test_deadCode_deadFinalReturnInCase() {
+ test_deadCode_deadFinalReturnInCase() async {
Source source = addSource(r'''
f() {
switch (true) {
@@ -395,11 +395,11 @@ f() {
break;
}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadFinalStatementInCase() {
+ test_deadCode_deadFinalStatementInCase() async {
Source source = addSource(r'''
f() {
switch (true) {
@@ -416,48 +416,48 @@ f() {
}''');
// A single dead statement at the end of a switch case that is not a
// terminating statement will yield two errors.
- assertErrors(source,
+ await assertErrors(source,
[HintCode.DEAD_CODE, StaticWarningCode.CASE_BLOCK_NOT_TERMINATED]);
verify([source]);
}
- void test_deadCode_deadOperandLHS_and() {
+ test_deadCode_deadOperandLHS_and() async {
Source source = addSource(r'''
f() {
bool b = false && false;
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadOperandLHS_and_nested() {
+ test_deadCode_deadOperandLHS_and_nested() async {
Source source = addSource(r'''
f() {
bool b = false && (false && false);
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadOperandLHS_or() {
+ test_deadCode_deadOperandLHS_or() async {
Source source = addSource(r'''
f() {
bool b = true || true;
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_deadOperandLHS_or_nested() {
+ test_deadCode_deadOperandLHS_or_nested() async {
Source source = addSource(r'''
f() {
bool b = true || (false && false);
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterBreak_inDefaultCase() {
+ test_deadCode_statementAfterBreak_inDefaultCase() async {
Source source = addSource(r'''
f(v) {
switch(v) {
@@ -467,11 +467,11 @@ f(v) {
var a;
}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterBreak_inForEachStatement() {
+ test_deadCode_statementAfterBreak_inForEachStatement() async {
Source source = addSource(r'''
f() {
var list;
@@ -480,11 +480,11 @@ f() {
var a;
}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterBreak_inForStatement() {
+ test_deadCode_statementAfterBreak_inForStatement() async {
Source source = addSource(r'''
f() {
for(;;) {
@@ -492,11 +492,11 @@ f() {
var a;
}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterBreak_inSwitchCase() {
+ test_deadCode_statementAfterBreak_inSwitchCase() async {
Source source = addSource(r'''
f(v) {
switch(v) {
@@ -505,11 +505,11 @@ f(v) {
var a;
}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterBreak_inWhileStatement() {
+ test_deadCode_statementAfterBreak_inWhileStatement() async {
Source source = addSource(r'''
f(v) {
while(v) {
@@ -517,11 +517,11 @@ f(v) {
var a;
}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterContinue_inForEachStatement() {
+ test_deadCode_statementAfterContinue_inForEachStatement() async {
Source source = addSource(r'''
f() {
var list;
@@ -530,11 +530,11 @@ f() {
var a;
}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterContinue_inForStatement() {
+ test_deadCode_statementAfterContinue_inForStatement() async {
Source source = addSource(r'''
f() {
for(;;) {
@@ -542,11 +542,11 @@ f() {
var a;
}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterContinue_inWhileStatement() {
+ test_deadCode_statementAfterContinue_inWhileStatement() async {
Source source = addSource(r'''
f(v) {
while(v) {
@@ -554,11 +554,11 @@ f(v) {
var a;
}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterExitingIf_returns() {
+ test_deadCode_statementAfterExitingIf_returns() async {
Source source = addSource(r'''
f() {
if (1 > 2) {
@@ -568,11 +568,11 @@ f() {
}
var one = 1;
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterRethrow() {
+ test_deadCode_statementAfterRethrow() async {
Source source = addSource(r'''
f() {
try {
@@ -582,22 +582,22 @@ f() {
var two = 2;
}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterReturn_function() {
+ test_deadCode_statementAfterReturn_function() async {
Source source = addSource(r'''
f() {
var one = 1;
return;
var two = 2;
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterReturn_ifStatement() {
+ test_deadCode_statementAfterReturn_ifStatement() async {
Source source = addSource(r'''
f(bool b) {
if(b) {
@@ -606,11 +606,11 @@ f(bool b) {
var two = 2;
}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterReturn_method() {
+ test_deadCode_statementAfterReturn_method() async {
Source source = addSource(r'''
class A {
m() {
@@ -619,22 +619,22 @@ class A {
var two = 2;
}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterReturn_nested() {
+ test_deadCode_statementAfterReturn_nested() async {
Source source = addSource(r'''
f() {
var one = 1;
return;
if(false) {}
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterReturn_twoReturns() {
+ test_deadCode_statementAfterReturn_twoReturns() async {
Source source = addSource(r'''
f() {
var one = 1;
@@ -643,22 +643,22 @@ f() {
return;
var three = 3;
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deadCode_statementAfterThrow() {
+ test_deadCode_statementAfterThrow() async {
Source source = addSource(r'''
f() {
var one = 1;
throw 'Stop here';
var two = 2;
}''');
- assertErrors(source, [HintCode.DEAD_CODE]);
+ await assertErrors(source, [HintCode.DEAD_CODE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_assignment() {
+ test_deprecatedAnnotationUse_assignment() async {
Source source = addSource(r'''
class A {
@deprecated
@@ -668,11 +668,11 @@ f(A a) {
A b;
a += b;
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_call() {
+ test_deprecatedAnnotationUse_call() async {
Source source = addSource(r'''
class A {
@deprecated
@@ -682,33 +682,33 @@ class A {
a();
}
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_deprecated() {
+ test_deprecatedAnnotationUse_deprecated() async {
Source source = addSource(r'''
class A {
@deprecated
m() {}
n() {m();}
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_Deprecated() {
+ test_deprecatedAnnotationUse_Deprecated() async {
Source source = addSource(r'''
class A {
@Deprecated('0.9')
m() {}
n() {m();}
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_export() {
+ test_deprecatedAnnotationUse_export() async {
Source source = addSource("export 'deprecated_library.dart';");
addNamedSource(
"/deprecated_library.dart",
@@ -716,11 +716,11 @@ class A {
@deprecated
library deprecated_library;
class A {}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_field() {
+ test_deprecatedAnnotationUse_field() async {
Source source = addSource(r'''
class A {
@deprecated
@@ -729,11 +729,11 @@ class A {
f(A a) {
return a.x;
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_getter() {
+ test_deprecatedAnnotationUse_getter() async {
Source source = addSource(r'''
class A {
@deprecated
@@ -742,11 +742,11 @@ class A {
f(A a) {
return a.m;
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_import() {
+ test_deprecatedAnnotationUse_import() async {
Source source = addSource(r'''
import 'deprecated_library.dart';
f(A a) {}''');
@@ -756,11 +756,11 @@ f(A a) {}''');
@deprecated
library deprecated_library;
class A {}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_indexExpression() {
+ test_deprecatedAnnotationUse_indexExpression() async {
Source source = addSource(r'''
class A {
@deprecated
@@ -769,11 +769,11 @@ class A {
f(A a) {
return a[1];
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_instanceCreation() {
+ test_deprecatedAnnotationUse_instanceCreation() async {
Source source = addSource(r'''
class A {
@deprecated
@@ -782,11 +782,11 @@ class A {
f() {
A a = new A(1);
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_instanceCreation_namedConstructor() {
+ test_deprecatedAnnotationUse_instanceCreation_namedConstructor() async {
Source source = addSource(r'''
class A {
@deprecated
@@ -795,21 +795,21 @@ class A {
f() {
A a = new A.named(1);
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_named() {
+ test_deprecatedAnnotationUse_named() async {
Source source = addSource(r'''
class A {
m({@deprecated int x}) {}
n() {m(x: 1);}
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_operator() {
+ test_deprecatedAnnotationUse_operator() async {
Source source = addSource(r'''
class A {
@deprecated
@@ -819,21 +819,21 @@ f(A a) {
A b;
return a + b;
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_positional() {
+ test_deprecatedAnnotationUse_positional() async {
Source source = addSource(r'''
class A {
m([@deprecated int x]) {}
n() {m(1);}
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_setter() {
+ test_deprecatedAnnotationUse_setter() async {
Source source = addSource(r'''
class A {
@deprecated
@@ -842,11 +842,11 @@ class A {
f(A a) {
return a.s = 1;
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_superConstructor() {
+ test_deprecatedAnnotationUse_superConstructor() async {
Source source = addSource(r'''
class A {
@deprecated
@@ -855,11 +855,11 @@ class A {
class B extends A {
B() : super() {}
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_deprecatedAnnotationUse_superConstructor_namedConstructor() {
+ test_deprecatedAnnotationUse_superConstructor_namedConstructor() async {
Source source = addSource(r'''
class A {
@deprecated
@@ -868,29 +868,29 @@ class A {
class B extends A {
B() : super.named() {}
}''');
- assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
+ await assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
verify([source]);
}
- void test_divisionOptimization_double() {
+ test_divisionOptimization_double() async {
Source source = addSource(r'''
f(double x, double y) {
var v = (x / y).toInt();
}''');
- assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
+ await assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
verify([source]);
}
- void test_divisionOptimization_int() {
+ test_divisionOptimization_int() async {
Source source = addSource(r'''
f(int x, int y) {
var v = (x / y).toInt();
}''');
- assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
+ await assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
verify([source]);
}
- void test_divisionOptimization_propagatedType() {
+ test_divisionOptimization_propagatedType() async {
// Tests the propagated type information of the '/' method
Source source = addSource(r'''
f(x, y) {
@@ -898,20 +898,20 @@ f(x, y) {
y = 1;
var v = (x / y).toInt();
}''');
- assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
+ await assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
verify([source]);
}
- void test_divisionOptimization_wrappedBinaryExpression() {
+ test_divisionOptimization_wrappedBinaryExpression() async {
Source source = addSource(r'''
f(int x, int y) {
var v = (((x / y))).toInt();
}''');
- assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
+ await assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
verify([source]);
}
- void test_duplicateImport() {
+ test_duplicateImport() async {
Source source = addSource(r'''
library L;
import 'lib1.dart';
@@ -922,11 +922,11 @@ A a;''');
r'''
library lib1;
class A {}''');
- assertErrors(source, [HintCode.DUPLICATE_IMPORT]);
+ await assertErrors(source, [HintCode.DUPLICATE_IMPORT]);
verify([source]);
}
- void test_duplicateImport2() {
+ test_duplicateImport2() async {
Source source = addSource(r'''
library L;
import 'lib1.dart';
@@ -938,12 +938,12 @@ A a;''');
r'''
library lib1;
class A {}''');
- assertErrors(
+ await assertErrors(
source, [HintCode.DUPLICATE_IMPORT, HintCode.DUPLICATE_IMPORT]);
verify([source]);
}
- void test_duplicateImport3() {
+ test_duplicateImport3() async {
Source source = addSource(r'''
library L;
import 'lib1.dart' as M show A hide B;
@@ -955,11 +955,11 @@ M.A a;''');
library lib1;
class A {}
class B {}''');
- assertErrors(source, [HintCode.DUPLICATE_IMPORT]);
+ await assertErrors(source, [HintCode.DUPLICATE_IMPORT]);
verify([source]);
}
- void test_factory__expr_return_null_OK() {
+ test_factory__expr_return_null_OK() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -970,11 +970,11 @@ class Stateful {
class State { }
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_factory_abstract_OK() {
+ test_factory_abstract_OK() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -985,11 +985,11 @@ abstract class Stateful {
class State { }
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_factory_bad_return() {
+ test_factory_bad_return() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -1002,11 +1002,11 @@ class Stateful {
class State { }
''');
- assertErrors(source, [HintCode.INVALID_FACTORY_METHOD_IMPL]);
+ await assertErrors(source, [HintCode.INVALID_FACTORY_METHOD_IMPL]);
verify([source]);
}
- void test_factory_block_OK() {
+ test_factory_block_OK() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -1019,11 +1019,11 @@ class Stateful {
class State { }
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_factory_block_return_null_OK() {
+ test_factory_block_return_null_OK() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -1036,11 +1036,11 @@ class Stateful {
class State { }
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_factory_expr_OK() {
+ test_factory_expr_OK() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -1051,11 +1051,11 @@ class Stateful {
class State { }
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_factory_misplaced_annotation() {
+ test_factory_misplaced_annotation() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -1068,7 +1068,7 @@ class X {
@factory
main() { }
''');
- assertErrors(source, [
+ await assertErrors(source, [
HintCode.INVALID_FACTORY_ANNOTATION,
HintCode.INVALID_FACTORY_ANNOTATION,
HintCode.INVALID_FACTORY_ANNOTATION
@@ -1076,7 +1076,7 @@ main() { }
verify([source]);
}
- void test_factory_no_return_type_OK() {
+ test_factory_no_return_type_OK() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -1088,11 +1088,11 @@ class Stateful {
}
''');
// Null return types will get flagged elsewhere, no need to pile-on here.
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_factory_subclass_OK() {
+ test_factory_subclass_OK() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -1112,11 +1112,11 @@ class MyThing extends Stateful {
class State { }
class MyState extends State { }
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_factory_void_return() {
+ test_factory_void_return() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -1125,12 +1125,12 @@ class Stateful {
void createState() {}
}
''');
- assertErrors(source, [HintCode.INVALID_FACTORY_METHOD_DECL]);
+ await assertErrors(source, [HintCode.INVALID_FACTORY_METHOD_DECL]);
verify([source]);
}
- void test_importDeferredLibraryWithLoadFunction() {
- resolveWithErrors(<String>[
+ test_importDeferredLibraryWithLoadFunction() async {
+ await resolveWithErrors(<String>[
r'''
library lib1;
loadLibrary() {}
@@ -1144,7 +1144,7 @@ main() { lib1.f(); }'''
]);
}
- void test_invalidAssignment_instanceVariable() {
+ test_invalidAssignment_instanceVariable() async {
Source source = addSource(r'''
class A {
int x;
@@ -1155,29 +1155,29 @@ f(var y) {
a.x = y;
}
}''');
- assertErrors(source, [HintCode.INVALID_ASSIGNMENT]);
+ await assertErrors(source, [HintCode.INVALID_ASSIGNMENT]);
verify([source]);
}
- void test_invalidAssignment_localVariable() {
+ test_invalidAssignment_localVariable() async {
Source source = addSource(r'''
f(var y) {
if(y is String) {
int x = y;
}
}''');
- assertErrors(source, [HintCode.INVALID_ASSIGNMENT]);
+ await assertErrors(source, [HintCode.INVALID_ASSIGNMENT]);
verify([source]);
}
- void test_invalidAssignment_message() {
+ test_invalidAssignment_message() async {
// The implementation of HintCode.INVALID_ASSIGNMENT assumes that
// StaticTypeWarningCode.INVALID_ASSIGNMENT has the same message.
expect(StaticTypeWarningCode.INVALID_ASSIGNMENT.message,
HintCode.INVALID_ASSIGNMENT.message);
}
- void test_invalidAssignment_staticVariable() {
+ test_invalidAssignment_staticVariable() async {
Source source = addSource(r'''
class A {
static int x;
@@ -1187,11 +1187,11 @@ f(var y) {
A.x = y;
}
}''');
- assertErrors(source, [HintCode.INVALID_ASSIGNMENT]);
+ await assertErrors(source, [HintCode.INVALID_ASSIGNMENT]);
verify([source]);
}
- void test_invalidAssignment_variableDeclaration() {
+ test_invalidAssignment_variableDeclaration() async {
// 17971
Source source = addSource(r'''
class Point {
@@ -1206,11 +1206,11 @@ main() {
var p2 = new Point(10, 10);
int n = p1 + p2;
}''');
- assertErrors(source, [HintCode.INVALID_ASSIGNMENT]);
+ await assertErrors(source, [HintCode.INVALID_ASSIGNMENT]);
verify([source]);
}
- void test_invalidUseOfProtectedMember_closure() {
+ test_invalidUseOfProtectedMember_closure() async {
Source source = addNamedSource(
'/lib1.dart',
r'''
@@ -1231,12 +1231,12 @@ void main() {
print(leak);
}
''');
- assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
- assertNoErrors(source);
+ await assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
+ await assertNoErrors(source);
verify([source, source2]);
}
- void test_invalidUseOfProtectedMember_field() {
+ test_invalidUseOfProtectedMember_field() async {
Source source = addNamedSource(
'/lib1.dart',
r'''
@@ -1255,12 +1255,12 @@ abstract class B {
int b() => new A().a;
}
''');
- assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
- assertNoErrors(source);
+ await assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
+ await assertNoErrors(source);
verify([source, source2]);
}
- void test_invalidUseOfProtectedMember_field_OK() {
+ test_invalidUseOfProtectedMember_field_OK() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1270,11 +1270,11 @@ class A {
abstract class B implements A {
int b() => a;
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_function() {
+ test_invalidUseOfProtectedMember_function() async {
Source source = addNamedSource(
'/lib1.dart',
r'''
@@ -1293,12 +1293,12 @@ main() {
new A().a();
}
''');
- assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
- assertNoErrors(source);
+ await assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
+ await assertNoErrors(source);
verify([source, source2]);
}
- void test_invalidUseOfProtectedMember_function_OK() {
+ test_invalidUseOfProtectedMember_function_OK() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1309,11 +1309,11 @@ class A {
abstract class B implements A {
int b() => a();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_function_OK2() {
+ test_invalidUseOfProtectedMember_function_OK2() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1323,11 +1323,11 @@ class A {
main() {
new A().a();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_getter() {
+ test_invalidUseOfProtectedMember_getter() async {
Source source = addNamedSource(
'/lib1.dart',
r'''
@@ -1347,12 +1347,12 @@ class B {
int b() => a.a;
}
''');
- assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
- assertNoErrors(source);
+ await assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
+ await assertNoErrors(source);
verify([source, source2]);
}
- void test_invalidUseOfProtectedMember_getter_OK() {
+ test_invalidUseOfProtectedMember_getter_OK() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1362,11 +1362,11 @@ class A {
abstract class B implements A {
int b() => a;
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_in_docs_OK() {
+ test_invalidUseOfProtectedMember_in_docs_OK() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -1382,11 +1382,11 @@ class A {
/// OK: [A.a], [A.b], [A.c].
f() {}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_message() {
+ test_invalidUseOfProtectedMember_message() async {
Source source = addNamedSource(
'/lib1.dart',
r'''
@@ -1411,7 +1411,7 @@ class B {
verify([source, source2]);
}
- void test_invalidUseOfProtectedMember_method_1() {
+ test_invalidUseOfProtectedMember_method_1() async {
Source source = addNamedSource(
'/lib1.dart',
r'''
@@ -1431,12 +1431,12 @@ class B {
}
''');
- assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
- assertNoErrors(source);
+ await assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
+ await assertNoErrors(source);
verify([source, source2]);
}
- void test_invalidUseOfProtectedMember_method_OK() {
+ test_invalidUseOfProtectedMember_method_OK() async {
// https://github.com/dart-lang/linter/issues/257
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -1454,11 +1454,11 @@ class Button extends State<Object> {
}
}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_OK_1() {
+ test_invalidUseOfProtectedMember_OK_1() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1468,11 +1468,11 @@ class A {
class B extends A {
void b() => a();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_OK_2() {
+ test_invalidUseOfProtectedMember_OK_2() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1482,11 +1482,11 @@ class A {
class B extends Object with A {
void b() => a();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_OK_3() {
+ test_invalidUseOfProtectedMember_OK_3() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1495,11 +1495,11 @@ class A {
class B extends A {
static m2(A a) => a.m1();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_OK_4() {
+ test_invalidUseOfProtectedMember_OK_4() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1512,11 +1512,11 @@ class B extends A {
main() {
new B().a();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_OK_field() {
+ test_invalidUseOfProtectedMember_OK_field() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1527,11 +1527,11 @@ class B extends A {
int b() => a;
}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_OK_getter() {
+ test_invalidUseOfProtectedMember_OK_getter() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1542,11 +1542,11 @@ class B extends A {
int b() => a;
}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_OK_setter() {
+ test_invalidUseOfProtectedMember_OK_setter() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1559,11 +1559,11 @@ class B extends A {
}
}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_OK_setter_2() {
+ test_invalidUseOfProtectedMember_OK_setter_2() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1575,11 +1575,11 @@ class A {
}
}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_setter() {
+ test_invalidUseOfProtectedMember_setter() async {
Source source = addNamedSource(
'/lib1.dart',
r'''
@@ -1601,12 +1601,12 @@ class B{
}
}
''');
- assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
- assertNoErrors(source);
+ await assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
+ await assertNoErrors(source);
verify([source, source2]);
}
- void test_invalidUseOfProtectedMember_setter_OK() {
+ test_invalidUseOfProtectedMember_setter_OK() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1618,11 +1618,11 @@ abstract class B implements A {
a = i;
}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_topLevelVariable() {
+ test_invalidUseOfProtectedMember_topLevelVariable() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@protected
@@ -1632,43 +1632,43 @@ main() {
}''');
// TODO(brianwilkerson) This should produce a hint because the annotation is
// being applied to the wrong kind of declaration.
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_isDouble() {
+ test_isDouble() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.dart2jsHint = true;
resetWithOptions(options);
Source source = addSource("var v = 1 is double;");
- assertErrors(source, [HintCode.IS_DOUBLE]);
+ await assertErrors(source, [HintCode.IS_DOUBLE]);
verify([source]);
}
@failingTest
- void test_isInt() {
+ test_isInt() async {
Source source = addSource("var v = 1 is int;");
- assertErrors(source, [HintCode.IS_INT]);
+ await assertErrors(source, [HintCode.IS_INT]);
verify([source]);
}
- void test_isNotDouble() {
+ test_isNotDouble() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.dart2jsHint = true;
resetWithOptions(options);
Source source = addSource("var v = 1 is! double;");
- assertErrors(source, [HintCode.IS_NOT_DOUBLE]);
+ await assertErrors(source, [HintCode.IS_NOT_DOUBLE]);
verify([source]);
}
@failingTest
- void test_isNotInt() {
+ test_isNotInt() async {
Source source = addSource("var v = 1 is! int;");
- assertErrors(source, [HintCode.IS_NOT_INT]);
+ await assertErrors(source, [HintCode.IS_NOT_INT]);
verify([source]);
}
- void test_js_lib_OK() {
+ test_js_lib_OK() async {
Source source = addSource(r'''
@JS()
library foo;
@@ -1678,11 +1678,11 @@ import 'package:js/js.dart';
@JS()
class A { }
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_missingJsLibAnnotation_class() {
+ test_missingJsLibAnnotation_class() async {
Source source = addSource(r'''
library foo;
@@ -1691,11 +1691,11 @@ import 'package:js/js.dart';
@JS()
class A { }
''');
- assertErrors(source, [HintCode.MISSING_JS_LIB_ANNOTATION]);
+ await assertErrors(source, [HintCode.MISSING_JS_LIB_ANNOTATION]);
verify([source]);
}
- void test_missingJsLibAnnotation_externalField() {
+ test_missingJsLibAnnotation_externalField() async {
// https://github.com/dart-lang/sdk/issues/26987
Source source = addSource(r'''
import 'package:js/js.dart';
@@ -1703,12 +1703,12 @@ import 'package:js/js.dart';
@JS()
external dynamic exports;
''');
- assertErrors(source,
+ await assertErrors(source,
[ParserErrorCode.EXTERNAL_FIELD, HintCode.MISSING_JS_LIB_ANNOTATION]);
verify([source]);
}
- void test_missingJsLibAnnotation_function() {
+ test_missingJsLibAnnotation_function() async {
Source source = addSource(r'''
library foo;
@@ -1717,11 +1717,11 @@ import 'package:js/js.dart';
@JS('acxZIndex')
set _currentZIndex(int value) { }
''');
- assertErrors(source, [HintCode.MISSING_JS_LIB_ANNOTATION]);
+ await assertErrors(source, [HintCode.MISSING_JS_LIB_ANNOTATION]);
verify([source]);
}
- void test_missingJsLibAnnotation_method() {
+ test_missingJsLibAnnotation_method() async {
Source source = addSource(r'''
library foo;
@@ -1732,56 +1732,56 @@ class A {
void a() { }
}
''');
- assertErrors(source, [HintCode.MISSING_JS_LIB_ANNOTATION]);
+ await assertErrors(source, [HintCode.MISSING_JS_LIB_ANNOTATION]);
verify([source]);
}
- void test_missingJsLibAnnotation_variable() {
+ test_missingJsLibAnnotation_variable() async {
Source source = addSource(r'''
import 'package:js/js.dart';
@JS()
dynamic variable;
''');
- assertErrors(source, [HintCode.MISSING_JS_LIB_ANNOTATION]);
+ await assertErrors(source, [HintCode.MISSING_JS_LIB_ANNOTATION]);
verify([source]);
}
- void test_missingReturn_async() {
+ test_missingReturn_async() async {
Source source = addSource('''
import 'dart:async';
Future<int> f() async {}
''');
- assertErrors(source, [HintCode.MISSING_RETURN]);
+ await assertErrors(source, [HintCode.MISSING_RETURN]);
verify([source]);
}
- void test_missingReturn_factory() {
+ test_missingReturn_factory() async {
Source source = addSource(r'''
class A {
factory A() {}
}
''');
- assertErrors(source, [HintCode.MISSING_RETURN]);
+ await assertErrors(source, [HintCode.MISSING_RETURN]);
verify([source]);
}
- void test_missingReturn_function() {
+ test_missingReturn_function() async {
Source source = addSource("int f() {}");
- assertErrors(source, [HintCode.MISSING_RETURN]);
+ await assertErrors(source, [HintCode.MISSING_RETURN]);
verify([source]);
}
- void test_missingReturn_method() {
+ test_missingReturn_method() async {
Source source = addSource(r'''
class A {
int m() {}
}''');
- assertErrors(source, [HintCode.MISSING_RETURN]);
+ await assertErrors(source, [HintCode.MISSING_RETURN]);
verify([source]);
}
- void test_mustCallSuper() {
+ test_mustCallSuper() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1794,11 +1794,11 @@ class B extends A {
{}
}
''');
- assertErrors(source, [HintCode.MUST_CALL_SUPER]);
+ await assertErrors(source, [HintCode.MUST_CALL_SUPER]);
verify([source]);
}
- void test_mustCallSuper_fromInterface() {
+ test_mustCallSuper_fromInterface() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1810,11 +1810,11 @@ class C implements A {
void a() {}
}
''');
- assertErrors(source, []);
+ await assertErrors(source, []);
verify([source]);
}
- void test_mustCallSuper_indirect() {
+ test_mustCallSuper_indirect() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1832,11 +1832,11 @@ class D extends C {
void a() {}
}
''');
- assertErrors(source, [HintCode.MUST_CALL_SUPER]);
+ await assertErrors(source, [HintCode.MUST_CALL_SUPER]);
verify([source]);
}
- void test_mustCallSuper_overridden() {
+ test_mustCallSuper_overridden() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -1850,161 +1850,161 @@ class C extends A {
}
}
''');
- assertErrors(source, []);
+ await assertErrors(source, []);
verify([source]);
}
- void test_nullAwareInCondition_assert() {
+ test_nullAwareInCondition_assert() async {
Source source = addSource(r'''
m(x) {
assert (x?.a);
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
- void test_nullAwareInCondition_conditionalExpression() {
+ test_nullAwareInCondition_conditionalExpression() async {
Source source = addSource(r'''
m(x) {
return x?.a ? 0 : 1;
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
- void test_nullAwareInCondition_do() {
+ test_nullAwareInCondition_do() async {
Source source = addSource(r'''
m(x) {
do {} while (x?.a);
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
- void test_nullAwareInCondition_for() {
+ test_nullAwareInCondition_for() async {
Source source = addSource(r'''
m(x) {
for (var v = x; v?.a; v = v.next) {}
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
- void test_nullAwareInCondition_if() {
+ test_nullAwareInCondition_if() async {
Source source = addSource(r'''
m(x) {
if (x?.a) {}
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
- void test_nullAwareInCondition_if_conditionalAnd_first() {
+ test_nullAwareInCondition_if_conditionalAnd_first() async {
Source source = addSource(r'''
m(x) {
if (x?.a && x.b) {}
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
- void test_nullAwareInCondition_if_conditionalAnd_second() {
+ test_nullAwareInCondition_if_conditionalAnd_second() async {
Source source = addSource(r'''
m(x) {
if (x.a && x?.b) {}
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
- void test_nullAwareInCondition_if_conditionalAnd_third() {
+ test_nullAwareInCondition_if_conditionalAnd_third() async {
Source source = addSource(r'''
m(x) {
if (x.a && x.b && x?.c) {}
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
- void test_nullAwareInCondition_if_conditionalOr_first() {
+ test_nullAwareInCondition_if_conditionalOr_first() async {
Source source = addSource(r'''
m(x) {
if (x?.a || x.b) {}
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
- void test_nullAwareInCondition_if_conditionalOr_second() {
+ test_nullAwareInCondition_if_conditionalOr_second() async {
Source source = addSource(r'''
m(x) {
if (x.a || x?.b) {}
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
- void test_nullAwareInCondition_if_conditionalOr_third() {
+ test_nullAwareInCondition_if_conditionalOr_third() async {
Source source = addSource(r'''
m(x) {
if (x.a || x.b || x?.c) {}
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
- void test_nullAwareInCondition_if_not() {
+ test_nullAwareInCondition_if_not() async {
Source source = addSource(r'''
m(x) {
if (!x?.a) {}
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
- void test_nullAwareInCondition_if_parenthesized() {
+ test_nullAwareInCondition_if_parenthesized() async {
Source source = addSource(r'''
m(x) {
if ((x?.a)) {}
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
- void test_nullAwareInCondition_while() {
+ test_nullAwareInCondition_while() async {
Source source = addSource(r'''
m(x) {
while (x?.a) {}
}
''');
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
+ await assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
verify([source]);
}
@failingTest
- void test_overrideEqualsButNotHashCode() {
+ test_overrideEqualsButNotHashCode() async {
Source source = addSource(r'''
class A {
bool operator ==(x) {}
}''');
- assertErrors(source, [HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE]);
+ await assertErrors(source, [HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE]);
verify([source]);
}
- void test_overrideOnNonOverridingField_invalid() {
+ test_overrideOnNonOverridingField_invalid() async {
Source source = addSource(r'''
class A {
}
@@ -2012,11 +2012,11 @@ class B extends A {
@override
final int m = 1;
}''');
- assertErrors(source, [HintCode.OVERRIDE_ON_NON_OVERRIDING_FIELD]);
+ await assertErrors(source, [HintCode.OVERRIDE_ON_NON_OVERRIDING_FIELD]);
verify([source]);
}
- void test_overrideOnNonOverridingGetter_invalid() {
+ test_overrideOnNonOverridingGetter_invalid() async {
Source source = addSource(r'''
class A {
}
@@ -2024,11 +2024,11 @@ class B extends A {
@override
int get m => 1;
}''');
- assertErrors(source, [HintCode.OVERRIDE_ON_NON_OVERRIDING_GETTER]);
+ await assertErrors(source, [HintCode.OVERRIDE_ON_NON_OVERRIDING_GETTER]);
verify([source]);
}
- void test_overrideOnNonOverridingMethod_invalid() {
+ test_overrideOnNonOverridingMethod_invalid() async {
Source source = addSource(r'''
class A {
}
@@ -2036,11 +2036,11 @@ class B extends A {
@override
int m() => 1;
}''');
- assertErrors(source, [HintCode.OVERRIDE_ON_NON_OVERRIDING_METHOD]);
+ await assertErrors(source, [HintCode.OVERRIDE_ON_NON_OVERRIDING_METHOD]);
verify([source]);
}
- void test_overrideOnNonOverridingSetter_invalid() {
+ test_overrideOnNonOverridingSetter_invalid() async {
Source source = addSource(r'''
class A {
}
@@ -2048,11 +2048,11 @@ class B extends A {
@override
set m(int x) {}
}''');
- assertErrors(source, [HintCode.OVERRIDE_ON_NON_OVERRIDING_SETTER]);
+ await assertErrors(source, [HintCode.OVERRIDE_ON_NON_OVERRIDING_SETTER]);
verify([source]);
}
- void test_required_constructor_param() {
+ test_required_constructor_param() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -2064,11 +2064,11 @@ main() {
new C();
}
''');
- assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
+ await assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
verify([source]);
}
- void test_required_constructor_param_no_reason() {
+ test_required_constructor_param_no_reason() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -2080,11 +2080,11 @@ main() {
new C();
}
''');
- assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
+ await assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
verify([source]);
}
- void test_required_constructor_param_null_reason() {
+ test_required_constructor_param_null_reason() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -2096,11 +2096,11 @@ main() {
new C();
}
''');
- assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
+ await assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
verify([source]);
}
- void test_required_constructor_param_OK() {
+ test_required_constructor_param_OK() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -2112,11 +2112,11 @@ main() {
new C(a: 2);
}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_required_constructor_param_redirecting_cons_call() {
+ test_required_constructor_param_redirecting_cons_call() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -2125,11 +2125,11 @@ class C {
C.named() : this();
}
''');
- assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
+ await assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
verify([source]);
}
- void test_required_constructor_param_super_call() {
+ test_required_constructor_param_super_call() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -2141,11 +2141,11 @@ class D extends C {
D() : super();
}
''');
- assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
+ await assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
verify([source]);
}
- void test_required_function_param() {
+ test_required_function_param() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -2155,11 +2155,11 @@ main() {
f();
}
''');
- assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
+ await assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
verify([source]);
}
- void test_required_method_param() {
+ test_required_method_param() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@@ -2169,11 +2169,11 @@ f() {
new A().m();
}
''');
- assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
+ await assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
verify([source]);
}
- void test_required_method_param_in_other_lib() {
+ test_required_method_param_in_other_lib() async {
addNamedSource(
'/a_lib.dart',
r'''
@@ -2191,11 +2191,11 @@ f() {
}
''');
- assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
+ await assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
verify([source]);
}
- void test_required_typedef_function_param() {
+ test_required_typedef_function_param() async {
Source source = addSource(r'''
import 'package:meta/meta.dart';
@@ -2207,29 +2207,29 @@ class C {
F m() => ({@required String x}) => null;
}
''');
- assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
+ await assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
verify([source]);
}
- void test_typeCheck_type_is_Null() {
+ test_typeCheck_type_is_Null() async {
Source source = addSource(r'''
m(i) {
bool b = i is Null;
}''');
- assertErrors(source, [HintCode.TYPE_CHECK_IS_NULL]);
+ await assertErrors(source, [HintCode.TYPE_CHECK_IS_NULL]);
verify([source]);
}
- void test_typeCheck_type_not_Null() {
+ test_typeCheck_type_not_Null() async {
Source source = addSource(r'''
m(i) {
bool b = i is! Null;
}''');
- assertErrors(source, [HintCode.TYPE_CHECK_IS_NOT_NULL]);
+ await assertErrors(source, [HintCode.TYPE_CHECK_IS_NOT_NULL]);
verify([source]);
}
- void test_undefinedGetter() {
+ test_undefinedGetter() async {
Source source = addSource(r'''
class A {}
f(var a) {
@@ -2237,10 +2237,10 @@ f(var a) {
return a.m;
}
}''');
- assertErrors(source, [HintCode.UNDEFINED_GETTER]);
+ await assertErrors(source, [HintCode.UNDEFINED_GETTER]);
}
- void test_undefinedGetter_message() {
+ test_undefinedGetter_message() async {
// The implementation of HintCode.UNDEFINED_SETTER assumes that
// UNDEFINED_SETTER in StaticTypeWarningCode and StaticWarningCode are the
// same, this verifies that assumption.
@@ -2248,54 +2248,54 @@ f(var a) {
StaticTypeWarningCode.UNDEFINED_GETTER.message);
}
- void test_undefinedIdentifier_exportHide() {
+ test_undefinedIdentifier_exportHide() async {
Source source = addSource(r'''
library L;
export 'lib1.dart' hide a;''');
addNamedSource("/lib1.dart", "library lib1;");
- assertErrors(source, [HintCode.UNDEFINED_HIDDEN_NAME]);
+ await assertErrors(source, [HintCode.UNDEFINED_HIDDEN_NAME]);
verify([source]);
}
- void test_undefinedIdentifier_exportShow() {
+ test_undefinedIdentifier_exportShow() async {
Source source = addSource(r'''
library L;
export 'lib1.dart' show a;''');
addNamedSource("/lib1.dart", "library lib1;");
- assertErrors(source, [HintCode.UNDEFINED_SHOWN_NAME]);
+ await assertErrors(source, [HintCode.UNDEFINED_SHOWN_NAME]);
verify([source]);
}
- void test_undefinedIdentifier_importHide() {
+ test_undefinedIdentifier_importHide() async {
Source source = addSource(r'''
library L;
import 'lib1.dart' hide a;''');
addNamedSource("/lib1.dart", "library lib1;");
- assertErrors(
+ await assertErrors(
source, [HintCode.UNUSED_IMPORT, HintCode.UNDEFINED_HIDDEN_NAME]);
verify([source]);
}
- void test_undefinedIdentifier_importShow() {
+ test_undefinedIdentifier_importShow() async {
Source source = addSource(r'''
library L;
import 'lib1.dart' show a;''');
addNamedSource("/lib1.dart", "library lib1;");
- assertErrors(
+ await assertErrors(
source, [HintCode.UNUSED_IMPORT, HintCode.UNDEFINED_SHOWN_NAME]);
verify([source]);
}
- void test_undefinedMethod() {
+ test_undefinedMethod() async {
Source source = addSource(r'''
f() {
var a = 'str';
a.notAMethodOnString();
}''');
- assertErrors(source, [HintCode.UNDEFINED_METHOD]);
+ await assertErrors(source, [HintCode.UNDEFINED_METHOD]);
}
- void test_undefinedMethod_assignmentExpression() {
+ test_undefinedMethod_assignmentExpression() async {
Source source = addSource(r'''
class A {}
class B {
@@ -2305,10 +2305,10 @@ class B {
a += a2;
}
}''');
- assertErrors(source, [HintCode.UNDEFINED_METHOD]);
+ await assertErrors(source, [HintCode.UNDEFINED_METHOD]);
}
- void test_undefinedOperator_binaryExpression() {
+ test_undefinedOperator_binaryExpression() async {
Source source = addSource(r'''
class A {}
f(var a) {
@@ -2316,10 +2316,10 @@ f(var a) {
a + 1;
}
}''');
- assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
+ await assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
}
- void test_undefinedOperator_indexBoth() {
+ test_undefinedOperator_indexBoth() async {
Source source = addSource(r'''
class A {}
f(var a) {
@@ -2327,10 +2327,10 @@ f(var a) {
a[0]++;
}
}''');
- assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
+ await assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
}
- void test_undefinedOperator_indexGetter() {
+ test_undefinedOperator_indexGetter() async {
Source source = addSource(r'''
class A {}
f(var a) {
@@ -2338,10 +2338,10 @@ f(var a) {
a[0];
}
}''');
- assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
+ await assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
}
- void test_undefinedOperator_indexSetter() {
+ test_undefinedOperator_indexSetter() async {
Source source = addSource(r'''
class A {}
f(var a) {
@@ -2349,10 +2349,10 @@ f(var a) {
a[0] = 1;
}
}''');
- assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
+ await assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
}
- void test_undefinedOperator_postfixExpression() {
+ test_undefinedOperator_postfixExpression() async {
Source source = addSource(r'''
class A {}
f(var a) {
@@ -2360,10 +2360,10 @@ f(var a) {
a++;
}
}''');
- assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
+ await assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
}
- void test_undefinedOperator_prefixExpression() {
+ test_undefinedOperator_prefixExpression() async {
Source source = addSource(r'''
class A {}
f(var a) {
@@ -2371,10 +2371,10 @@ f(var a) {
++a;
}
}''');
- assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
+ await assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
}
- void test_undefinedSetter() {
+ test_undefinedSetter() async {
Source source = addSource(r'''
class A {}
f(var a) {
@@ -2382,10 +2382,10 @@ f(var a) {
a.m = 0;
}
}''');
- assertErrors(source, [HintCode.UNDEFINED_SETTER]);
+ await assertErrors(source, [HintCode.UNDEFINED_SETTER]);
}
- void test_undefinedSetter_message() {
+ test_undefinedSetter_message() async {
// The implementation of HintCode.UNDEFINED_SETTER assumes that
// UNDEFINED_SETTER in StaticTypeWarningCode and StaticWarningCode are the
// same, this verifies that assumption.
@@ -2393,25 +2393,25 @@ f(var a) {
StaticTypeWarningCode.UNDEFINED_SETTER.message);
}
- void test_unnecessaryCast_type_supertype() {
+ test_unnecessaryCast_type_supertype() async {
Source source = addSource(r'''
m(int i) {
var b = i as Object;
}''');
- assertErrors(source, [HintCode.UNNECESSARY_CAST]);
+ await assertErrors(source, [HintCode.UNNECESSARY_CAST]);
verify([source]);
}
- void test_unnecessaryCast_type_type() {
+ test_unnecessaryCast_type_type() async {
Source source = addSource(r'''
m(num i) {
var b = i as num;
}''');
- assertErrors(source, [HintCode.UNNECESSARY_CAST]);
+ await assertErrors(source, [HintCode.UNNECESSARY_CAST]);
verify([source]);
}
- void test_unnecessaryNoSuchMethod_blockBody() {
+ test_unnecessaryNoSuchMethod_blockBody() async {
Source source = addSource(r'''
class A {
noSuchMethod(x) => super.noSuchMethod(x);
@@ -2422,11 +2422,11 @@ class B extends A {
return super.noSuchMethod(y);
}
}''');
- assertErrors(source, [HintCode.UNNECESSARY_NO_SUCH_METHOD]);
+ await assertErrors(source, [HintCode.UNNECESSARY_NO_SUCH_METHOD]);
verify([source]);
}
- void test_unnecessaryNoSuchMethod_expressionBody() {
+ test_unnecessaryNoSuchMethod_expressionBody() async {
Source source = addSource(r'''
class A {
noSuchMethod(x) => super.noSuchMethod(x);
@@ -2435,69 +2435,69 @@ class B extends A {
mmm();
noSuchMethod(y) => super.noSuchMethod(y);
}''');
- assertErrors(source, [HintCode.UNNECESSARY_NO_SUCH_METHOD]);
+ await assertErrors(source, [HintCode.UNNECESSARY_NO_SUCH_METHOD]);
verify([source]);
}
- void test_unnecessaryTypeCheck_null_is_Null() {
+ test_unnecessaryTypeCheck_null_is_Null() async {
Source source = addSource("bool b = null is Null;");
- assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_TRUE]);
+ await assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_TRUE]);
verify([source]);
}
- void test_unnecessaryTypeCheck_null_not_Null() {
+ test_unnecessaryTypeCheck_null_not_Null() async {
Source source = addSource("bool b = null is! Null;");
- assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_FALSE]);
+ await assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_FALSE]);
verify([source]);
}
- void test_unnecessaryTypeCheck_type_is_dynamic() {
+ test_unnecessaryTypeCheck_type_is_dynamic() async {
Source source = addSource(r'''
m(i) {
bool b = i is dynamic;
}''');
- assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_TRUE]);
+ await assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_TRUE]);
verify([source]);
}
- void test_unnecessaryTypeCheck_type_is_object() {
+ test_unnecessaryTypeCheck_type_is_object() async {
Source source = addSource(r'''
m(i) {
bool b = i is Object;
}''');
- assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_TRUE]);
+ await assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_TRUE]);
verify([source]);
}
- void test_unnecessaryTypeCheck_type_not_dynamic() {
+ test_unnecessaryTypeCheck_type_not_dynamic() async {
Source source = addSource(r'''
m(i) {
bool b = i is! dynamic;
}''');
- assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_FALSE]);
+ await assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_FALSE]);
verify([source]);
}
- void test_unnecessaryTypeCheck_type_not_object() {
+ test_unnecessaryTypeCheck_type_not_object() async {
Source source = addSource(r'''
m(i) {
bool b = i is! Object;
}''');
- assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_FALSE]);
+ await assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_FALSE]);
verify([source]);
}
- void test_unusedElement_class_isUsed_extends() {
+ test_unusedElement_class_isUsed_extends() async {
enableUnusedElement = true;
Source source = addSource(r'''
class _A {}
class B extends _A {}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_class_isUsed_fieldDeclaration() {
+ test_unusedElement_class_isUsed_fieldDeclaration() async {
enableUnusedElement = true;
var src = r'''
class Foo {
@@ -2508,32 +2508,32 @@ class _Bar {
}
''';
Source source = addSource(src);
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_class_isUsed_implements() {
+ test_unusedElement_class_isUsed_implements() async {
enableUnusedElement = true;
Source source = addSource(r'''
class _A {}
class B implements _A {}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_class_isUsed_instanceCreation() {
+ test_unusedElement_class_isUsed_instanceCreation() async {
enableUnusedElement = true;
Source source = addSource(r'''
class _A {}
main() {
new _A();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_class_isUsed_staticFieldAccess() {
+ test_unusedElement_class_isUsed_staticFieldAccess() async {
enableUnusedElement = true;
Source source = addSource(r'''
class _A {
@@ -2542,11 +2542,11 @@ class _A {
main() {
_A.F;
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_class_isUsed_staticMethodInvocation() {
+ test_unusedElement_class_isUsed_staticMethodInvocation() async {
enableUnusedElement = true;
Source source = addSource(r'''
class _A {
@@ -2555,11 +2555,11 @@ class _A {
main() {
_A.m();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_class_isUsed_typeArgument() {
+ test_unusedElement_class_isUsed_typeArgument() async {
enableUnusedElement = true;
Source source = addSource(r'''
class _A {}
@@ -2567,11 +2567,11 @@ main() {
var v = new List<_A>();
print(v);
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_class_notUsed_inClassMember() {
+ test_unusedElement_class_notUsed_inClassMember() async {
enableUnusedElement = true;
Source source = addSource(r'''
class _A {
@@ -2583,11 +2583,11 @@ class _A {
}
}
''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_class_notUsed_inConstructorName() {
+ test_unusedElement_class_notUsed_inConstructorName() async {
enableUnusedElement = true;
Source source = addSource(r'''
class _A {
@@ -2595,11 +2595,11 @@ class _A {
_A.named() {}
}
''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_class_notUsed_isExpression() {
+ test_unusedElement_class_notUsed_isExpression() async {
enableUnusedElement = true;
Source source = addSource(r'''
class _A {}
@@ -2608,21 +2608,21 @@ main(p) {
}
}
''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_class_notUsed_noReference() {
+ test_unusedElement_class_notUsed_noReference() async {
enableUnusedElement = true;
Source source = addSource(r'''
class _A {}
main() {
}''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_class_notUsed_variableDeclaration() {
+ test_unusedElement_class_notUsed_variableDeclaration() async {
enableUnusedElement = true;
Source source = addSource(r'''
class _A {}
@@ -2632,32 +2632,32 @@ main() {
}
print(x) {}
''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_enum_isUsed_fieldReference() {
+ test_unusedElement_enum_isUsed_fieldReference() async {
enableUnusedElement = true;
Source source = addSource(r'''
enum _MyEnum {A, B, C}
main() {
print(_MyEnum.B);
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_enum_notUsed_noReference() {
+ test_unusedElement_enum_notUsed_noReference() async {
enableUnusedElement = true;
Source source = addSource(r'''
enum _MyEnum {A, B, C}
main() {
}''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_functionLocal_isUsed_closure() {
+ test_unusedElement_functionLocal_isUsed_closure() async {
enableUnusedElement = true;
Source source = addSource(r'''
main() {
@@ -2665,22 +2665,22 @@ main() {
}
print(x) {}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_functionLocal_isUsed_invocation() {
+ test_unusedElement_functionLocal_isUsed_invocation() async {
enableUnusedElement = true;
Source source = addSource(r'''
main() {
f() {}
f();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_functionLocal_isUsed_reference() {
+ test_unusedElement_functionLocal_isUsed_reference() async {
enableUnusedElement = true;
Source source = addSource(r'''
main() {
@@ -2689,21 +2689,21 @@ main() {
}
print(x) {}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_functionLocal_notUsed_noReference() {
+ test_unusedElement_functionLocal_notUsed_noReference() async {
enableUnusedElement = true;
Source source = addSource(r'''
main() {
f() {}
}''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_functionLocal_notUsed_referenceFromItself() {
+ test_unusedElement_functionLocal_notUsed_referenceFromItself() async {
enableUnusedElement = true;
Source source = addSource(r'''
main() {
@@ -2711,22 +2711,22 @@ main() {
_f(p - 1);
}
}''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_functionTop_isUsed_invocation() {
+ test_unusedElement_functionTop_isUsed_invocation() async {
enableUnusedElement = true;
Source source = addSource(r'''
_f() {}
main() {
_f();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_functionTop_isUsed_reference() {
+ test_unusedElement_functionTop_isUsed_reference() async {
enableUnusedElement = true;
Source source = addSource(r'''
_f() {}
@@ -2735,21 +2735,21 @@ main() {
}
print(x) {}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_functionTop_notUsed_noReference() {
+ test_unusedElement_functionTop_notUsed_noReference() async {
enableUnusedElement = true;
Source source = addSource(r'''
_f() {}
main() {
}''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_functionTop_notUsed_referenceFromItself() {
+ test_unusedElement_functionTop_notUsed_referenceFromItself() async {
enableUnusedElement = true;
Source source = addSource(r'''
_f(int p) {
@@ -2757,11 +2757,11 @@ _f(int p) {
}
main() {
}''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_functionTypeAlias_isUsed_isExpression() {
+ test_unusedElement_functionTypeAlias_isUsed_isExpression() async {
enableUnusedElement = true;
Source source = addSource(r'''
typedef _F(a, b);
@@ -2770,21 +2770,21 @@ main(f) {
print('F');
}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_functionTypeAlias_isUsed_reference() {
+ test_unusedElement_functionTypeAlias_isUsed_reference() async {
enableUnusedElement = true;
Source source = addSource(r'''
typedef _F(a, b);
main(_F f) {
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_functionTypeAlias_isUsed_typeArgument() {
+ test_unusedElement_functionTypeAlias_isUsed_typeArgument() async {
enableUnusedElement = true;
Source source = addSource(r'''
typedef _F(a, b);
@@ -2792,32 +2792,32 @@ main() {
var v = new List<_F>();
print(v);
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_functionTypeAlias_isUsed_variableDeclaration() {
+ test_unusedElement_functionTypeAlias_isUsed_variableDeclaration() async {
enableUnusedElement = true;
Source source = addSource(r'''
typedef _F(a, b);
class A {
_F f;
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_functionTypeAlias_notUsed_noReference() {
+ test_unusedElement_functionTypeAlias_notUsed_noReference() async {
enableUnusedElement = true;
Source source = addSource(r'''
typedef _F(a, b);
main() {
}''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_getter_isUsed_invocation_implicitThis() {
+ test_unusedElement_getter_isUsed_invocation_implicitThis() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -2826,11 +2826,11 @@ class A {
var v = _g;
}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_getter_isUsed_invocation_PrefixedIdentifier() {
+ test_unusedElement_getter_isUsed_invocation_PrefixedIdentifier() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -2840,11 +2840,11 @@ main(A a) {
var v = a._g;
}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_getter_isUsed_invocation_PropertyAccess() {
+ test_unusedElement_getter_isUsed_invocation_PropertyAccess() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -2854,21 +2854,21 @@ main() {
var v = new A()._g;
}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_getter_notUsed_noReference() {
+ test_unusedElement_getter_notUsed_noReference() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
get _g => null;
}''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_getter_notUsed_referenceFromItself() {
+ test_unusedElement_getter_notUsed_referenceFromItself() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -2876,11 +2876,11 @@ class A {
return _g;
}
}''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_method_isUsed_hasReference_implicitThis() {
+ test_unusedElement_method_isUsed_hasReference_implicitThis() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -2891,11 +2891,11 @@ class A {
}
print(x) {}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_method_isUsed_hasReference_implicitThis_subclass() {
+ test_unusedElement_method_isUsed_hasReference_implicitThis_subclass() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -2909,11 +2909,11 @@ class B extends A {
}
print(x) {}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_method_isUsed_hasReference_PrefixedIdentifier() {
+ test_unusedElement_method_isUsed_hasReference_PrefixedIdentifier() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -2922,11 +2922,11 @@ class A {
main(A a) {
a._m;
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_method_isUsed_hasReference_PropertyAccess() {
+ test_unusedElement_method_isUsed_hasReference_PropertyAccess() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -2935,11 +2935,11 @@ class A {
main() {
new A()._m;
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_method_isUsed_invocation_implicitThis() {
+ test_unusedElement_method_isUsed_invocation_implicitThis() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -2948,11 +2948,11 @@ class A {
_m();
}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_method_isUsed_invocation_implicitThis_subclass() {
+ test_unusedElement_method_isUsed_invocation_implicitThis_subclass() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -2964,11 +2964,11 @@ class A {
class B extends A {
_m() {}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_method_isUsed_invocation_MemberElement() {
+ test_unusedElement_method_isUsed_invocation_MemberElement() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A<T> {
@@ -2977,11 +2977,11 @@ class A<T> {
main(A<int> a) {
a._m(0);
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_method_isUsed_invocation_propagated() {
+ test_unusedElement_method_isUsed_invocation_propagated() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -2991,11 +2991,11 @@ main() {
var a = new A();
a._m();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_method_isUsed_invocation_static() {
+ test_unusedElement_method_isUsed_invocation_static() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3005,11 +3005,11 @@ main() {
A a = new A();
a._m();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_method_isUsed_invocation_subclass() {
+ test_unusedElement_method_isUsed_invocation_subclass() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3021,11 +3021,11 @@ class B extends A {
main(A a) {
a._m();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_method_isUsed_notPrivate() {
+ test_unusedElement_method_isUsed_notPrivate() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3033,11 +3033,11 @@ class A {
}
main() {
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_method_isUsed_staticInvocation() {
+ test_unusedElement_method_isUsed_staticInvocation() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3046,21 +3046,21 @@ class A {
main() {
A._m();
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_method_notUsed_noReference() {
+ test_unusedElement_method_notUsed_noReference() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
static _m() {}
}''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_method_notUsed_referenceFromItself() {
+ test_unusedElement_method_notUsed_referenceFromItself() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3068,11 +3068,11 @@ class A {
_m(p - 1);
}
}''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_setter_isUsed_invocation_implicitThis() {
+ test_unusedElement_setter_isUsed_invocation_implicitThis() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3081,11 +3081,11 @@ class A {
_s = 42;
}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_setter_isUsed_invocation_PrefixedIdentifier() {
+ test_unusedElement_setter_isUsed_invocation_PrefixedIdentifier() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3095,11 +3095,11 @@ main(A a) {
a._s = 42;
}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_setter_isUsed_invocation_PropertyAccess() {
+ test_unusedElement_setter_isUsed_invocation_PropertyAccess() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3109,21 +3109,21 @@ main() {
new A()._s = 42;
}
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedElement_setter_notUsed_noReference() {
+ test_unusedElement_setter_notUsed_noReference() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
set _s(x) {}
}''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedElement_setter_notUsed_referenceFromItself() {
+ test_unusedElement_setter_notUsed_referenceFromItself() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3133,11 +3133,11 @@ class A {
}
}
}''');
- assertErrors(source, [HintCode.UNUSED_ELEMENT]);
+ await assertErrors(source, [HintCode.UNUSED_ELEMENT]);
verify([source]);
}
- void test_unusedField_isUsed_argument() {
+ test_unusedField_isUsed_argument() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3147,11 +3147,11 @@ class A {
}
}
print(x) {}''');
- assertErrors(source);
+ await assertErrors(source);
verify([source]);
}
- void test_unusedField_isUsed_reference_implicitThis() {
+ test_unusedField_isUsed_reference_implicitThis() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3161,22 +3161,22 @@ class A {
}
}
print(x) {}''');
- assertErrors(source);
+ await assertErrors(source);
verify([source]);
}
- void test_unusedField_isUsed_reference_implicitThis_expressionFunctionBody() {
+ test_unusedField_isUsed_reference_implicitThis_expressionFunctionBody() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
int _f;
m() => _f;
}''');
- assertErrors(source);
+ await assertErrors(source);
verify([source]);
}
- void test_unusedField_isUsed_reference_implicitThis_subclass() {
+ test_unusedField_isUsed_reference_implicitThis_subclass() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3189,11 +3189,11 @@ class B extends A {
int _f;
}
print(x) {}''');
- assertErrors(source);
+ await assertErrors(source);
verify([source]);
}
- void test_unusedField_isUsed_reference_qualified_propagatedElement() {
+ test_unusedField_isUsed_reference_qualified_propagatedElement() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3204,11 +3204,11 @@ main() {
print(a._f);
}
print(x) {}''');
- assertErrors(source);
+ await assertErrors(source);
verify([source]);
}
- void test_unusedField_isUsed_reference_qualified_staticElement() {
+ test_unusedField_isUsed_reference_qualified_staticElement() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3219,11 +3219,11 @@ main() {
print(a._f);
}
print(x) {}''');
- assertErrors(source);
+ await assertErrors(source);
verify([source]);
}
- void test_unusedField_isUsed_reference_qualified_unresolved() {
+ test_unusedField_isUsed_reference_qualified_unresolved() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3233,11 +3233,11 @@ main(a) {
print(a._f);
}
print(x) {}''');
- assertErrors(source);
+ await assertErrors(source);
verify([source]);
}
- void test_unusedField_notUsed_compoundAssign() {
+ test_unusedField_notUsed_compoundAssign() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3246,44 +3246,44 @@ class A {
_f += 2;
}
}''');
- assertErrors(source, [HintCode.UNUSED_FIELD]);
+ await assertErrors(source, [HintCode.UNUSED_FIELD]);
verify([source]);
}
- void test_unusedField_notUsed_constructorFieldInitializers() {
+ test_unusedField_notUsed_constructorFieldInitializers() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
int _f;
A() : _f = 0;
}''');
- assertErrors(source, [HintCode.UNUSED_FIELD]);
+ await assertErrors(source, [HintCode.UNUSED_FIELD]);
verify([source]);
}
- void test_unusedField_notUsed_fieldFormalParameter() {
+ test_unusedField_notUsed_fieldFormalParameter() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
int _f;
A(this._f);
}''');
- assertErrors(source, [HintCode.UNUSED_FIELD]);
+ await assertErrors(source, [HintCode.UNUSED_FIELD]);
verify([source]);
}
- void test_unusedField_notUsed_noReference() {
+ test_unusedField_notUsed_noReference() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
int _f;
}
''');
- assertErrors(source, [HintCode.UNUSED_FIELD]);
+ await assertErrors(source, [HintCode.UNUSED_FIELD]);
verify([source]);
}
- void test_unusedField_notUsed_postfixExpr() {
+ test_unusedField_notUsed_postfixExpr() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3292,11 +3292,11 @@ class A {
_f++;
}
}''');
- assertErrors(source, [HintCode.UNUSED_FIELD]);
+ await assertErrors(source, [HintCode.UNUSED_FIELD]);
verify([source]);
}
- void test_unusedField_notUsed_prefixExpr() {
+ test_unusedField_notUsed_prefixExpr() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3305,11 +3305,11 @@ class A {
++_f;
}
}''');
- assertErrors(source, [HintCode.UNUSED_FIELD]);
+ await assertErrors(source, [HintCode.UNUSED_FIELD]);
verify([source]);
}
- void test_unusedField_notUsed_simpleAssignment() {
+ test_unusedField_notUsed_simpleAssignment() async {
enableUnusedElement = true;
Source source = addSource(r'''
class A {
@@ -3322,21 +3322,21 @@ main(A a) {
a._f = 2;
}
''');
- assertErrors(source, [HintCode.UNUSED_FIELD]);
+ await assertErrors(source, [HintCode.UNUSED_FIELD]);
verify([source]);
}
- void test_unusedImport() {
+ test_unusedImport() async {
Source source = addSource(r'''
library L;
import 'lib1.dart';''');
Source source2 = addNamedSource("/lib1.dart", "library lib1;");
- assertErrors(source, [HintCode.UNUSED_IMPORT]);
- assertNoErrors(source2);
+ await assertErrors(source, [HintCode.UNUSED_IMPORT]);
+ await assertNoErrors(source2);
verify([source, source2]);
}
- void test_unusedImport_as() {
+ test_unusedImport_as() async {
Source source = addSource(r'''
library L;
import 'lib1.dart';
@@ -3347,13 +3347,13 @@ one.A a;''');
r'''
library lib1;
class A {}''');
- assertErrors(source, [HintCode.UNUSED_IMPORT]);
- assertNoErrors(source2);
+ await assertErrors(source, [HintCode.UNUSED_IMPORT]);
+ await assertNoErrors(source2);
verify([source, source2]);
}
@failingTest
- void test_unusedImport_as_equalPrefixes() {
+ test_unusedImport_as_equalPrefixes() async {
// See todo at ImportsVerifier.prefixElementMap.
Source source = addSource(r'''
library L;
@@ -3370,13 +3370,13 @@ class A {}''');
r'''
library lib2;
class B {}''');
- assertErrors(source, [HintCode.UNUSED_IMPORT]);
- assertNoErrors(source2);
- assertNoErrors(source3);
+ await assertErrors(source, [HintCode.UNUSED_IMPORT]);
+ await assertNoErrors(source2);
+ await assertNoErrors(source3);
verify([source, source2, source3]);
}
- void test_unusedImport_hide() {
+ test_unusedImport_hide() async {
Source source = addSource(r'''
library L;
import 'lib1.dart';
@@ -3387,21 +3387,21 @@ A a;''');
r'''
library lib1;
class A {}''');
- assertErrors(source, [HintCode.UNUSED_IMPORT]);
- assertNoErrors(source2);
+ await assertErrors(source, [HintCode.UNUSED_IMPORT]);
+ await assertNoErrors(source2);
verify([source, source2]);
}
- void test_unusedImport_inComment_libraryDirective() {
+ test_unusedImport_inComment_libraryDirective() async {
Source source = addSource(r'''
/// Use [Future] class.
library L;
import 'dart:async';
''');
- assertNoErrors(source);
+ await assertNoErrors(source);
}
- void test_unusedImport_show() {
+ test_unusedImport_show() async {
Source source = addSource(r'''
library L;
import 'lib1.dart' show A;
@@ -3413,12 +3413,12 @@ A a;''');
library lib1;
class A {}
class B {}''');
- assertErrors(source, [HintCode.UNUSED_IMPORT]);
- assertNoErrors(source2);
+ await assertErrors(source, [HintCode.UNUSED_IMPORT]);
+ await assertNoErrors(source2);
verify([source, source2]);
}
- void test_unusedLocalVariable_inCatch_exception() {
+ test_unusedLocalVariable_inCatch_exception() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
main() {
@@ -3426,11 +3426,11 @@ main() {
} on String catch (exception) {
}
}''');
- assertErrors(source, [HintCode.UNUSED_CATCH_CLAUSE]);
+ await assertErrors(source, [HintCode.UNUSED_CATCH_CLAUSE]);
verify([source]);
}
- void test_unusedLocalVariable_inCatch_exception_hasStack() {
+ test_unusedLocalVariable_inCatch_exception_hasStack() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
main() {
@@ -3439,11 +3439,11 @@ main() {
print(stack);
}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedLocalVariable_inCatch_exception_noOnClause() {
+ test_unusedLocalVariable_inCatch_exception_noOnClause() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
main() {
@@ -3451,11 +3451,11 @@ main() {
} catch (exception) {
}
}''');
- assertNoErrors(source);
+ await assertNoErrors(source);
verify([source]);
}
- void test_unusedLocalVariable_inCatch_stackTrace() {
+ test_unusedLocalVariable_inCatch_stackTrace() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
main() {
@@ -3463,11 +3463,11 @@ main() {
} catch (exception, stackTrace) {
}
}''');
- assertErrors(source, [HintCode.UNUSED_CATCH_STACK]);
+ await assertErrors(source, [HintCode.UNUSED_CATCH_STACK]);
verify([source]);
}
- void test_unusedLocalVariable_inCatch_stackTrace_used() {
+ test_unusedLocalVariable_inCatch_stackTrace_used() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
main() {
@@ -3477,11 +3477,11 @@ main() {
}
}
print(x) {}''');
- assertErrors(source);
+ await assertErrors(source);
verify([source]);
}
- void test_unusedLocalVariable_inFor_underscore_ignored() {
+ test_unusedLocalVariable_inFor_underscore_ignored() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
main() {
@@ -3491,22 +3491,22 @@ main() {
}
}
}''');
- assertErrors(source);
+ await assertErrors(source);
verify([source]);
}
- void test_unusedLocalVariable_inFunction() {
+ test_unusedLocalVariable_inFunction() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
main() {
var v = 1;
v = 2;
}''');
- assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
+ await assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
verify([source]);
}
- void test_unusedLocalVariable_inMethod() {
+ test_unusedLocalVariable_inMethod() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
class A {
@@ -3515,11 +3515,11 @@ class A {
v = 2;
}
}''');
- assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
+ await assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
verify([source]);
}
- void test_unusedLocalVariable_isInvoked() {
+ test_unusedLocalVariable_isInvoked() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
typedef Foo();
@@ -3527,44 +3527,44 @@ main() {
Foo foo;
foo();
}''');
- assertErrors(source);
+ await assertErrors(source);
verify([source]);
}
- void test_unusedLocalVariable_isRead_notUsed_compoundAssign() {
+ test_unusedLocalVariable_isRead_notUsed_compoundAssign() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
main() {
var v = 1;
v += 2;
}''');
- assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
+ await assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
verify([source]);
}
- void test_unusedLocalVariable_isRead_notUsed_postfixExpr() {
+ test_unusedLocalVariable_isRead_notUsed_postfixExpr() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
main() {
var v = 1;
v++;
}''');
- assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
+ await assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
verify([source]);
}
- void test_unusedLocalVariable_isRead_notUsed_prefixExpr() {
+ test_unusedLocalVariable_isRead_notUsed_prefixExpr() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
main() {
var v = 1;
++v;
}''');
- assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
+ await assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
verify([source]);
}
- void test_unusedLocalVariable_isRead_usedArgument() {
+ test_unusedLocalVariable_isRead_usedArgument() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
main() {
@@ -3572,11 +3572,11 @@ main() {
print(++v);
}
print(x) {}''');
- assertErrors(source);
+ await assertErrors(source);
verify([source]);
}
- void test_unusedLocalVariable_isRead_usedInvocationTarget() {
+ test_unusedLocalVariable_isRead_usedInvocationTarget() async {
enableUnusedLocalVariable = true;
Source source = addSource(r'''
class A {
@@ -3587,11 +3587,11 @@ main() {
a.foo();
}
''');
- assertErrors(source);
+ await assertErrors(source);
verify([source]);
}
- void test_unusedShownName() {
+ test_unusedShownName() async {
Source source = addSource(r'''
library L;
import 'lib1.dart' show A, B;
@@ -3602,12 +3602,12 @@ A a;''');
library lib1;
class A {}
class B {}''');
- assertErrors(source, [HintCode.UNUSED_SHOWN_NAME]);
- assertNoErrors(source2);
+ await assertErrors(source, [HintCode.UNUSED_SHOWN_NAME]);
+ await assertNoErrors(source2);
verify([source, source2]);
}
- void test_unusedShownName_as() {
+ test_unusedShownName_as() async {
Source source = addSource(r'''
library L;
import 'lib1.dart' as p show A, B;
@@ -3618,12 +3618,12 @@ p.A a;''');
library lib1;
class A {}
class B {}''');
- assertErrors(source, [HintCode.UNUSED_SHOWN_NAME]);
- assertNoErrors(source2);
+ await assertErrors(source, [HintCode.UNUSED_SHOWN_NAME]);
+ await assertNoErrors(source2);
verify([source, source2]);
}
- void test_unusedShownName_duplicates() {
+ test_unusedShownName_duplicates() async {
Source source = addSource(r'''
library L;
import 'lib1.dart' show A, B;
@@ -3638,13 +3638,13 @@ class A {}
class B {}
class C {}
class D {}''');
- assertErrors(
+ await assertErrors(
source, [HintCode.UNUSED_SHOWN_NAME, HintCode.UNUSED_SHOWN_NAME]);
- assertNoErrors(source2);
+ await assertNoErrors(source2);
verify([source, source2]);
}
- void test_unusedShownName_topLevelVariable() {
+ test_unusedShownName_topLevelVariable() async {
Source source = addSource(r'''
library L;
import 'lib1.dart' show var1, var2;
@@ -3660,12 +3660,12 @@ const int var1 = 1;
const int var2 = 2;
const int var3 = 3;
const int var4 = 4;''');
- assertErrors(source, [HintCode.UNUSED_SHOWN_NAME]);
- assertNoErrors(source2);
+ await assertErrors(source, [HintCode.UNUSED_SHOWN_NAME]);
+ await assertNoErrors(source2);
verify([source, source2]);
}
- void test_useOfVoidResult_assignmentExpression_function() {
+ test_useOfVoidResult_assignmentExpression_function() async {
Source source = addSource(r'''
void f() {}
class A {
@@ -3674,11 +3674,11 @@ class A {
a = f();
}
}''');
- assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
+ await assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
verify([source]);
}
- void test_useOfVoidResult_assignmentExpression_method() {
+ test_useOfVoidResult_assignmentExpression_method() async {
Source source = addSource(r'''
class A {
void m() {}
@@ -3687,11 +3687,11 @@ class A {
a = m();
}
}''');
- assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
+ await assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
verify([source]);
}
- void test_useOfVoidResult_inForLoop() {
+ test_useOfVoidResult_inForLoop() async {
Source source = addSource(r'''
class A {
void m() {}
@@ -3699,11 +3699,11 @@ class A {
for(var a = m();;) {}
}
}''');
- assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
+ await assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
verify([source]);
}
- void test_useOfVoidResult_variableDeclaration_function() {
+ test_useOfVoidResult_variableDeclaration_function() async {
Source source = addSource(r'''
void f() {}
class A {
@@ -3711,11 +3711,11 @@ class A {
var a = f();
}
}''');
- assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
+ await assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
verify([source]);
}
- void test_useOfVoidResult_variableDeclaration_method() {
+ test_useOfVoidResult_variableDeclaration_method() async {
Source source = addSource(r'''
class A {
void m() {}
@@ -3723,11 +3723,11 @@ class A {
var a = m();
}
}''');
- assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
+ await assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
verify([source]);
}
- void test_useOfVoidResult_variableDeclaration_method2() {
+ test_useOfVoidResult_variableDeclaration_method2() async {
Source source = addSource(r'''
class A {
void m() {}
@@ -3735,7 +3735,7 @@ class A {
var a = m(), b = m();
}
}''');
- assertErrors(
+ await assertErrors(
source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]);
verify([source]);
}

Powered by Google App Engine
This is Rietveld 408576698