Chromium Code Reviews| 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. |