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

Side by Side 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 unified diff | 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 »
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/error/codes.dart'; 5 import 'package:analyzer/src/error/codes.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 import 'package:test_reflective_loader/test_reflective_loader.dart'; 8 import 'package:test_reflective_loader/test_reflective_loader.dart';
9 9
10 import 'resolver_test_case.dart'; 10 import 'resolver_test_case.dart';
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 Source source = addSource(''' 188 Source source = addSource('''
189 int x = ''; //INVALID_ASSIGNMENT 189 int x = ''; //INVALID_ASSIGNMENT
190 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE 190 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
191 '''); 191 ''');
192 await computeAnalysisResult(source); 192 await computeAnalysisResult(source);
193 assertErrors(source, [ 193 assertErrors(source, [
194 StaticTypeWarningCode.INVALID_ASSIGNMENT, 194 StaticTypeWarningCode.INVALID_ASSIGNMENT,
195 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE 195 CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
196 ]); 196 ]);
197 } 197 }
198
199 test_ignore_for_file() async {
200 Source source = addSource('''
201 int x = ''; //INVALID_ASSIGNMENT
202 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
203 // ignore_for_file: invalid_assignment
204 ''');
205 await computeAnalysisResult(source);
206 assertErrors(source,
207 [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
208 }
209
210 test_multiple_ignore_for_files() async {
211 Source source = addSource('''
212 int x = ''; //INVALID_ASSIGNMENT
213 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
214 // ignore_for_file: invalid_assignment,const_initialized_with_non_constant_value
215 ''');
216 await computeAnalysisResult(source);
217 assertErrors(source, []);
218 }
219
220 test_ignore_for_file_whitespace_variant() async {
221 Source source = addSource('''
222 //ignore_for_file: const_initialized_with_non_constant_value , invalid_assignm ent
223 int x = ''; //INVALID_ASSIGNMENT
224 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
225 ''');
226 await computeAnalysisResult(source);
227 assertErrors(source, []);
228 }
198 } 229 }
OLDNEW
« 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