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

Unified Diff: pkg/analysis_server/test/integration/analysis/lint_test.dart

Issue 1975963002: Support the name analysis_options.yaml for analysis options files (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/integration/analysis/lint_test.dart
diff --git a/pkg/analysis_server/test/integration/analysis/lint_test.dart b/pkg/analysis_server/test/integration/analysis/lint_test.dart
index e75120c9618f4311cf2316cac1bf39ddfda98e3a..a1cfeb6c1eab779f5fc3184a03c8ac4c6b4bcb84 100644
--- a/pkg/analysis_server/test/integration/analysis/lint_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/lint_test.dart
@@ -5,6 +5,7 @@
library test.integration.analysis.lint;
import 'package:analysis_server/plugin/protocol/protocol.dart';
+import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'package:unittest/unittest.dart';
@@ -29,14 +30,43 @@ class abc { // lint: not CamelCase (should get ignored though)
await analysisFinished;
expect(currentAnalysisErrors[source], isList);
- // Should be empty without .analysis_options.
+ // Should be empty without an analysis options file.
List<AnalysisError> errors = currentAnalysisErrors[source];
expect(errors, hasLength(0));
}
- test_simple_lint() async {
+ test_simple_lint_newOptionsFile() async {
writeFile(
- sourcePath('.analysis_options'),
+ sourcePath(AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE),
+ '''
+linter:
+ rules:
+ - camel_case_types
+''');
+
+ String source = sourcePath('test.dart');
+ writeFile(
+ source,
+ '''
+class a { // lint: not CamelCase
+}''');
+
+ standardAnalysisSetup();
+
+ await analysisFinished;
+
+ expect(currentAnalysisErrors[source], isList);
+ List<AnalysisError> errors = currentAnalysisErrors[source];
+ expect(errors, hasLength(1));
+ AnalysisError error = errors[0];
+ expect(error.location.file, source);
+ expect(error.severity, AnalysisErrorSeverity.INFO);
+ expect(error.type, AnalysisErrorType.LINT);
+ }
+
+ test_simple_lint_oldOptionsFile() async {
+ writeFile(
+ sourcePath(AnalysisEngine.ANALYSIS_OPTIONS_FILE),
'''
linter:
rules:

Powered by Google App Engine
This is Rietveld 408576698