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

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

Issue 1913113002: Support ignores at end of line (#26181). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« pkg/analyzer/lib/src/task/dart.dart ('K') | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | 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 c77bb3d3c48a5c967df3f67c652c7ba12b7f58c8..275e94ccc54468a5fdb35f8bda42547aaf2687eb 100644
--- a/pkg/analyzer/test/generated/error_suppression_test.dart
+++ b/pkg/analyzer/test/generated/error_suppression_test.dart
@@ -42,6 +42,25 @@ const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
[CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
}
+ void test_ignore_first_trailing() {
+ Source source = addSource('''
+int x = ''; // ignore: invalid_assignment
+// ... but no ignore here ...
+const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source,
+ [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
+ }
+
+ void test_ignore_only_trailing() {
+ Source source = addSource('''
+int x = ''; // ignore: invalid_assignment
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, []);
+ }
+
void test_ignore_second() {
Source source = addSource('''
//INVALID_ASSIGNMENT
@@ -53,6 +72,16 @@ const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
}
+ void test_ignore_second_trailing() {
+ Source source = addSource('''
+//INVALID_ASSIGNMENT
+int x = '';
+const y = x; // ignore: const_initialized_with_non_constant_value
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
+ }
+
void test_invalid_error_code() {
Source source = addSource('''
// ignore: right_format_wrong_code
@@ -108,6 +137,15 @@ const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VA
assertErrors(source, []);
}
+ void test_multiple_ignores_traling() {
+ Source source = addSource('''
+int x = 3;
+const String y = x; // ignore: invalid_assignment, const_initialized_with_non_constant_value
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, []);
+ }
+
void test_multiple_ignores_whitespace_variant_1() {
Source source = addSource('''
int x = 3;
« pkg/analyzer/lib/src/task/dart.dart ('K') | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698