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

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

Issue 1364813003: Error handling for bad `.analysis_options` files. (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 20327dedda51be3dd0736ed3d07d8f8c7c8fe76f..c4524fa5f5b698260daaadedae12d2c9a145b30b 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -96,6 +96,26 @@ class AbstractContextManagerTest {
ContextManagerImpl.ENABLE_PACKAGESPEC_SUPPORT = false;
}
+ test_analysis_options_parse_failure() async {
+ // Create files.
+ String libPath = newFolder([projPath, LIB_NAME]);
+ newFile([libPath, 'main.dart']);
+ String sdkExtPath = newFolder([projPath, 'sdk_ext']);
+ newFile([sdkExtPath, 'entry.dart']);
+ String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
+ newFile([sdkExtSrcPath, 'part.dart']);
+ // Setup analysis options file with ignore list.
+ newFile(
+ [projPath, '.analysis_options'],
+ r'''
+;
+''');
+ // Setup context.
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+
+ // No error means success.
+ }
+
void test_contextsInAnalysisRoot_nestedContext() {
String subProjPath = posix.join(projPath, 'subproj');
Folder subProjFolder = resourceProvider.newFolder(subProjPath);
@@ -347,41 +367,6 @@ analyzer:
// TODO(paulberry): This test only tests PackagesFileDisposition.
// Once http://dartbug.com/23909 is fixed, add a test for sdk extensions
// and PackageMapDisposition.
- test_sdk_ext_packagespec() async {
- // Create files.
- String libPath = newFolder([projPath, LIB_NAME]);
- newFile([libPath, 'main.dart']);
- newFile([libPath, 'nope.dart']);
- String sdkExtPath = newFolder([projPath, 'sdk_ext']);
- newFile([sdkExtPath, 'entry.dart']);
- String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
- newFile([sdkExtSrcPath, 'part.dart']);
- // Setup sdk extension mapping.
- newFile(
- [libPath, '_sdkext'],
- r'''
-{
- "dart:foobar": "../sdk_ext/entry.dart"
-}
-''');
- // Setup .packages file
- newFile(
- [projPath, '.packages'],
- r'''
-test_pack:lib/
-''');
- // Setup context.
- manager.setRoots(<String>[projPath], <String>[], <String, String>{});
- // Confirm that one context was created.
- var contexts =
- manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
- expect(contexts, isNotNull);
- expect(contexts.length, equals(1));
- var context = contexts[0];
- var source = context.sourceFactory.forUri('dart:foobar');
- expect(source.fullName, equals('/my/proj/sdk_ext/entry.dart'));
- }
-
test_refresh_folder_with_packagespec() {
// create a context with a .packages file
String packagespecFile = posix.join(projPath, '.packages');
@@ -489,6 +474,41 @@ test_pack:lib/
});
}
+ test_sdk_ext_packagespec() async {
+ // Create files.
+ String libPath = newFolder([projPath, LIB_NAME]);
+ newFile([libPath, 'main.dart']);
+ newFile([libPath, 'nope.dart']);
+ String sdkExtPath = newFolder([projPath, 'sdk_ext']);
+ newFile([sdkExtPath, 'entry.dart']);
+ String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
+ newFile([sdkExtSrcPath, 'part.dart']);
+ // Setup sdk extension mapping.
+ newFile(
+ [libPath, '_sdkext'],
+ r'''
+{
+ "dart:foobar": "../sdk_ext/entry.dart"
+}
+''');
+ // Setup .packages file
+ newFile(
+ [projPath, '.packages'],
+ r'''
+test_pack:lib/
+''');
+ // Setup context.
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+ // Confirm that one context was created.
+ var contexts =
+ manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
+ expect(contexts, isNotNull);
+ expect(contexts.length, equals(1));
+ var context = contexts[0];
+ var source = context.sourceFactory.forUri('dart:foobar');
+ expect(source.fullName, equals('/my/proj/sdk_ext/entry.dart'));
+ }
+
void test_setRoots_addFolderWithDartFile() {
String filePath = posix.join(projPath, 'foo.dart');
resourceProvider.newFile(filePath, 'contents');
« 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