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

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

Issue 1437893003: Add _embedder.yaml support to analyzer and analysis_server (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
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 0baa6fc079faf6effaeb53ab80b7fcedfbb32051..9c659c0ab6b90e0eaf1b9d6c2238922f2b9aba95 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -567,6 +567,49 @@ analyzer:
});
}
+ test_embedder_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 _embedder.yaml.
+ newFile(
+ [libPath, '_embedder.yaml'],
+ r'''
+embedder_libs:
+ "dart:foobar": "../sdk_ext/entry.dart"
+ "dart:typed_data": "../sdk_ext/src/part"
+ ''');
+ // Setup .packages file
+ newFile(
+ [projPath, '.packages'],
+ r'''
+test_pack:lib/''');
+ // Setup context.
+
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+ await pumpEventQueue();
+ // Confirm that one context was created.
+ var contexts =
+ manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
+ expect(contexts, isNotNull);
+ expect(contexts.length, equals(1));
pquitslund 2015/11/11 21:19:34 [Nit]: can be simplified to: expect(contexts.leng
Brian Wilkerson 2015/11/11 22:09:14 or, better yet: expect(contexts, hasLength(1));
+ var context = contexts[0];
+ var source = context.sourceFactory.forUri('dart:foobar');
+ expect(source, isNotNull);
+ expect(source.fullName, equals('/my/proj/sdk_ext/entry.dart'));
pquitslund 2015/11/11 21:19:34 [Nit]: can be simplified to: expect(source.fullNa
+ // We can't find dart:core because we didn't list it in our
+ // embedder_libs map.
+ expect(context.sourceFactory.forUri('dart:core'), isNull);
+ // We can find dart:typed_data because we listed it in our
+ // embedder_libs map.
+ expect(context.sourceFactory.forUri('dart:typed_data'), isNotNull);
+ }
+
test_sdk_ext_packagespec() async {
// Create files.
String libPath = newFolder([projPath, LIB_NAME]);
@@ -588,8 +631,7 @@ analyzer:
newFile(
[projPath, '.packages'],
r'''
-test_pack:lib/
-''');
+test_pack:lib/''');
// Setup context.
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
// Confirm that one context was created.

Powered by Google App Engine
This is Rietveld 408576698