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

Side by Side Diff: pkg/analyzer/test/generated/error_suppression_test.dart

Issue 2070553002: Fix "ignore:" handling with upper case error codes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:analyzer/src/generated/error.dart'; 5 import 'package:analyzer/src/generated/error.dart';
6 import 'package:analyzer/src/generated/source.dart'; 6 import 'package:analyzer/src/generated/source.dart';
7 import 'package:analyzer/src/generated/source_io.dart'; 7 import 'package:analyzer/src/generated/source_io.dart';
8 8
9 import '../reflective_tests.dart'; 9 import '../reflective_tests.dart';
10 import '../utils.dart'; 10 import '../utils.dart';
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void test_ignore_second_trailing() { 75 void test_ignore_second_trailing() {
76 Source source = addSource(''' 76 Source source = addSource('''
77 //INVALID_ASSIGNMENT 77 //INVALID_ASSIGNMENT
78 int x = ''; 78 int x = '';
79 const y = x; // ignore: const_initialized_with_non_constant_value 79 const y = x; // ignore: const_initialized_with_non_constant_value
80 '''); 80 ''');
81 computeLibrarySourceErrors(source); 81 computeLibrarySourceErrors(source);
82 assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]); 82 assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
83 } 83 }
84 84
85 void test_ignore_upper_case() {
86 Source source = addSource('''
87 int x = ''; // ignore: INVALID_ASSIGNMENT
88 ''');
89 computeLibrarySourceErrors(source);
90 assertErrors(source, []);
91 }
92
85 void test_invalid_error_code() { 93 void test_invalid_error_code() {
86 Source source = addSource(''' 94 Source source = addSource('''
87 // ignore: right_format_wrong_code 95 // ignore: right_format_wrong_code
88 int x = ''; 96 int x = '';
89 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE 97 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
90 '''); 98 ''');
91 computeLibrarySourceErrors(source); 99 computeLibrarySourceErrors(source);
92 assertErrors(source, [ 100 assertErrors(source, [
93 StaticTypeWarningCode.INVALID_ASSIGNMENT, 101 StaticTypeWarningCode.INVALID_ASSIGNMENT,
94 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE 102 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 int x = ''; //INVALID_ASSIGNMENT 189 int x = ''; //INVALID_ASSIGNMENT
182 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE 190 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
183 '''); 191 ''');
184 computeLibrarySourceErrors(source); 192 computeLibrarySourceErrors(source);
185 assertErrors(source, [ 193 assertErrors(source, [
186 StaticTypeWarningCode.INVALID_ASSIGNMENT, 194 StaticTypeWarningCode.INVALID_ASSIGNMENT,
187 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE 195 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
188 ]); 196 ]);
189 } 197 }
190 } 198 }
OLDNEW
« no previous file with comments | « 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