mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 22:01:19 +00:00
Use an import prefix in the analysis server tests; this fixes some issues conflicting with the
'equals' symbol in the 1.4.0 version of package:path. BUG= R=scheglov@google.com Review URL: https://codereview.chromium.org/2518873002 .
This commit is contained in:
parent
f7334bef35
commit
f16a0a2a4d
|
@ -11,7 +11,6 @@ import 'package:analyzer/error/error.dart';
|
||||||
import 'package:analyzer/file_system/file_system.dart';
|
import 'package:analyzer/file_system/file_system.dart';
|
||||||
import 'package:analyzer/file_system/memory_file_system.dart';
|
import 'package:analyzer/file_system/memory_file_system.dart';
|
||||||
import 'package:analyzer/instrumentation/instrumentation.dart';
|
import 'package:analyzer/instrumentation/instrumentation.dart';
|
||||||
import 'package:analyzer/source/analysis_options_provider.dart';
|
|
||||||
import 'package:analyzer/source/error_processor.dart';
|
import 'package:analyzer/source/error_processor.dart';
|
||||||
import 'package:analyzer/src/context/builder.dart';
|
import 'package:analyzer/src/context/builder.dart';
|
||||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||||
|
@ -26,7 +25,7 @@ import 'package:analyzer/src/task/options.dart'
|
||||||
import 'package:analyzer/src/util/glob.dart';
|
import 'package:analyzer/src/util/glob.dart';
|
||||||
import 'package:linter/src/plugin/linter_plugin.dart';
|
import 'package:linter/src/plugin/linter_plugin.dart';
|
||||||
import 'package:linter/src/rules/avoid_as.dart';
|
import 'package:linter/src/rules/avoid_as.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart' as path;
|
||||||
import 'package:plugin/manager.dart';
|
import 'package:plugin/manager.dart';
|
||||||
import 'package:plugin/plugin.dart';
|
import 'package:plugin/plugin.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
@ -46,11 +45,11 @@ main() {
|
||||||
@reflectiveTest
|
@reflectiveTest
|
||||||
class AbstractContextManagerTest extends ContextManagerTest {
|
class AbstractContextManagerTest extends ContextManagerTest {
|
||||||
void test_contextsInAnalysisRoot_nestedContext() {
|
void test_contextsInAnalysisRoot_nestedContext() {
|
||||||
String subProjPath = posix.join(projPath, 'subproj');
|
String subProjPath = path.posix.join(projPath, 'subproj');
|
||||||
Folder subProjFolder = resourceProvider.newFolder(subProjPath);
|
Folder subProjFolder = resourceProvider.newFolder(subProjPath);
|
||||||
resourceProvider.newFile(
|
resourceProvider.newFile(
|
||||||
posix.join(subProjPath, 'pubspec.yaml'), 'contents');
|
path.posix.join(subProjPath, 'pubspec.yaml'), 'contents');
|
||||||
String subProjFilePath = posix.join(subProjPath, 'file.dart');
|
String subProjFilePath = path.posix.join(subProjPath, 'file.dart');
|
||||||
resourceProvider.newFile(subProjFilePath, 'contents');
|
resourceProvider.newFile(subProjFilePath, 'contents');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
// Make sure that there really are contexts for both the main project and
|
// Make sure that there really are contexts for both the main project and
|
||||||
|
@ -168,16 +167,16 @@ test_pack:lib/''');
|
||||||
|
|
||||||
test_ignoreFilesInPackagesFolder() {
|
test_ignoreFilesInPackagesFolder() {
|
||||||
// create a context with a pubspec.yaml file
|
// create a context with a pubspec.yaml file
|
||||||
String pubspecPath = posix.join(projPath, 'pubspec.yaml');
|
String pubspecPath = path.posix.join(projPath, 'pubspec.yaml');
|
||||||
resourceProvider.newFile(pubspecPath, 'pubspec');
|
resourceProvider.newFile(pubspecPath, 'pubspec');
|
||||||
// create a file in the "packages" folder
|
// create a file in the "packages" folder
|
||||||
String filePath1 = posix.join(projPath, 'packages', 'file1.dart');
|
String filePath1 = path.posix.join(projPath, 'packages', 'file1.dart');
|
||||||
resourceProvider.newFile(filePath1, 'contents');
|
resourceProvider.newFile(filePath1, 'contents');
|
||||||
// "packages" files are ignored initially
|
// "packages" files are ignored initially
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
expect(callbacks.currentContextFilePaths[projPath], isEmpty);
|
expect(callbacks.currentContextFilePaths[projPath], isEmpty);
|
||||||
// "packages" files are ignored during watch
|
// "packages" files are ignored during watch
|
||||||
String filePath2 = posix.join(projPath, 'packages', 'file2.dart');
|
String filePath2 = path.posix.join(projPath, 'packages', 'file2.dart');
|
||||||
resourceProvider.newFile(filePath2, 'contents');
|
resourceProvider.newFile(filePath2, 'contents');
|
||||||
return pumpEventQueue().then((_) {
|
return pumpEventQueue().then((_) {
|
||||||
expect(callbacks.currentContextFilePaths[projPath], isEmpty);
|
expect(callbacks.currentContextFilePaths[projPath], isEmpty);
|
||||||
|
@ -198,11 +197,11 @@ test_pack:lib/''');
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_isInAnalysisRoot_inNestedContext() {
|
void test_isInAnalysisRoot_inNestedContext() {
|
||||||
String subProjPath = posix.join(projPath, 'subproj');
|
String subProjPath = path.posix.join(projPath, 'subproj');
|
||||||
Folder subProjFolder = resourceProvider.newFolder(subProjPath);
|
Folder subProjFolder = resourceProvider.newFolder(subProjPath);
|
||||||
resourceProvider.newFile(
|
resourceProvider.newFile(
|
||||||
posix.join(subProjPath, 'pubspec.yaml'), 'contents');
|
path.posix.join(subProjPath, 'pubspec.yaml'), 'contents');
|
||||||
String subProjFilePath = posix.join(subProjPath, 'file.dart');
|
String subProjFilePath = path.posix.join(subProjPath, 'file.dart');
|
||||||
resourceProvider.newFile(subProjFilePath, 'contents');
|
resourceProvider.newFile(subProjFilePath, 'contents');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
// Make sure that there really is a context for the subproject.
|
// Make sure that there really is a context for the subproject.
|
||||||
|
@ -254,7 +253,7 @@ test_pack:lib/''');
|
||||||
|
|
||||||
test_refresh_folder_with_packagespec() {
|
test_refresh_folder_with_packagespec() {
|
||||||
// create a context with a .packages file
|
// create a context with a .packages file
|
||||||
String packagespecFile = posix.join(projPath, '.packages');
|
String packagespecFile = path.posix.join(projPath, '.packages');
|
||||||
resourceProvider.newFile(packagespecFile, '');
|
resourceProvider.newFile(packagespecFile, '');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
return pumpEventQueue().then((_) {
|
return pumpEventQueue().then((_) {
|
||||||
|
@ -274,10 +273,10 @@ test_pack:lib/''');
|
||||||
test_refresh_folder_with_packagespec_subfolders() {
|
test_refresh_folder_with_packagespec_subfolders() {
|
||||||
// Create a folder with no .packages file, containing two subfolders with
|
// Create a folder with no .packages file, containing two subfolders with
|
||||||
// .packages files.
|
// .packages files.
|
||||||
String subdir1Path = posix.join(projPath, 'subdir1');
|
String subdir1Path = path.posix.join(projPath, 'subdir1');
|
||||||
String subdir2Path = posix.join(projPath, 'subdir2');
|
String subdir2Path = path.posix.join(projPath, 'subdir2');
|
||||||
String packagespec1Path = posix.join(subdir1Path, '.packages');
|
String packagespec1Path = path.posix.join(subdir1Path, '.packages');
|
||||||
String packagespec2Path = posix.join(subdir2Path, '.packages');
|
String packagespec2Path = path.posix.join(subdir2Path, '.packages');
|
||||||
resourceProvider.newFile(packagespec1Path, '');
|
resourceProvider.newFile(packagespec1Path, '');
|
||||||
resourceProvider.newFile(packagespec2Path, '');
|
resourceProvider.newFile(packagespec2Path, '');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
|
@ -298,7 +297,7 @@ test_pack:lib/''');
|
||||||
|
|
||||||
test_refresh_folder_with_pubspec() {
|
test_refresh_folder_with_pubspec() {
|
||||||
// create a context with a pubspec.yaml file
|
// create a context with a pubspec.yaml file
|
||||||
String pubspecPath = posix.join(projPath, 'pubspec.yaml');
|
String pubspecPath = path.posix.join(projPath, 'pubspec.yaml');
|
||||||
resourceProvider.newFile(pubspecPath, 'pubspec');
|
resourceProvider.newFile(pubspecPath, 'pubspec');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
return pumpEventQueue().then((_) {
|
return pumpEventQueue().then((_) {
|
||||||
|
@ -315,10 +314,10 @@ test_pack:lib/''');
|
||||||
test_refresh_folder_with_pubspec_subfolders() {
|
test_refresh_folder_with_pubspec_subfolders() {
|
||||||
// Create a folder with no pubspec.yaml, containing two subfolders with
|
// Create a folder with no pubspec.yaml, containing two subfolders with
|
||||||
// pubspec.yaml files.
|
// pubspec.yaml files.
|
||||||
String subdir1Path = posix.join(projPath, 'subdir1');
|
String subdir1Path = path.posix.join(projPath, 'subdir1');
|
||||||
String subdir2Path = posix.join(projPath, 'subdir2');
|
String subdir2Path = path.posix.join(projPath, 'subdir2');
|
||||||
String pubspec1Path = posix.join(subdir1Path, 'pubspec.yaml');
|
String pubspec1Path = path.posix.join(subdir1Path, 'pubspec.yaml');
|
||||||
String pubspec2Path = posix.join(subdir2Path, 'pubspec.yaml');
|
String pubspec2Path = path.posix.join(subdir2Path, 'pubspec.yaml');
|
||||||
resourceProvider.newFile(pubspec1Path, 'pubspec');
|
resourceProvider.newFile(pubspec1Path, 'pubspec');
|
||||||
resourceProvider.newFile(pubspec2Path, 'pubspec');
|
resourceProvider.newFile(pubspec2Path, 'pubspec');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
|
@ -339,12 +338,12 @@ test_pack:lib/''');
|
||||||
|
|
||||||
test_refresh_oneContext() {
|
test_refresh_oneContext() {
|
||||||
// create two contexts with pubspec.yaml files
|
// create two contexts with pubspec.yaml files
|
||||||
String pubspecPath = posix.join(projPath, 'pubspec.yaml');
|
String pubspecPath = path.posix.join(projPath, 'pubspec.yaml');
|
||||||
resourceProvider.newFile(pubspecPath, 'pubspec1');
|
resourceProvider.newFile(pubspecPath, 'pubspec1');
|
||||||
|
|
||||||
String proj2Path = '/my/proj2';
|
String proj2Path = '/my/proj2';
|
||||||
resourceProvider.newFolder(proj2Path);
|
resourceProvider.newFolder(proj2Path);
|
||||||
String pubspec2Path = posix.join(proj2Path, 'pubspec.yaml');
|
String pubspec2Path = path.posix.join(proj2Path, 'pubspec.yaml');
|
||||||
resourceProvider.newFile(pubspec2Path, 'pubspec2');
|
resourceProvider.newFile(pubspec2Path, 'pubspec2');
|
||||||
|
|
||||||
List<String> roots = <String>[projPath, proj2Path];
|
List<String> roots = <String>[projPath, proj2Path];
|
||||||
|
@ -397,7 +396,7 @@ test_pack:lib/''');
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_setRoots_addFolderWithDartFile() {
|
void test_setRoots_addFolderWithDartFile() {
|
||||||
String filePath = posix.join(projPath, 'foo.dart');
|
String filePath = path.posix.join(projPath, 'foo.dart');
|
||||||
resourceProvider.newFile(filePath, 'contents');
|
resourceProvider.newFile(filePath, 'contents');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
// verify
|
// verify
|
||||||
|
@ -415,7 +414,7 @@ test_pack:lib/''');
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_setRoots_addFolderWithDartFileInSubfolder() {
|
void test_setRoots_addFolderWithDartFileInSubfolder() {
|
||||||
String filePath = posix.join(projPath, 'foo', 'bar.dart');
|
String filePath = path.posix.join(projPath, 'foo', 'bar.dart');
|
||||||
resourceProvider.newFile(filePath, 'contents');
|
resourceProvider.newFile(filePath, 'contents');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
// verify
|
// verify
|
||||||
|
@ -425,7 +424,7 @@ test_pack:lib/''');
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_setRoots_addFolderWithDummyLink() {
|
void test_setRoots_addFolderWithDummyLink() {
|
||||||
String filePath = posix.join(projPath, 'foo.dart');
|
String filePath = path.posix.join(projPath, 'foo.dart');
|
||||||
resourceProvider.newDummyLink(filePath);
|
resourceProvider.newDummyLink(filePath);
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
// verify
|
// verify
|
||||||
|
@ -498,12 +497,12 @@ test_pack:lib/''');
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_setRoots_addFolderWithPackagespec() {
|
void test_setRoots_addFolderWithPackagespec() {
|
||||||
String packagespecPath = posix.join(projPath, '.packages');
|
String packagespecPath = path.posix.join(projPath, '.packages');
|
||||||
resourceProvider.newFile(packagespecPath,
|
resourceProvider.newFile(packagespecPath,
|
||||||
'unittest:file:///home/somebody/.pub/cache/unittest-0.9.9/lib/');
|
'unittest:file:///home/somebody/.pub/cache/unittest-0.9.9/lib/');
|
||||||
String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
|
String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
|
||||||
File mainFile =
|
File mainFile =
|
||||||
resourceProvider.newFile(posix.join(libPath, 'main.dart'), '');
|
resourceProvider.newFile(path.posix.join(libPath, 'main.dart'), '');
|
||||||
Source source = mainFile.createSource();
|
Source source = mainFile.createSource();
|
||||||
|
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
|
@ -524,7 +523,7 @@ test_pack:lib/''');
|
||||||
|
|
||||||
void test_setRoots_addFolderWithPackagespecAndPackageRoot() {
|
void test_setRoots_addFolderWithPackagespecAndPackageRoot() {
|
||||||
// The package root should take priority.
|
// The package root should take priority.
|
||||||
String packagespecPath = posix.join(projPath, '.packages');
|
String packagespecPath = path.posix.join(projPath, '.packages');
|
||||||
resourceProvider.newFile(packagespecPath,
|
resourceProvider.newFile(packagespecPath,
|
||||||
'unittest:file:///home/somebody/.pub/cache/unittest-0.9.9/lib/');
|
'unittest:file:///home/somebody/.pub/cache/unittest-0.9.9/lib/');
|
||||||
String packageRootPath = '/package/root/';
|
String packageRootPath = '/package/root/';
|
||||||
|
@ -536,7 +535,7 @@ test_pack:lib/''');
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_setRoots_addFolderWithPubspec() {
|
void test_setRoots_addFolderWithPubspec() {
|
||||||
String pubspecPath = posix.join(projPath, 'pubspec.yaml');
|
String pubspecPath = path.posix.join(projPath, 'pubspec.yaml');
|
||||||
resourceProvider.newFile(pubspecPath, 'pubspec');
|
resourceProvider.newFile(pubspecPath, 'pubspec');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
// verify
|
// verify
|
||||||
|
@ -546,8 +545,8 @@ test_pack:lib/''');
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_setRoots_addFolderWithPubspec_andPackagespec() {
|
void test_setRoots_addFolderWithPubspec_andPackagespec() {
|
||||||
String pubspecPath = posix.join(projPath, 'pubspec.yaml');
|
String pubspecPath = path.posix.join(projPath, 'pubspec.yaml');
|
||||||
String packagespecPath = posix.join(projPath, '.packages');
|
String packagespecPath = path.posix.join(projPath, '.packages');
|
||||||
resourceProvider.newFile(pubspecPath, 'pubspec');
|
resourceProvider.newFile(pubspecPath, 'pubspec');
|
||||||
resourceProvider.newFile(packagespecPath, '');
|
resourceProvider.newFile(packagespecPath, '');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
|
@ -932,7 +931,7 @@ test_pack:lib/''');
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_setRoots_noContext_inDotFolder() {
|
void test_setRoots_noContext_inDotFolder() {
|
||||||
String pubspecPath = posix.join(projPath, '.pub', 'pubspec.yaml');
|
String pubspecPath = path.posix.join(projPath, '.pub', 'pubspec.yaml');
|
||||||
resourceProvider.newFile(pubspecPath, 'name: test');
|
resourceProvider.newFile(pubspecPath, 'name: test');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
// verify
|
// verify
|
||||||
|
@ -942,7 +941,7 @@ test_pack:lib/''');
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_setRoots_noContext_inPackagesFolder() {
|
void test_setRoots_noContext_inPackagesFolder() {
|
||||||
String pubspecPath = posix.join(projPath, 'packages', 'pubspec.yaml');
|
String pubspecPath = path.posix.join(projPath, 'packages', 'pubspec.yaml');
|
||||||
resourceProvider.newFile(pubspecPath, 'name: test');
|
resourceProvider.newFile(pubspecPath, 'name: test');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
// verify
|
// verify
|
||||||
|
@ -952,7 +951,7 @@ test_pack:lib/''');
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_setRoots_packageResolver() {
|
void test_setRoots_packageResolver() {
|
||||||
String filePath = posix.join(projPath, 'lib', 'foo.dart');
|
String filePath = path.posix.join(projPath, 'lib', 'foo.dart');
|
||||||
newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME], 'foo:lib/');
|
newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME], 'foo:lib/');
|
||||||
resourceProvider.newFile(filePath, 'contents');
|
resourceProvider.newFile(filePath, 'contents');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
|
@ -992,7 +991,7 @@ test_pack:lib/''');
|
||||||
|
|
||||||
void test_setRoots_removeFolderWithPackagespec() {
|
void test_setRoots_removeFolderWithPackagespec() {
|
||||||
// create a pubspec
|
// create a pubspec
|
||||||
String pubspecPath = posix.join(projPath, '.packages');
|
String pubspecPath = path.posix.join(projPath, '.packages');
|
||||||
resourceProvider.newFile(pubspecPath, '');
|
resourceProvider.newFile(pubspecPath, '');
|
||||||
// add one root - there is a context
|
// add one root - there is a context
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
|
@ -1042,7 +1041,7 @@ test_pack:lib/''');
|
||||||
|
|
||||||
void test_setRoots_removeFolderWithPubspec() {
|
void test_setRoots_removeFolderWithPubspec() {
|
||||||
// create a pubspec
|
// create a pubspec
|
||||||
String pubspecPath = posix.join(projPath, 'pubspec.yaml');
|
String pubspecPath = path.posix.join(projPath, 'pubspec.yaml');
|
||||||
resourceProvider.newFile(pubspecPath, 'pubspec');
|
resourceProvider.newFile(pubspecPath, 'pubspec');
|
||||||
// add one root - there is a context
|
// add one root - there is a context
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
|
@ -1125,7 +1124,7 @@ test_pack:lib/''');
|
||||||
Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
|
Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
|
||||||
expect(filePaths, isEmpty);
|
expect(filePaths, isEmpty);
|
||||||
// add link
|
// add link
|
||||||
String filePath = posix.join(projPath, 'foo.dart');
|
String filePath = path.posix.join(projPath, 'foo.dart');
|
||||||
resourceProvider.newDummyLink(filePath);
|
resourceProvider.newDummyLink(filePath);
|
||||||
// the link was ignored
|
// the link was ignored
|
||||||
return pumpEventQueue().then((_) {
|
return pumpEventQueue().then((_) {
|
||||||
|
@ -1139,7 +1138,7 @@ test_pack:lib/''');
|
||||||
Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
|
Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
|
||||||
expect(filePaths, hasLength(0));
|
expect(filePaths, hasLength(0));
|
||||||
// add file
|
// add file
|
||||||
String filePath = posix.join(projPath, 'foo.dart');
|
String filePath = path.posix.join(projPath, 'foo.dart');
|
||||||
resourceProvider.newFile(filePath, 'contents');
|
resourceProvider.newFile(filePath, 'contents');
|
||||||
// the file was added
|
// the file was added
|
||||||
return pumpEventQueue().then((_) {
|
return pumpEventQueue().then((_) {
|
||||||
|
@ -1245,7 +1244,7 @@ test_pack:lib/''');
|
||||||
Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
|
Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
|
||||||
expect(filePaths, hasLength(0));
|
expect(filePaths, hasLength(0));
|
||||||
// add file in subfolder
|
// add file in subfolder
|
||||||
String filePath = posix.join(projPath, 'foo', 'bar.dart');
|
String filePath = path.posix.join(projPath, 'foo', 'bar.dart');
|
||||||
resourceProvider.newFile(filePath, 'contents');
|
resourceProvider.newFile(filePath, 'contents');
|
||||||
// the file was added
|
// the file was added
|
||||||
return pumpEventQueue().then((_) {
|
return pumpEventQueue().then((_) {
|
||||||
|
@ -1426,7 +1425,7 @@ test_pack:lib/''');
|
||||||
}
|
}
|
||||||
|
|
||||||
test_watch_deleteFile() {
|
test_watch_deleteFile() {
|
||||||
String filePath = posix.join(projPath, 'foo.dart');
|
String filePath = path.posix.join(projPath, 'foo.dart');
|
||||||
// add root with a file
|
// add root with a file
|
||||||
File file = resourceProvider.newFile(filePath, 'contents');
|
File file = resourceProvider.newFile(filePath, 'contents');
|
||||||
Folder projFolder = file.parent;
|
Folder projFolder = file.parent;
|
||||||
|
@ -1447,7 +1446,7 @@ test_pack:lib/''');
|
||||||
}
|
}
|
||||||
|
|
||||||
test_watch_deleteFolder() {
|
test_watch_deleteFolder() {
|
||||||
String filePath = posix.join(projPath, 'foo.dart');
|
String filePath = path.posix.join(projPath, 'foo.dart');
|
||||||
// add root with a file
|
// add root with a file
|
||||||
File file = resourceProvider.newFile(filePath, 'contents');
|
File file = resourceProvider.newFile(filePath, 'contents');
|
||||||
Folder projFolder = file.parent;
|
Folder projFolder = file.parent;
|
||||||
|
@ -1596,7 +1595,7 @@ test_pack:lib/''');
|
||||||
}
|
}
|
||||||
|
|
||||||
test_watch_modifyFile() {
|
test_watch_modifyFile() {
|
||||||
String filePath = posix.join(projPath, 'foo.dart');
|
String filePath = path.posix.join(projPath, 'foo.dart');
|
||||||
// add root with a file
|
// add root with a file
|
||||||
resourceProvider.newFile(filePath, 'contents');
|
resourceProvider.newFile(filePath, 'contents');
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
|
@ -1615,11 +1614,11 @@ test_pack:lib/''');
|
||||||
|
|
||||||
test_watch_modifyPackageMapDependency_fail() async {
|
test_watch_modifyPackageMapDependency_fail() async {
|
||||||
// create a dependency file
|
// create a dependency file
|
||||||
String dependencyPath = posix.join(projPath, 'dep');
|
String dependencyPath = path.posix.join(projPath, 'dep');
|
||||||
resourceProvider.newFile(dependencyPath, 'contents');
|
resourceProvider.newFile(dependencyPath, 'contents');
|
||||||
packageMapProvider.dependencies.add(dependencyPath);
|
packageMapProvider.dependencies.add(dependencyPath);
|
||||||
// create a Dart file
|
// create a Dart file
|
||||||
String dartFilePath = posix.join(projPath, 'main.dart');
|
String dartFilePath = path.posix.join(projPath, 'main.dart');
|
||||||
resourceProvider.newFile(dartFilePath, 'contents');
|
resourceProvider.newFile(dartFilePath, 'contents');
|
||||||
// the created context has the expected empty package map
|
// the created context has the expected empty package map
|
||||||
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
|
||||||
|
@ -1744,7 +1743,7 @@ abstract class ContextManagerTest {
|
||||||
'**/${AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE}'
|
'**/${AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE}'
|
||||||
];
|
];
|
||||||
return patterns
|
return patterns
|
||||||
.map((pattern) => new Glob(posix.separator, pattern))
|
.map((pattern) => new Glob(path.posix.separator, pattern))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1758,7 +1757,7 @@ abstract class ContextManagerTest {
|
||||||
Map<String, List<Folder>> get _currentPackageMap => _packageMap(projPath);
|
Map<String, List<Folder>> get _currentPackageMap => _packageMap(projPath);
|
||||||
|
|
||||||
void deleteFile(List<String> pathComponents) {
|
void deleteFile(List<String> pathComponents) {
|
||||||
String filePath = posix.joinAll(pathComponents);
|
String filePath = path.posix.joinAll(pathComponents);
|
||||||
resourceProvider.deleteFile(filePath);
|
resourceProvider.deleteFile(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1766,13 +1765,13 @@ abstract class ContextManagerTest {
|
||||||
ErrorProcessor.getProcessor(callbacks.currentContext, error);
|
ErrorProcessor.getProcessor(callbacks.currentContext, error);
|
||||||
|
|
||||||
String newFile(List<String> pathComponents, [String content = '']) {
|
String newFile(List<String> pathComponents, [String content = '']) {
|
||||||
String filePath = posix.joinAll(pathComponents);
|
String filePath = path.posix.joinAll(pathComponents);
|
||||||
resourceProvider.newFile(filePath, content);
|
resourceProvider.newFile(filePath, content);
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
String newFolder(List<String> pathComponents) {
|
String newFolder(List<String> pathComponents) {
|
||||||
String folderPath = posix.joinAll(pathComponents);
|
String folderPath = path.posix.joinAll(pathComponents);
|
||||||
resourceProvider.newFolder(folderPath);
|
resourceProvider.newFolder(folderPath);
|
||||||
return folderPath;
|
return folderPath;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ library test.integration.analysis.get.hover;
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:analysis_server/plugin/protocol/protocol.dart';
|
import 'package:analysis_server/plugin/protocol/protocol.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart' as path;
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ main() {
|
||||||
expect(info.offset, equals(offset));
|
expect(info.offset, equals(offset));
|
||||||
expect(info.length, equals(length));
|
expect(info.length, equals(length));
|
||||||
if (isCore) {
|
if (isCore) {
|
||||||
expect(basename(info.containingLibraryPath), equals('core.dart'));
|
expect(path.basename(info.containingLibraryPath), equals('core.dart'));
|
||||||
expect(info.containingLibraryName, equals('dart.core'));
|
expect(info.containingLibraryName, equals('dart.core'));
|
||||||
} else if (isLocal || isLiteral) {
|
} else if (isLocal || isLiteral) {
|
||||||
expect(info.containingLibraryPath, isNull);
|
expect(info.containingLibraryPath, isNull);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
library test.integration.analysis.packageRoot;
|
library test.integration.analysis.packageRoot;
|
||||||
|
|
||||||
import 'package:analysis_server/plugin/protocol/protocol.dart';
|
import 'package:analysis_server/plugin/protocol/protocol.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart' as path;
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||||
|
|
||||||
|
@ -21,9 +21,9 @@ main() {
|
||||||
class Test extends AbstractAnalysisServerIntegrationTest {
|
class Test extends AbstractAnalysisServerIntegrationTest {
|
||||||
test_package_root() {
|
test_package_root() {
|
||||||
String projPath = sourcePath('project');
|
String projPath = sourcePath('project');
|
||||||
String mainPath = join(projPath, 'main.dart');
|
String mainPath = path.join(projPath, 'main.dart');
|
||||||
String packagesPath = sourcePath('packages');
|
String packagesPath = sourcePath('packages');
|
||||||
String fooBarPath = join(packagesPath, 'foo', 'bar.dart');
|
String fooBarPath = path.join(packagesPath, 'foo', 'bar.dart');
|
||||||
String mainText = """
|
String mainText = """
|
||||||
library main;
|
library main;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import 'package:analyzer/src/generated/source.dart';
|
||||||
import 'package:analyzer/src/generated/source_io.dart';
|
import 'package:analyzer/src/generated/source_io.dart';
|
||||||
import 'package:analyzer/src/util/glob.dart';
|
import 'package:analyzer/src/util/glob.dart';
|
||||||
import 'package:linter/src/plugin/linter_plugin.dart';
|
import 'package:linter/src/plugin/linter_plugin.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart' as path;
|
||||||
import 'package:plugin/manager.dart';
|
import 'package:plugin/manager.dart';
|
||||||
import 'package:plugin/plugin.dart';
|
import 'package:plugin/plugin.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
@ -43,18 +43,18 @@ class SingleContextManagerTest {
|
||||||
'**/*.${AnalysisEngine.SUFFIX_HTML}',
|
'**/*.${AnalysisEngine.SUFFIX_HTML}',
|
||||||
];
|
];
|
||||||
return patterns
|
return patterns
|
||||||
.map((pattern) => new Glob(posix.separator, pattern))
|
.map((pattern) => new Glob(path.posix.separator, pattern))
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
String newFile(List<String> pathComponents, [String content = '']) {
|
String newFile(List<String> pathComponents, [String content = '']) {
|
||||||
String filePath = posix.joinAll(pathComponents);
|
String filePath = path.posix.joinAll(pathComponents);
|
||||||
resourceProvider.newFile(filePath, content);
|
resourceProvider.newFile(filePath, content);
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
String newFolder(List<String> pathComponents) {
|
String newFolder(List<String> pathComponents) {
|
||||||
String folderPath = posix.joinAll(pathComponents);
|
String folderPath = path.posix.joinAll(pathComponents);
|
||||||
resourceProvider.newFolder(folderPath);
|
resourceProvider.newFolder(folderPath);
|
||||||
return folderPath;
|
return folderPath;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ class SingleContextManagerTest {
|
||||||
resourceProvider.newFolder(root1);
|
resourceProvider.newFolder(root1);
|
||||||
resourceProvider.newFolder(root2);
|
resourceProvider.newFolder(root2);
|
||||||
manager.setRoots(<String>[root1, root2], <String>[], <String, String>{});
|
manager.setRoots(<String>[root1, root2], <String>[], <String, String>{});
|
||||||
expect(manager.isIgnored('$context/root3/file.dart'), isTrue);
|
expect(manager.isIgnored('/context/root3/file.dart'), isTrue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_isInAnalysisRoot_false_inExcludedPath() {
|
void test_isInAnalysisRoot_false_inExcludedPath() {
|
||||||
|
@ -117,7 +117,7 @@ class SingleContextManagerTest {
|
||||||
resourceProvider.newFolder(root1);
|
resourceProvider.newFolder(root1);
|
||||||
resourceProvider.newFolder(root2);
|
resourceProvider.newFolder(root2);
|
||||||
manager.setRoots(<String>[root1, root2], <String>[], <String, String>{});
|
manager.setRoots(<String>[root1, root2], <String>[], <String, String>{});
|
||||||
expect(manager.isInAnalysisRoot('$context/root3/file.dart'), isFalse);
|
expect(manager.isInAnalysisRoot('/context/root3/file.dart'), isFalse);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_isInAnalysisRoot_true() {
|
void test_isInAnalysisRoot_true() {
|
||||||
|
|
Loading…
Reference in a new issue