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

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

Issue 1372173004: Ignore added files in hidden directories. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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') | 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 c4524fa5f5b698260daaadedae12d2c9a145b30b..2742fcf29d0ddf280f6839adf968f8923d02779f 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -954,6 +954,19 @@ test_pack:lib/
expect(result, same(source));
}
+ void test_setRoots_pathContainsDotFile() {
+ // If the path to a file (relative to the context root) contains a folder
+ // whose name begins with '.', then the file is ignored.
+ String project = '/project';
+ String fileA = '$project/foo.dart';
+ String fileB = '$project/.pub/bar.dart';
+ resourceProvider.newFile(fileA, '');
+ resourceProvider.newFile(fileB, '');
+ manager.setRoots(<String>[project], <String>[], <String, String>{});
+ callbacks.assertContextPaths([project]);
+ callbacks.assertContextFiles(project, [fileA]);
+ }
+
void test_setRoots_removeFolderWithoutPubspec() {
packageMapProvider.packageMap = null;
// add one root - there is a context
@@ -1077,6 +1090,18 @@ test_pack:lib/
_checkPackageMap(projPath, equals(packageMapProvider.packageMap));
}
+ void test_setRoots_rootPathContainsDotFile() {
+ // If the path to the context root itself contains a folder whose name
+ // begins with '.', then that is not sufficient to cause any files in the
+ // context to be ignored.
+ String project = '/.pub/project';
+ String fileA = '$project/foo.dart';
+ resourceProvider.newFile(fileA, '');
+ manager.setRoots(<String>[project], <String>[], <String, String>{});
+ callbacks.assertContextPaths([project]);
+ callbacks.assertContextFiles(project, [fileA]);
+ }
+
test_watch_addDummyLink() {
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
// empty folder initially
@@ -1127,6 +1152,38 @@ test_pack:lib/
});
}
+ test_watch_addFile_pathContainsDotFile() async {
+ // If a file is added and the path to it (relative to the context root)
+ // contains a folder whose name begins with '.', then the file is ignored.
+ String project = '/project';
+ String fileA = '$project/foo.dart';
+ String fileB = '$project/.pub/bar.dart';
+ resourceProvider.newFile(fileA, '');
+ manager.setRoots(<String>[project], <String>[], <String, String>{});
+ callbacks.assertContextPaths([project]);
+ callbacks.assertContextFiles(project, [fileA]);
+ resourceProvider.newFile(fileB, '');
+ await pumpEventQueue();
+ callbacks.assertContextPaths([project]);
+ callbacks.assertContextFiles(project, [fileA]);
+ }
+
+ test_watch_addFile_rootPathContainsDotFile() async {
+ // If a file is added and the path to the context contains a folder whose
+ // name begins with '.', then the file is not ignored.
+ String project = '/.pub/project';
+ String fileA = '$project/foo.dart';
+ String fileB = '$project/bar/baz.dart';
+ resourceProvider.newFile(fileA, '');
+ manager.setRoots(<String>[project], <String>[], <String, String>{});
+ callbacks.assertContextPaths([project]);
+ callbacks.assertContextFiles(project, [fileA]);
+ resourceProvider.newFile(fileB, '');
+ await pumpEventQueue();
+ callbacks.assertContextPaths([project]);
+ callbacks.assertContextFiles(project, [fileA, fileB]);
+ }
+
test_watch_addFileInSubfolder() {
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
// empty folder initially
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698