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

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

Issue 2888953002: Analyzer: add ignore_for_file comment that ignores a type of problem for the whole file; add tests. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 62d525e9bd70bf93cb18011804d774354fd2cd64..ec43f49335dce2b10ec9c7071c63392c9e11894f 100644
--- a/pkg/analyzer/test/generated/error_suppression_test.dart
+++ b/pkg/analyzer/test/generated/error_suppression_test.dart
@@ -195,4 +195,35 @@ const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
]);
}
+
+ test_ignore_for_file() async {
+ Source source = addSource('''
+int x = ''; //INVALID_ASSIGNMENT
+const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// ignore_for_file: invalid_assignment
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source,
+ [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
+ }
+
+ test_multiple_ignore_for_files() async {
+ Source source = addSource('''
+int x = ''; //INVALID_ASSIGNMENT
+const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+// ignore_for_file: invalid_assignment,const_initialized_with_non_constant_value
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, []);
+ }
+
+ test_ignore_for_file_whitespace_variant() async {
+ Source source = addSource('''
+//ignore_for_file: const_initialized_with_non_constant_value , invalid_assignment
+int x = ''; //INVALID_ASSIGNMENT
+const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, []);
+ }
}
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698