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

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

Issue 2625783002: Explicitly compute analysis results for sources to check errors. (Closed)
Patch Set: Rollback await(ing) of assertErrors(). Format. 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/error_suppression_test.dart
diff --git a/pkg/analyzer/test/generated/error_suppression_test.dart b/pkg/analyzer/test/generated/error_suppression_test.dart
index 53a13c2aaa6fee03f4e17111a8a19388aae54901..62d525e9bd70bf93cb18011804d774354fd2cd64 100644
--- a/pkg/analyzer/test/generated/error_suppression_test.dart
+++ b/pkg/analyzer/test/generated/error_suppression_test.dart
@@ -23,7 +23,8 @@ class ErrorSuppressionTest extends ResolverTestCase {
int x = '';
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
- await assertErrors(source, [
+ await computeAnalysisResult(source);
+ assertErrors(source, [
StaticTypeWarningCode.INVALID_ASSIGNMENT,
CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]);
@@ -36,7 +37,8 @@ int x = '';
// ... but no ignore here ...
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
- await assertErrors(source,
+ await computeAnalysisResult(source);
+ assertErrors(source,
[CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
}
@@ -46,7 +48,8 @@ int x = ''; // ignore: invalid_assignment
// ... but no ignore here ...
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
- await assertErrors(source,
+ await computeAnalysisResult(source);
+ assertErrors(source,
[CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
}
@@ -54,7 +57,8 @@ const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
Source source = addSource('''
int x = ''; // ignore: invalid_assignment
''');
- await assertErrors(source, []);
+ await computeAnalysisResult(source);
+ assertErrors(source, []);
}
test_ignore_second() async {
@@ -64,7 +68,8 @@ int x = '';
// ignore: const_initialized_with_non_constant_value
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
- await assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
}
test_ignore_second_trailing() async {
@@ -73,14 +78,16 @@ const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
int x = '';
const y = x; // ignore: const_initialized_with_non_constant_value
''');
- await assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
}
test_ignore_upper_case() async {
Source source = addSource('''
int x = ''; // ignore: INVALID_ASSIGNMENT
''');
- await assertErrors(source, []);
+ await computeAnalysisResult(source);
+ assertErrors(source, []);
}
test_invalid_error_code() async {
@@ -89,7 +96,8 @@ int x = ''; // ignore: INVALID_ASSIGNMENT
int x = '';
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
- await assertErrors(source, [
+ await computeAnalysisResult(source);
+ assertErrors(source, [
StaticTypeWarningCode.INVALID_ASSIGNMENT,
CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]);
@@ -101,7 +109,8 @@ const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
// ignore:
const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
- await assertErrors(source, [
+ await computeAnalysisResult(source);
+ assertErrors(source, [
StaticTypeWarningCode.INVALID_ASSIGNMENT,
CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]);
@@ -112,7 +121,8 @@ const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VA
// ignore invalid_assignment
String y = 3; //INVALID_ASSIGNMENT
''');
- await assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
}
test_multiple_comments() async {
@@ -121,7 +131,8 @@ int x = ''; //This is the first comment...
// ignore: const_initialized_with_non_constant_value
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
- await assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
}
test_multiple_ignores() async {
@@ -130,7 +141,8 @@ int x = 3;
// ignore: invalid_assignment, const_initialized_with_non_constant_value
const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
- await assertErrors(source, []);
+ await computeAnalysisResult(source);
+ assertErrors(source, []);
}
test_multiple_ignores_traling() async {
@@ -138,7 +150,8 @@ const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VA
int x = 3;
const String y = x; // ignore: invalid_assignment, const_initialized_with_non_constant_value
''');
- await assertErrors(source, []);
+ await computeAnalysisResult(source);
+ assertErrors(source, []);
}
test_multiple_ignores_whitespace_variant_1() async {
@@ -147,7 +160,8 @@ int x = 3;
//ignore:invalid_assignment,const_initialized_with_non_constant_value
const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
- await assertErrors(source, []);
+ await computeAnalysisResult(source);
+ assertErrors(source, []);
}
test_multiple_ignores_whitespace_variant_2() async {
@@ -156,7 +170,8 @@ int x = 3;
//ignore: invalid_assignment,const_initialized_with_non_constant_value
const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
- await assertErrors(source, []);
+ await computeAnalysisResult(source);
+ assertErrors(source, []);
}
test_multiple_ignores_whitespace_variant_3() async {
@@ -165,7 +180,8 @@ int x = 3;
// ignore: invalid_assignment,const_initialized_with_non_constant_value
const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
- await assertErrors(source, []);
+ await computeAnalysisResult(source);
+ assertErrors(source, []);
}
test_no_ignores() async {
@@ -173,7 +189,8 @@ const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VA
int x = ''; //INVALID_ASSIGNMENT
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
- await assertErrors(source, [
+ await computeAnalysisResult(source);
+ assertErrors(source, [
StaticTypeWarningCode.INVALID_ASSIGNMENT,
CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]);
« no previous file with comments | « pkg/analyzer/test/generated/compile_time_error_code_test.dart ('k') | pkg/analyzer/test/generated/hint_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698