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

Unified Diff: pkg/analysis_server/test/context_manager_test.dart

Issue 2511963002: remove support for analyzer configuration in pubspec (Closed)
Patch Set: merge Created 4 years, 1 month 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/analysis_server/lib/src/context_manager.dart ('k') | pkg/analyzer/lib/source/config.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/context_manager_test.dart
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart
index c9de9d9fc2907642927a01c72eb792d408a5caf3..103978857563ce26d936506693c964956fdac77e 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -1992,217 +1992,6 @@ linter:
// No error means success.
}
- test_configed_options() async {
- // Create files.
- String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
- newFile([projPath, 'test', 'test.dart']);
- newFile(
- [projPath, 'pubspec.yaml'],
- r'''
-dependencies:
- test_pack: any
-analyzer:
- configuration: test_pack/config
-''');
-
- // Setup .packages file
- newFile(
- [projPath, '.packages'],
- r'''
-test_pack:lib/''');
-
- // Setup config.yaml.
- newFile(
- [libPath, 'config', 'config.yaml'],
- r'''
-analyzer:
- strong-mode: true
- language:
- enableSuperMixins: true
- errors:
- missing_return: false
-linter:
- rules:
- - avoid_as
-''');
-
- // Setup analysis options
- newFile(
- [projPath, optionsFileName],
- r'''
-analyzer:
- exclude:
- - 'test/**'
- language:
- enableGenericMethods: true
- errors:
- unused_local_variable: false
-linter:
- rules:
- - camel_case_types
-''');
-
- // Setup context.
- manager.setRoots(<String>[projPath], <String>[], <String, String>{});
- await pumpEventQueue();
-
- // Confirm that one context was created.
- var contexts =
- manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
- expect(contexts, isNotNull);
- expect(contexts, hasLength(1));
-
- var context = contexts.first;
-
- // Verify options.
- // * from `config.yaml`:
- expect(context.analysisOptions.strongMode, isTrue);
- expect(context.analysisOptions.enableSuperMixins, isTrue);
- // * from analysis options:
- expect(context.analysisOptions.enableGenericMethods, isTrue);
-
- // * verify tests are excluded
- expect(callbacks.currentContextFilePaths[projPath].keys,
- unorderedEquals(['/my/proj/$optionsFileName']));
-
- // Verify filter setup.
- expect(errorProcessors, hasLength(2));
-
- // * (config.)
- expect(getProcessor(missing_return).severity, isNull);
-
- // * (options.)
- expect(getProcessor(unused_local_variable).severity, isNull);
-
- // Verify lints.
- var lintNames = lints.map((lint) => lint.name);
- expect(
- lintNames,
- unorderedEquals(
- ['avoid_as' /* config */, 'camel_case_types' /* options */]));
- }
-
- test_embedder_and_configed_options() async {
- // Create files.
- String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
- String sdkExtPath = newFolder([projPath, 'sdk_ext']);
- newFile([projPath, 'test', 'test.dart']);
- newFile([sdkExtPath, 'entry.dart']);
-
- // Setup pubspec with configuration.
- newFile(
- [projPath, 'pubspec.yaml'],
- r'''
-dependencies:
- test_pack: any
-analyzer:
- configuration: test_pack/config
-''');
-
- // Setup _embedder.yaml.
- newFile(
- [libPath, '_embedder.yaml'],
- r'''
-embedded_libs:
- "dart:foobar": "../sdk_ext/entry.dart"
-analyzer:
- strong-mode: true
- language:
- enableSuperMixins: true
- errors:
- missing_return: false
-linter:
- rules:
- - avoid_as
-''');
-
- // Setup .packages file
- newFile(
- [projPath, '.packages'],
- r'''
-test_pack:lib/''');
-
- // Setup analysis options
- newFile(
- [projPath, optionsFileName],
- r'''
-analyzer:
- exclude:
- - 'test/**'
- language:
- enableGenericMethods: true
- errors:
- unused_local_variable: false
-linter:
- rules:
- - camel_case_types
-''');
-
- // Setup config.yaml.
- newFile(
- [libPath, 'config', 'config.yaml'],
- r'''
-analyzer:
- errors:
- missing_required_param: error
-linter:
- rules:
- - always_specify_types
-''');
-
- // Setup context.
- manager.setRoots(<String>[projPath], <String>[], <String, String>{});
- await pumpEventQueue();
-
- // Confirm that one context was created.
- var contexts =
- manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
- expect(contexts, isNotNull);
- expect(contexts, hasLength(1));
- var context = contexts[0];
-
- // Verify options.
- // * from `_embedder.yaml`:
- expect(context.analysisOptions.strongMode, isTrue);
- expect(context.analysisOptions.enableSuperMixins, isTrue);
- // * from analysis options:
- expect(context.analysisOptions.enableGenericMethods, isTrue);
-
- // * verify tests are excluded
- expect(
- callbacks.currentContextFilePaths[projPath].keys,
- unorderedEquals(
- ['/my/proj/sdk_ext/entry.dart', '/my/proj/$optionsFileName']));
-
- // Verify filter setup.
- expect(errorProcessors, hasLength(3));
-
- // * (embedder.)
- expect(getProcessor(missing_return).severity, isNull);
-
- // * (config.)
- expect(getProcessor(missing_required_param).severity, ErrorSeverity.ERROR);
-
- // * (options.)
- expect(getProcessor(unused_local_variable).severity, isNull);
-
- // Verify lints.
- var lintNames = lints.map((lint) => lint.name);
-
- expect(
- lintNames,
- unorderedEquals([
- 'avoid_as' /* embedder */,
- 'always_specify_types' /* config*/,
- 'camel_case_types' /* options */
- ]));
-
- // Sanity check embedder libs.
- var source = context.sourceFactory.forUri('dart:foobar');
- expect(source, isNotNull);
- expect(source.fullName, '/my/proj/sdk_ext/entry.dart');
- }
-
test_embedder_options() async {
// Create files.
String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analyzer/lib/source/config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698