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

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

Issue 1263443005: Make exclude list also exclude contexts (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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/lib/src/context_manager.dart ('k') | pkg/analyzer/lib/source/path_filter.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 b8f2b6c6455531b9781a8256c1237c960141fc4e..d81f338c4cb78ddb9bc87e4b5e8968f5c89d9e9b 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -231,6 +231,96 @@ analyzer:
expect(files[0], equals('/my/proj/lib/main.dart'));
}
+ test_path_filter_child_contexts_option() async {
+ // Create files.
+ String libPath = newFolder([projPath, LIB_NAME]);
+ newFile([libPath, 'main.dart']);
+ newFile([libPath, 'pubspec.yaml'], r'''
+name: foobar
+''');
+ String otherLibPath = newFolder([projPath, 'other_lib']);
+ newFile([otherLibPath, 'entry.dart']);
+ newFile([otherLibPath, 'pubspec.yaml'], r'''
+name: other_lib
+''');
+ // Setup analysis options file with ignore list that ignores the 'other_lib'
+ // directory by name.
+ newFile([projPath, '.analysis_options'], r'''
+analyzer:
+ exclude:
+ - 'other_lib'
+''');
+ // Setup context.
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+ // Verify that the context in other_lib wasn't created and that the
+ // context in lib was created.
+ var contexts = manager.contextsInAnalysisRoot(
+ resourceProvider.newFolder(projPath));
+ expect(contexts.length, 2);
+ expect(contexts[0].name, equals('/my/proj'));
+ expect(contexts[1].name, equals('/my/proj/lib'));
+ }
+
+ test_path_filter_wildcard_child_contexts_option() async {
+ // Create files.
+ String libPath = newFolder([projPath, LIB_NAME]);
+ newFile([libPath, 'main.dart']);
+ newFile([libPath, 'pubspec.yaml'], r'''
+name: foobar
+''');
+ String otherLibPath = newFolder([projPath, 'other_lib']);
+ newFile([otherLibPath, 'entry.dart']);
+ newFile([otherLibPath, 'pubspec.yaml'], r'''
+name: other_lib
+''');
+ // Setup analysis options file with ignore list that ignores 'other_lib'
+ // and all immediate children.
+ newFile([projPath, '.analysis_options'], r'''
+analyzer:
+ exclude:
+ - 'other_lib/*'
+''');
+ // Setup context.
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+ // Verify that the context in other_lib wasn't created and that the
+ // context in lib was created.
+ var contexts = manager.contextsInAnalysisRoot(
+ resourceProvider.newFolder(projPath));
+ expect(contexts.length, 2);
+ expect(contexts[0].name, equals('/my/proj'));
+ expect(contexts[1].name, equals('/my/proj/lib'));
+ }
+
+ test_path_filter_recursive_wildcard_child_contexts_option() async {
+ // Create files.
+ String libPath = newFolder([projPath, LIB_NAME]);
+ newFile([libPath, 'main.dart']);
+ newFile([libPath, 'pubspec.yaml'], r'''
+ name: foobar
+ ''');
+ String otherLibPath = newFolder([projPath, 'other_lib']);
+ newFile([otherLibPath, 'entry.dart']);
+ newFile([otherLibPath, 'pubspec.yaml'], r'''
+ name: other_lib
+ ''');
+ // Setup analysis options file with ignore list that ignores 'other_lib'
+ // and all descendants.
+ newFile([projPath, '.analysis_options'], r'''
+analyzer:
+ exclude:
+ - 'other_lib/**'
+ ''');
+ // Setup context.
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+ // Verify that the context in other_lib wasn't created and that the
+ // context in lib was created.
+ var contexts = manager.contextsInAnalysisRoot(
+ resourceProvider.newFolder(projPath));
+ expect(contexts.length, 2);
+ expect(contexts[0].name, equals('/my/proj'));
+ expect(contexts[1].name, equals('/my/proj/lib'));
+ }
+
test_refresh_folder_with_packagespec() {
// create a context with a .packages file
String packagespecFile = posix.join(projPath, '.packages');
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analyzer/lib/source/path_filter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698