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

Unified Diff: pkg/analyzer/test/src/context/builder_test.dart

Issue 2598523003: cmdline flags override analysis options in file (Closed)
Patch Set: address comments Created 4 years 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/context/builder_test.dart
diff --git a/pkg/analyzer/test/src/context/builder_test.dart b/pkg/analyzer/test/src/context/builder_test.dart
index c2eb6ceb3d9ba4bb5c33e080ef1e729833b5dee7..4569f8e0c1ac3c05cdef8047c8cf44b6273f4902 100644
--- a/pkg/analyzer/test/src/context/builder_test.dart
+++ b/pkg/analyzer/test/src/context/builder_test.dart
@@ -6,12 +6,14 @@ library analyzer.test.src.context.context_builder_test;
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/memory_file_system.dart';
+import 'package:analyzer/src/command_line/arguments.dart';
import 'package:analyzer/src/context/builder.dart';
import 'package:analyzer/src/context/source.dart';
import 'package:analyzer/src/generated/bazel.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source.dart';
+import 'package:args/args.dart';
import 'package:package_config/packages.dart';
import 'package:package_config/src/packages_impl.dart';
import 'package:path/path.dart' as path;
@@ -110,6 +112,33 @@ const Map<String, LibraryInfo> libraries = const {
fail('Incomplete test');
}
+ void test_cmdline_options_override_options_file() {
+ ArgParser argParser = new ArgParser();
+ defineAnalysisArguments(argParser);
+ ArgResults argResults = argParser.parse(['--$enableStrictCallChecksFlag']);
+ var builder = new ContextBuilder(resourceProvider, sdkManager, contentCache,
+ options: createContextBuilderOptions(argResults));
+
+ AnalysisOptionsImpl expected = new AnalysisOptionsImpl();
+ expected.enableSuperMixins = true;
+ expected.enableStrictCallChecks = true;
+
+ String path = resourceProvider.convertPath('/some/directory/path');
+ String filePath =
+ pathContext.join(path, AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE);
+ resourceProvider.newFile(
+ filePath,
+ '''
+analyzer:
+ language:
+ enableSuperMixins : true
+ enableStrictCallChecks : false
+''');
+
+ AnalysisOptions options = builder.getAnalysisOptions(path);
+ _expectEqualOptions(options, expected);
+ }
+
void test_convertPackagesToMap_noPackages() {
expect(builder.convertPackagesToMap(Packages.noPackages), isEmpty);
}
« 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