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

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

Issue 1266923004: More fixes for failures on the Windows bot (Closed) Base URL: https://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/test/completion_test.dart ('k') | pkg/analysis_server/test/domain_analysis_test.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 d81f338c4cb78ddb9bc87e4b5e8968f5c89d9e9b..d8cc6196a4598f9badd2572e09cfc6e9c7048aa0 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -19,9 +19,10 @@ import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'package:unittest/unittest.dart';
import 'mocks.dart';
+import 'utils.dart';
main() {
- groupSep = ' | ';
+ initializeTestEnvironment();
defineReflectiveTests(AbstractContextManagerTest);
}
@@ -96,10 +97,11 @@ class AbstractContextManagerTest {
}
void test_contextsInAnalysisRoot_nestedContext() {
- String subProjPath = join(projPath, 'subproj');
+ String subProjPath = posix.join(projPath, 'subproj');
Folder subProjFolder = resourceProvider.newFolder(subProjPath);
- resourceProvider.newFile(join(subProjPath, 'pubspec.yaml'), 'contents');
- String subProjFilePath = join(subProjPath, 'file.dart');
+ resourceProvider.newFile(
+ posix.join(subProjPath, 'pubspec.yaml'), 'contents');
+ String subProjFilePath = posix.join(subProjPath, 'file.dart');
resourceProvider.newFile(subProjFilePath, 'contents');
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
// Make sure that there really are contexts for both the main project and
@@ -151,10 +153,11 @@ class AbstractContextManagerTest {
}
void test_isInAnalysisRoot_inNestedContext() {
- String subProjPath = join(projPath, 'subproj');
+ String subProjPath = posix.join(projPath, 'subproj');
Folder subProjFolder = resourceProvider.newFolder(subProjPath);
- resourceProvider.newFile(join(subProjPath, 'pubspec.yaml'), 'contents');
- String subProjFilePath = join(subProjPath, 'file.dart');
+ resourceProvider.newFile(
+ posix.join(subProjPath, 'pubspec.yaml'), 'contents');
+ String subProjFilePath = posix.join(subProjPath, 'file.dart');
resourceProvider.newFile(subProjFilePath, 'contents');
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
// Make sure that there really is a context for the subproject.
@@ -214,7 +217,9 @@ class AbstractContextManagerTest {
String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
newFile([sdkExtSrcPath, 'part.dart']);
// Setup analysis options file with ignore list.
- newFile([projPath, '.analysis_options'], r'''
+ newFile(
+ [projPath, '.analysis_options'],
+ r'''
analyzer:
exclude:
- lib/nope.dart
@@ -235,17 +240,23 @@ analyzer:
// Create files.
String libPath = newFolder([projPath, LIB_NAME]);
newFile([libPath, 'main.dart']);
- newFile([libPath, 'pubspec.yaml'], r'''
+ newFile(
+ [libPath, 'pubspec.yaml'],
+ r'''
name: foobar
''');
String otherLibPath = newFolder([projPath, 'other_lib']);
newFile([otherLibPath, 'entry.dart']);
- newFile([otherLibPath, 'pubspec.yaml'], r'''
+ 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'''
+ newFile(
+ [projPath, '.analysis_options'],
+ r'''
analyzer:
exclude:
- 'other_lib'
@@ -254,68 +265,80 @@ analyzer:
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));
+ 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 {
+ 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
-''');
+ 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
-''');
+ 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'''
+ // and all descendants.
+ newFile(
+ [projPath, '.analysis_options'],
+ r'''
analyzer:
exclude:
- - 'other_lib/*'
-''');
+ - '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));
+ 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 {
+ 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
- ''');
+ 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
- ''');
+ 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'''
+ // and all immediate children.
+ newFile(
+ [projPath, '.analysis_options'],
+ r'''
analyzer:
exclude:
- - 'other_lib/**'
- ''');
+ - '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));
+ 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'));
@@ -474,8 +497,9 @@ analyzer:
newFile([examplePath, ContextManagerImpl.PACKAGE_SPEC_NAME]);
newFile([examplePath, 'example.dart']);
- packageMapProvider.packageMap['proj'] =
- [resourceProvider.getResource(libPath)];
+ packageMapProvider.packageMap['proj'] = [
+ resourceProvider.getResource(libPath)
+ ];
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
@@ -502,8 +526,9 @@ analyzer:
newFile([examplePath, ContextManagerImpl.PUBSPEC_NAME]);
newFile([examplePath, 'example.dart']);
- packageMapProvider.packageMap['proj'] =
- [resourceProvider.getResource(libPath)];
+ packageMapProvider.packageMap['proj'] = [
+ resourceProvider.getResource(libPath)
+ ];
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
@@ -587,8 +612,9 @@ analyzer:
newFile([srcPath, 'internal.dart']);
String testFilePath = newFile([testPath, 'main_test.dart']);
- packageMapProvider.packageMap['proj'] =
- [resourceProvider.getResource(libPath)];
+ packageMapProvider.packageMap['proj'] = [
+ resourceProvider.getResource(libPath)
+ ];
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
Set<Source> sources = callbacks.currentContextSources[projPath];
@@ -647,8 +673,12 @@ analyzer:
resourceProvider.newFile(subProjectB_file, 'library b;');
// configure package maps
packageMapProvider.packageMaps = {
- subProjectA: {'foo': [resourceProvider.newFolder('/package/foo')]},
- subProjectB: {'bar': [resourceProvider.newFolder('/package/bar')]},
+ subProjectA: {
+ 'foo': [resourceProvider.newFolder('/package/foo')]
+ },
+ subProjectB: {
+ 'bar': [resourceProvider.newFolder('/package/bar')]
+ },
};
// set roots
manager.setRoots(<String>[root], <String>[], <String, String>{});
@@ -669,14 +699,15 @@ analyzer:
String packagePathFoo = '/package1/foo';
String packageRootPath = '/package2/foo';
Folder packageFolder = resourceProvider.newFolder(packagePathFoo);
- packageMapProvider.packageMap = {'foo': [packageFolder]};
+ packageMapProvider.packageMap = {
+ 'foo': [packageFolder]
+ };
List<String> includedPaths = <String>[projPath];
List<String> excludedPaths = <String>[];
manager.setRoots(includedPaths, excludedPaths, <String, String>{});
_checkPackageMap(projPath, equals(packageMapProvider.packageMap));
- manager.setRoots(includedPaths, excludedPaths, <String, String>{
- projPath: packageRootPath
- });
+ manager.setRoots(includedPaths, excludedPaths,
+ <String, String>{projPath: packageRootPath});
_checkPackageRoot(projPath, equals(packageRootPath));
}
@@ -685,13 +716,11 @@ analyzer:
String packageRootPath2 = '/package2';
List<String> includedPaths = <String>[projPath];
List<String> excludedPaths = <String>[];
- manager.setRoots(includedPaths, excludedPaths, <String, String>{
- projPath: packageRootPath1
- });
+ manager.setRoots(includedPaths, excludedPaths,
+ <String, String>{projPath: packageRootPath1});
_checkPackageRoot(projPath, equals(packageRootPath1));
- manager.setRoots(includedPaths, excludedPaths, <String, String>{
- projPath: packageRootPath2
- });
+ manager.setRoots(includedPaths, excludedPaths,
+ <String, String>{projPath: packageRootPath2});
_checkPackageRoot(projPath, equals(packageRootPath2));
}
@@ -821,16 +850,17 @@ analyzer:
void test_setRoots_newFolderWithPackageRoot() {
String packageRootPath = '/package';
- manager.setRoots(<String>[projPath], <String>[], <String, String>{
- projPath: packageRootPath
- });
+ manager.setRoots(<String>[projPath], <String>[],
+ <String, String>{projPath: packageRootPath});
_checkPackageRoot(projPath, equals(packageRootPath));
}
void test_setRoots_newlyAddedFoldersGetProperPackageMap() {
String packagePath = '/package/foo';
Folder packageFolder = resourceProvider.newFolder(packagePath);
- packageMapProvider.packageMap = {'foo': [packageFolder]};
+ packageMapProvider.packageMap = {
+ 'foo': [packageFolder]
+ };
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
_checkPackageMap(projPath, equals(packageMapProvider.packageMap));
}
@@ -963,12 +993,13 @@ analyzer:
String packagePathFoo = '/package1/foo';
String packageRootPath = '/package2/foo';
Folder packageFolder = resourceProvider.newFolder(packagePathFoo);
- packageMapProvider.packageMap = {'foo': [packageFolder]};
+ packageMapProvider.packageMap = {
+ 'foo': [packageFolder]
+ };
List<String> includedPaths = <String>[projPath];
List<String> excludedPaths = <String>[];
- manager.setRoots(includedPaths, excludedPaths, <String, String>{
- projPath: packageRootPath
- });
+ manager.setRoots(includedPaths, excludedPaths,
+ <String, String>{projPath: packageRootPath});
_checkPackageRoot(projPath, equals(packageRootPath));
manager.setRoots(includedPaths, excludedPaths, <String, String>{});
_checkPackageMap(projPath, equals(packageMapProvider.packageMap));
@@ -1511,8 +1542,8 @@ class TestContextManagerCallbacks extends ContextManagerCallbacks {
* A map from the paths of contexts to a set of the sources that should be
* explicitly analyzed in those contexts.
*/
- final Map<String, Set<Source>> currentContextSources = <String, Set<Source>>{
- };
+ final Map<String, Set<Source>> currentContextSources =
+ <String, Set<Source>>{};
/**
* Map from context to folder disposition.
« no previous file with comments | « pkg/analysis_server/test/completion_test.dart ('k') | pkg/analysis_server/test/domain_analysis_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698