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

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

Issue 2654043003: add warning for deprecated .analysis_options file name (Closed)
Patch Set: merge Created 3 years, 11 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 01ece33608643fadae7691a6e386fc36020cf415..98e022b5bbbaab73273ddd6db4bd148d6e4df5fd 100644
--- a/pkg/analyzer/test/src/task/options_test.dart
+++ b/pkg/analyzer/test/src/task/options_test.dart
@@ -143,18 +143,23 @@ analyzer:
@reflectiveTest
class GenerateNewOptionsErrorsTaskTest extends GenerateOptionsErrorsTaskTest {
+ bool get isOptionsFileDeprecated => false;
String get optionsFilePath => '/${AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE}';
}
@reflectiveTest
class GenerateOldOptionsErrorsTaskTest extends GenerateOptionsErrorsTaskTest {
+ bool get isOptionsFileDeprecated => true;
String get optionsFilePath => '/${AnalysisEngine.ANALYSIS_OPTIONS_FILE}';
}
abstract class GenerateOptionsErrorsTaskTest extends AbstractContextTest {
Source source;
+ bool get isOptionsFileDeprecated;
+
String get optionsFilePath;
+
LineInfo lineInfo(String source) =>
GenerateOptionsErrorsTask.computeLineInfo(source);
@@ -211,6 +216,29 @@ abstract class GenerateOptionsErrorsTaskTest extends AbstractContextTest {
expect(descriptor, isNotNull);
}
+ @override
+ void computeResult(AnalysisTarget target, ResultDescriptor result,
+ {isInstanceOf matcher: null}) {
+ super.computeResult(target, result, matcher: matcher);
+ if (isOptionsFileDeprecated) {
+ bool found = false;
+ var errors = outputs[ANALYSIS_OPTIONS_ERRORS] as List<dynamic>;
+ for (var error in errors) {
+ if (error is AnalysisError &&
+ error.errorCode ==
+ AnalysisOptionsWarningCode
+ .DEPRECATED_ANALYSIS_OPTIONS_FILE_NAME) {
+ errors.remove(error);
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ fail('Expected deprecated analysis options file name warning');
+ }
+ }
+ }
+
test_perform_bad_yaml() {
String code = r'''
:
« 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