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

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

Issue 2993323002: Add a hint to rename .analysis_options files. (Closed)
Patch Set: and hint to global list Created 3 years, 4 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/lib/src/task/options.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 d88e099257ea832d886fd0ddd6d211c6c47b08dd..fd5060ee78e0acff2e09dc44628ab64642ac7c3e 100644
--- a/pkg/analyzer/test/src/task/options_test.dart
+++ b/pkg/analyzer/test/src/task/options_test.dart
@@ -296,19 +296,44 @@ class ErrorCodeValuesTest {
}
@reflectiveTest
-class GenerateNewOptionsErrorsTaskTest extends GenerateOptionsErrorsTaskTest {
- String get optionsFilePath => '/${AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE}';
-}
+class GenerateOldOptionsErrorsTaskTest extends AbstractContextTest {
+ final AnalysisOptionsProvider optionsProvider = new AnalysisOptionsProvider();
-@reflectiveTest
-class GenerateOldOptionsErrorsTaskTest extends GenerateOptionsErrorsTaskTest {
String get optionsFilePath => '/${AnalysisEngine.ANALYSIS_OPTIONS_FILE}';
+
+ test_does_analyze_old_options_files() {
+ validate('''
+analyzer:
+ strong-mode: true
+ ''', [AnalysisOptionsHintCode.DEPRECATED_ANALYSIS_OPTIONS_FILE_NAME]);
+ }
+
+ test_finds_issues_in_old_options_files() {
+ validate('''
+analyzer:
+ strong_mode: true
+ ''', [
+ AnalysisOptionsHintCode.DEPRECATED_ANALYSIS_OPTIONS_FILE_NAME,
+ AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUES
+ ]);
+ }
+
+ void validate(String content, List<ErrorCode> expected) {
+ final Source source = newSource(optionsFilePath, content);
+ var options = optionsProvider.getOptionsFromSource(source);
+ final OptionsFileValidator validator = new OptionsFileValidator(source);
+ var errors = validator.validate(options);
+ expect(errors.map((AnalysisError e) => e.errorCode),
+ unorderedEquals(expected));
+ }
}
-abstract class GenerateOptionsErrorsTaskTest extends AbstractContextTest {
+@reflectiveTest
+class GenerateNewOptionsErrorsTaskTest extends AbstractContextTest {
Source source;
- String get optionsFilePath;
+ String get optionsFilePath => '/${AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE}';
+
LineInfo lineInfo(String source) =>
GenerateOptionsErrorsTask.computeLineInfo(source);
« no previous file with comments | « pkg/analyzer/lib/src/task/options.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698