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 9ddf64f703c739dd88b931dedf11ae6756dcbf87..8acf29f21c99282fc5651ae3cb94327cd94d89a6 100644 |
--- a/pkg/analyzer/test/src/context/builder_test.dart |
+++ b/pkg/analyzer/test/src/context/builder_test.dart |
@@ -6,18 +6,15 @@ 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/plugin/options.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:analyzer/src/plugin/options_plugin.dart'; |
import 'package:package_config/packages.dart'; |
import 'package:package_config/src/packages_impl.dart'; |
import 'package:path/path.dart' as path; |
-import 'package:plugin/src/plugin_impl.dart'; |
import 'package:test/test.dart'; |
import 'package:test_reflective_loader/test_reflective_loader.dart'; |
@@ -513,8 +510,7 @@ linter: |
- empty_constructor_bodies |
'''); |
- AnalysisContext context = AnalysisEngine.instance.createAnalysisContext(); |
- AnalysisOptions options = builder.getAnalysisOptions(context, path); |
+ AnalysisOptions options = builder.getAnalysisOptions(path); |
_expectEqualOptions(options, expected); |
} |
@@ -536,24 +532,8 @@ analyzer: |
enableSuperMixins : true |
'''); |
- AnalysisEngine engine = AnalysisEngine.instance; |
- OptionsPlugin plugin = engine.optionsPlugin; |
- plugin.registerExtensionPoints((_) {}); |
- try { |
- _TestOptionsProcessor processor = new _TestOptionsProcessor(); |
- processor.expectedOptions = <String, Object>{ |
- 'analyzer': { |
- 'language': {'enableSuperMixins': true} |
- } |
- }; |
- (plugin.optionsProcessorExtensionPoint as ExtensionPointImpl) |
- .add(processor); |
- AnalysisContext context = engine.createAnalysisContext(); |
- AnalysisOptions options = builder.getAnalysisOptions(context, path); |
- _expectEqualOptions(options, expected); |
- } finally { |
- plugin.registerExtensionPoints((_) {}); |
- } |
+ AnalysisOptions options = builder.getAnalysisOptions(path); |
+ _expectEqualOptions(options, expected); |
} |
void test_getAnalysisOptions_includes() { |
@@ -589,26 +569,8 @@ analyzer: |
enableSuperMixins : true |
'''); |
- AnalysisEngine engine = AnalysisEngine.instance; |
- OptionsPlugin plugin = engine.optionsPlugin; |
- plugin.registerExtensionPoints((_) {}); |
- try { |
- _TestOptionsProcessor processor = new _TestOptionsProcessor(); |
- processor.expectedOptions = <String, Object>{ |
- 'analyzer': { |
- 'language': {'enableSuperMixins': true} |
- }, |
- 'foo': {'bar': 'baz'}, |
- 'two': {'boo': 'newt'}, |
- }; |
- (plugin.optionsProcessorExtensionPoint as ExtensionPointImpl) |
- .add(processor); |
- AnalysisContext context = engine.createAnalysisContext(); |
- AnalysisOptions options = builder.getAnalysisOptions(context, path); |
- _expectEqualOptions(options, expected); |
- } finally { |
- plugin.registerExtensionPoints((_) {}); |
- } |
+ AnalysisOptions options = builder.getAnalysisOptions(path); |
+ _expectEqualOptions(options, expected); |
} |
void test_getAnalysisOptions_invalid() { |
@@ -617,20 +579,8 @@ analyzer: |
pathContext.join(path, AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE); |
resourceProvider.newFile(filePath, ';'); |
- AnalysisEngine engine = AnalysisEngine.instance; |
- OptionsPlugin plugin = engine.optionsPlugin; |
- plugin.registerExtensionPoints((_) {}); |
- try { |
- _TestOptionsProcessor processor = new _TestOptionsProcessor(); |
- (plugin.optionsProcessorExtensionPoint as ExtensionPointImpl) |
- .add(processor); |
- AnalysisContext context = engine.createAnalysisContext(); |
- AnalysisOptions options = builder.getAnalysisOptions(context, path); |
- expect(options, isNotNull); |
- expect(processor.errorCount, 1); |
- } finally { |
- plugin.registerExtensionPoints((_) {}); |
- } |
+ AnalysisOptions options = builder.getAnalysisOptions(path); |
+ expect(options, isNotNull); |
} |
void test_getAnalysisOptions_noDefault_noOverrides() { |
@@ -645,8 +595,7 @@ linter: |
- empty_constructor_bodies |
'''); |
- AnalysisContext context = AnalysisEngine.instance.createAnalysisContext(); |
- AnalysisOptions options = builder.getAnalysisOptions(context, path); |
+ AnalysisOptions options = builder.getAnalysisOptions(path); |
_expectEqualOptions(options, new AnalysisOptionsImpl()); |
} |
@@ -664,8 +613,7 @@ analyzer: |
enableSuperMixins : true |
'''); |
- AnalysisContext context = AnalysisEngine.instance.createAnalysisContext(); |
- AnalysisOptions options = builder.getAnalysisOptions(context, path); |
+ AnalysisOptions options = builder.getAnalysisOptions(path); |
_expectEqualOptions(options, expected); |
} |
@@ -783,27 +731,3 @@ class EmbedderYamlLocatorTest extends EmbedderRelatedTest { |
expect(locator.embedderYamls, hasLength(1)); |
} |
} |
- |
-class _TestOptionsProcessor implements OptionsProcessor { |
- Map<String, Object> expectedOptions = null; |
- |
- int errorCount = 0; |
- |
- @override |
- void onError(Exception exception) { |
- errorCount++; |
- } |
- |
- @override |
- void optionsProcessed(AnalysisContext context, Map<String, Object> options) { |
- if (expectedOptions == null) { |
- fail('Unexpected invocation of optionsProcessed'); |
- } |
- expect(options, hasLength(expectedOptions.length)); |
- for (String key in expectedOptions.keys) { |
- expect(options.containsKey(key), isTrue, reason: 'missing key $key'); |
- expect(options[key], expectedOptions[key], |
- reason: 'values for key $key do not match'); |
- } |
- } |
-} |