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

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

Issue 1748763002: Move shouldFileBeAnalyzed into ContextManager (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/analysis_server/test/analysis_server_test.dart ('k') | no next file » | 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 b43e501d07d001e3972fdebb67257d695ed88c9c..334f7e296276bc890d5fc82bef81047caf249e2c 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -18,6 +18,7 @@ import 'package:analyzer/src/generated/java_io.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/source_io.dart';
import 'package:analyzer/src/services/lint.dart';
+import 'package:analyzer/src/util/glob.dart';
import 'package:linter/src/plugin/linter_plugin.dart';
import 'package:linter/src/rules/avoid_as.dart';
import 'package:package_config/packages.dart';
@@ -92,6 +93,18 @@ class AbstractContextManagerTest {
['x']
]);
+ List<Glob> get analysisFilesGlobs {
+ List<String> patterns = <String>[
+ '**/*.${AnalysisEngine.SUFFIX_DART}',
+ '**/*.${AnalysisEngine.SUFFIX_HTML}',
+ '**/*.${AnalysisEngine.SUFFIX_HTM}',
+ '**/${AnalysisEngine.ANALYSIS_OPTIONS_FILE}'
+ ];
+ return patterns
+ .map((pattern) => new Glob(JavaFile.pathContext.separator, pattern))
+ .toList();
+ }
+
List<ErrorProcessor> get errorProcessors => callbacks.currentContext
.getConfigurationData(CONFIGURED_ERROR_PROCESSORS);
@@ -142,6 +155,7 @@ class AbstractContextManagerTest {
providePackageResolver,
provideEmbeddedUriResolver,
packageMapProvider,
+ analysisFilesGlobs,
InstrumentationService.NULL_SERVICE,
new AnalysisOptionsImpl());
callbacks = new TestContextManagerCallbacks(resourceProvider);
@@ -404,8 +418,10 @@ linter:
// * from `.analysis_options`:
expect(context.analysisOptions.enableGenericMethods, isTrue);
// * verify tests are excluded
- expect(callbacks.currentContextFilePaths[projPath].keys,
- ['/my/proj/sdk_ext/entry.dart']);
+ expect(
+ callbacks.currentContextFilePaths[projPath].keys,
+ unorderedEquals(
+ ['/my/proj/sdk_ext/entry.dart', '/my/proj/.analysis_options']));
// Verify filter setup.
expect(errorProcessors, hasLength(2));
@@ -657,8 +673,10 @@ analyzer:
callbacks.currentContextFilePaths[projPath];
expect(fileTimestamps, isNotEmpty);
List<String> files = fileTimestamps.keys.toList();
- expect(files.length, equals(1));
- expect(files[0], equals('/my/proj/lib/main.dart'));
+ expect(
+ files,
+ unorderedEquals(
+ ['/my/proj/lib/main.dart', '/my/proj/.analysis_options']));
}
test_path_filter_child_contexts_option() async {
@@ -2437,20 +2455,6 @@ class TestContextManagerCallbacks extends ContextManagerCallbacks {
}
@override
- bool shouldFileBeAnalyzed(File file) {
- if (!(AnalysisEngine.isDartFileName(file.path) ||
- AnalysisEngine.isHtmlFileName(file.path))) {
- return false;
- }
- // Emacs creates dummy links to track the fact that a file is open for
- // editing and has unsaved changes (e.g. having unsaved changes to
- // 'foo.dart' causes a link '.#foo.dart' to be created, which points to the
- // non-existent file 'username@hostname.pid'. To avoid these dummy links
- // causing the analyzer to thrash, just ignore links to non-existent files.
- return file.exists;
- }
-
- @override
void updateContextPackageUriResolver(
Folder contextFolder, FolderDisposition disposition) {
currentContextDispositions[contextFolder.path] = disposition;
« no previous file with comments | « pkg/analysis_server/test/analysis_server_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698