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 0eecd2875cd2e4a31af15328029fb25f9d159ac1..b7a60e172e72694e7439961bd795e9f8bf632d9b 100644 |
--- a/pkg/analysis_server/test/context_manager_test.dart |
+++ b/pkg/analysis_server/test/context_manager_test.dart |
@@ -9,6 +9,7 @@ import 'dart:collection'; |
import 'package:analysis_server/src/context_manager.dart'; |
import 'package:analyzer/file_system/file_system.dart'; |
import 'package:analyzer/file_system/memory_file_system.dart'; |
+import 'package:analyzer/instrumentation/instrumentation.dart'; |
import 'package:analyzer/source/package_map_provider.dart'; |
import 'package:analyzer/source/package_map_resolver.dart'; |
import 'package:analyzer/src/generated/engine.dart'; |
@@ -189,6 +190,15 @@ class ContextManagerTest { |
expect(filePaths, isEmpty); |
} |
+ void test_setRoots_addFolderWithoutPubspec() { |
+ packageMapProvider.packageMap = null; |
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
+ // verify |
+ expect(manager.currentContextPaths, hasLength(1)); |
+ expect(manager.currentContextPaths, contains(projPath)); |
+ expect(manager.currentContextFilePaths[projPath], hasLength(0)); |
+ } |
+ |
void test_setRoots_addFolderWithPubspec() { |
String pubspecPath = posix.join(projPath, 'pubspec.yaml'); |
resourceProvider.newFile(pubspecPath, 'pubspec'); |
@@ -268,15 +278,6 @@ class ContextManagerTest { |
equals(packageMapProvider.packageMaps[subProjectB])); |
} |
- void test_setRoots_addFolderWithoutPubspec() { |
- packageMapProvider.packageMap = null; |
- manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
- // verify |
- expect(manager.currentContextPaths, hasLength(1)); |
- expect(manager.currentContextPaths, contains(projPath)); |
- expect(manager.currentContextFilePaths[projPath], hasLength(0)); |
- } |
- |
void test_setRoots_addPackageRoot() { |
String packagePathFoo = '/package1/foo'; |
String packageRootPath = '/package2/foo'; |
@@ -471,6 +472,17 @@ class ContextManagerTest { |
_checkPackageMap(projPath, equals(packageMapProvider.packageMap)); |
} |
+ void test_setRoots_removeFolderWithoutPubspec() { |
+ packageMapProvider.packageMap = null; |
+ // add one root - there is a context |
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
+ expect(manager.currentContextPaths, hasLength(1)); |
+ // set empty roots - no contexts |
+ manager.setRoots(<String>[], <String>[], <String, String>{}); |
+ expect(manager.currentContextPaths, hasLength(0)); |
+ expect(manager.currentContextFilePaths, hasLength(0)); |
+ } |
+ |
void test_setRoots_removeFolderWithPubspec() { |
// create a pubspec |
String pubspecPath = posix.join(projPath, 'pubspec.yaml'); |
@@ -520,17 +532,6 @@ class ContextManagerTest { |
manager.assertContextFiles(subProjectA, [subProjectA_file]); |
} |
- void test_setRoots_removeFolderWithoutPubspec() { |
- packageMapProvider.packageMap = null; |
- // add one root - there is a context |
- manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
- expect(manager.currentContextPaths, hasLength(1)); |
- // set empty roots - no contexts |
- manager.setRoots(<String>[], <String>[], <String, String>{}); |
- expect(manager.currentContextPaths, hasLength(0)); |
- expect(manager.currentContextFilePaths, hasLength(0)); |
- } |
- |
void test_setRoots_removePackageRoot() { |
String packagePathFoo = '/package1/foo'; |
String packageRootPath = '/package2/foo'; |
@@ -577,21 +578,6 @@ class ContextManagerTest { |
}); |
} |
- test_watch_addFileInSubfolder() { |
- manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
- // empty folder initially |
- Map<String, int> filePaths = manager.currentContextFilePaths[projPath]; |
- expect(filePaths, hasLength(0)); |
- // add file in subfolder |
- String filePath = posix.join(projPath, 'foo', 'bar.dart'); |
- resourceProvider.newFile(filePath, 'contents'); |
- // the file was added |
- return pumpEventQueue().then((_) { |
- expect(filePaths, hasLength(1)); |
- expect(filePaths, contains(filePath)); |
- }); |
- } |
- |
test_watch_addFile_excluded() { |
// prepare paths |
String project = '/project'; |
@@ -613,6 +599,21 @@ class ContextManagerTest { |
}); |
} |
+ test_watch_addFileInSubfolder() { |
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
+ // empty folder initially |
+ Map<String, int> filePaths = manager.currentContextFilePaths[projPath]; |
+ expect(filePaths, hasLength(0)); |
+ // add file in subfolder |
+ String filePath = posix.join(projPath, 'foo', 'bar.dart'); |
+ resourceProvider.newFile(filePath, 'contents'); |
+ // the file was added |
+ return pumpEventQueue().then((_) { |
+ expect(filePaths, hasLength(1)); |
+ expect(filePaths, contains(filePath)); |
+ }); |
+ } |
+ |
test_watch_addPubspec_toRoot() { |
// prepare paths |
String root = '/root'; |
@@ -869,7 +870,10 @@ class TestContextManager extends ContextManager { |
TestContextManager(MemoryResourceProvider resourceProvider, |
PackageMapProvider packageMapProvider) |
- : super(resourceProvider, packageMapProvider); |
+ : super( |
+ resourceProvider, |
+ packageMapProvider, |
+ InstrumentationService.NULL_SERVICE); |
/** |
* Iterable of the paths to contexts that currently exist. |