OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.test.src.task.dart_test; | 5 library analyzer.test.src.task.dart_test; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
9 import 'package:analyzer/dart/ast/token.dart'; | 9 import 'package:analyzer/dart/ast/token.dart'; |
10 import 'package:analyzer/dart/ast/visitor.dart'; | 10 import 'package:analyzer/dart/ast/visitor.dart'; |
(...skipping 4342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4353 expectMutated(body, main.parameters[2], true, true); | 4353 expectMutated(body, main.parameters[2], true, true); |
4354 expectMutated(body, main.parameters[3], true, true); | 4354 expectMutated(body, main.parameters[3], true, true); |
4355 } | 4355 } |
4356 } | 4356 } |
4357 | 4357 |
4358 @reflectiveTest | 4358 @reflectiveTest |
4359 class ScanDartTaskTest extends _AbstractDartTaskTest { | 4359 class ScanDartTaskTest extends _AbstractDartTaskTest { |
4360 test_ignore_info() { | 4360 test_ignore_info() { |
4361 _performScanTask(''' | 4361 _performScanTask(''' |
4362 //ignore: error_code | 4362 //ignore: error_code |
| 4363 //ignore_for_file: error_code |
4363 var x = ''; | 4364 var x = ''; |
4364 foo(); // ignore: error_code_2 | 4365 foo(); // ignore: error_code_2 |
4365 bar(); //ignore: error_code, error_code_2 | 4366 bar(); //ignore: error_code, error_code_2 |
| 4367 // ignore_for_file: error_code_2, error_code_3 |
4366 '''); | 4368 '''); |
4367 | 4369 |
4368 IgnoreInfo info = outputs[IGNORE_INFO]; | 4370 IgnoreInfo info = outputs[IGNORE_INFO]; |
4369 expect(info.ignores.keys, hasLength(3)); | 4371 expect(info.ignores.keys, hasLength(3)); |
4370 expect(info.ignores[1].first, 'error_code'); | 4372 expect(info.ignores[1].first, 'error_code'); |
4371 expect(info.ignores[3].first, 'error_code_2'); | 4373 expect(info.ignores[4].first, 'error_code_2'); |
4372 expect(info.ignores[4], unorderedEquals(['error_code', 'error_code_2'])); | 4374 expect(info.ignores[5], unorderedEquals(['error_code', 'error_code_2'])); |
| 4375 expect(info.ignoreForFiles, |
| 4376 unorderedEquals(['error_code', 'error_code_2', 'error_code_3'])); |
4373 } | 4377 } |
4374 | 4378 |
4375 test_perform_errors() { | 4379 test_perform_errors() { |
4376 _performScanTask('import "'); | 4380 _performScanTask('import "'); |
4377 expect(outputs, hasLength(4)); | 4381 expect(outputs, hasLength(4)); |
4378 expect(outputs[LINE_INFO], isNotNull); | 4382 expect(outputs[LINE_INFO], isNotNull); |
4379 expect(outputs[SCAN_ERRORS], hasLength(1)); | 4383 expect(outputs[SCAN_ERRORS], hasLength(1)); |
4380 expect(outputs[TOKEN_STREAM], isNotNull); | 4384 expect(outputs[TOKEN_STREAM], isNotNull); |
4381 IgnoreInfo ignoreInfo = outputs[IGNORE_INFO]; | 4385 IgnoreInfo ignoreInfo = outputs[IGNORE_INFO]; |
4382 expect(ignoreInfo, isNotNull); | 4386 expect(ignoreInfo, isNotNull); |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5275 /** | 5279 /** |
5276 * Fill [errorListener] with [result] errors in the current [task]. | 5280 * Fill [errorListener] with [result] errors in the current [task]. |
5277 */ | 5281 */ |
5278 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 5282 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
5279 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; | 5283 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; |
5280 expect(errors, isNotNull, reason: result.name); | 5284 expect(errors, isNotNull, reason: result.name); |
5281 errorListener = new GatheringErrorListener(); | 5285 errorListener = new GatheringErrorListener(); |
5282 errorListener.addAll(errors); | 5286 errorListener.addAll(errors); |
5283 } | 5287 } |
5284 } | 5288 } |
OLD | NEW |