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

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

Issue 2625783002: Explicitly compute analysis results for sources to check errors. (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/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..f97dc4391006b588285cce8366bfd720c1c84a9e 100644
--- a/pkg/analyzer/test/generated/error_suppression_test.dart
+++ b/pkg/analyzer/test/generated/error_suppression_test.dart
@@ -23,6 +23,7 @@ class ErrorSuppressionTest extends ResolverTestCase {
int x = '';
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
+ await computeAnalysisResult(source);
await assertErrors(source, [
StaticTypeWarningCode.INVALID_ASSIGNMENT,
CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
@@ -36,6 +37,7 @@ int x = '';
// ... but no ignore here ...
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
+ await computeAnalysisResult(source);
await assertErrors(source,
[CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
}
@@ -46,6 +48,7 @@ int x = ''; // ignore: invalid_assignment
// ... but no ignore here ...
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
+ await computeAnalysisResult(source);
await assertErrors(source,
[CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
}
@@ -54,6 +57,7 @@ const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
Source source = addSource('''
int x = ''; // ignore: invalid_assignment
''');
+ await computeAnalysisResult(source);
await assertErrors(source, []);
}
@@ -64,6 +68,7 @@ int x = '';
// ignore: const_initialized_with_non_constant_value
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
+ await computeAnalysisResult(source);
await assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
}
@@ -73,6 +78,7 @@ const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
int x = '';
const y = x; // ignore: const_initialized_with_non_constant_value
''');
+ await computeAnalysisResult(source);
await assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
}
@@ -80,6 +86,7 @@ const y = x; // ignore: const_initialized_with_non_constant_value
Source source = addSource('''
int x = ''; // ignore: INVALID_ASSIGNMENT
''');
+ await computeAnalysisResult(source);
await assertErrors(source, []);
}
@@ -89,6 +96,7 @@ int x = ''; // ignore: INVALID_ASSIGNMENT
int x = '';
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
+ await computeAnalysisResult(source);
await assertErrors(source, [
StaticTypeWarningCode.INVALID_ASSIGNMENT,
CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
@@ -101,6 +109,7 @@ const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
// ignore:
const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
+ await computeAnalysisResult(source);
await assertErrors(source, [
StaticTypeWarningCode.INVALID_ASSIGNMENT,
CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
@@ -112,6 +121,7 @@ const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VA
// ignore invalid_assignment
String y = 3; //INVALID_ASSIGNMENT
''');
+ await computeAnalysisResult(source);
await assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
}
@@ -121,6 +131,7 @@ int x = ''; //This is the first comment...
// ignore: const_initialized_with_non_constant_value
const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
''');
+ await computeAnalysisResult(source);
await assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
}
@@ -130,6 +141,7 @@ 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 computeAnalysisResult(source);
await assertErrors(source, []);
}
@@ -138,6 +150,7 @@ 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 computeAnalysisResult(source);
await assertErrors(source, []);
}
@@ -147,6 +160,7 @@ 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 computeAnalysisResult(source);
await assertErrors(source, []);
}
@@ -156,6 +170,7 @@ 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 computeAnalysisResult(source);
await assertErrors(source, []);
}
@@ -165,6 +180,7 @@ 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 computeAnalysisResult(source);
await assertErrors(source, []);
}
@@ -173,6 +189,7 @@ 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 computeAnalysisResult(source);
await assertErrors(source, [
StaticTypeWarningCode.INVALID_ASSIGNMENT,
CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE

Powered by Google App Engine
This is Rietveld 408576698