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

Unified Diff: pkg/analyzer/test/src/task/options_test.dart

Issue 1411053003: Error code validation for error filters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Name tweaks. Created 5 years, 2 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/test/generated/all_the_rest_test.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/src/task/options_test.dart
diff --git a/pkg/analyzer/test/src/task/options_test.dart b/pkg/analyzer/test/src/task/options_test.dart
index 764dfeefde0eec6dafb567b22962bdd430830881..869b6385e70e9bdb99593cd0517c1032ab0e2943 100644
--- a/pkg/analyzer/test/src/task/options_test.dart
+++ b/pkg/analyzer/test/src/task/options_test.dart
@@ -125,9 +125,12 @@ analyzer:
expect(task, isGenerateOptionsErrorsTask);
List<AnalysisError> errors = outputs[ANALYSIS_OPTIONS_ERRORS];
expect(errors, hasLength(1));
- expect(errors[0].errorCode, AnalysisOptionsWarningCode.UNSUPPORTED_OPTION);
- expect(errors[0].message,
- "The option 'not_supported' is not supported by analyzer");
+ expect(errors[0].errorCode,
+ AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUES);
+ expect(
+ errors[0].message,
+ "The option 'not_supported' is not supported by analyzer, "
+ "supported values are 'errors', 'exclude', 'plugins' and 'strong-mode'");
}
}
@@ -137,22 +140,42 @@ class OptionsFileValidatorTest {
new OptionsFileValidator(new TestSource());
final AnalysisOptionsProvider optionsProvider = new AnalysisOptionsProvider();
- test_analyzer_supported_exclude() {
+ test_analyzer_error_code_supported() {
validate(
'''
analyzer:
- exclude:
- - test/_data/p4/lib/lib1.dart
+ errors:
+ unused_local_variable: ignore
''',
[]);
}
- test_analyzer_supported_filter() {
+ test_analyzer_error_code_supported_bad_value() {
validate(
'''
analyzer:
errors:
- unused_local_variable: ignore
+ unused_local_variable: ftw
+ ''',
+ [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUES]);
+ }
+
+ test_analyzer_error_code_unsupported() {
+ validate(
+ '''
+analyzer:
+ errors:
+ not_supported: ignore
+ ''',
+ [AnalysisOptionsWarningCode.UNRECOGNIZED_ERROR_CODE]);
+ }
+
+ test_analyzer_supported_exclude() {
+ validate(
+ '''
+analyzer:
+ exclude:
+ - test/_data/p4/lib/lib1.dart
''',
[]);
}
@@ -172,7 +195,7 @@ analyzer:
analyzer:
not_supported: true
''',
- [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION]);
+ [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUES]);
}
test_linter_supported_rules() {
@@ -191,7 +214,7 @@ linter:
linter:
unsupported: true
''',
- [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION]);
+ [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE]);
}
void validate(String source, List<AnalysisOptionsErrorCode> expected) {
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698