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

Unified Diff: pkg/analyzer/test/src/dart/sdk/sdk_test.dart

Issue 2277003003: Attempt to load sdk.ds from the only embedder. (Closed)
Patch Set: Created 4 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/analyzer/test/src/context/builder_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/dart/sdk/sdk_test.dart
diff --git a/pkg/analyzer/test/src/dart/sdk/sdk_test.dart b/pkg/analyzer/test/src/dart/sdk/sdk_test.dart
index aa5724eec941c45c7b17d13743f698b8cbc3438c..9e5b18fd4252e793a4eeb8a730ceb3485b917e5d 100644
--- a/pkg/analyzer/test/src/dart/sdk/sdk_test.dart
+++ b/pkg/analyzer/test/src/dart/sdk/sdk_test.dart
@@ -12,6 +12,7 @@ import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/java_engine_io.dart';
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/summary/summarize_elements.dart';
import 'package:unittest/unittest.dart';
import '../../../embedder_tests.dart';
@@ -32,7 +33,7 @@ main() {
class EmbedderSdkTest extends EmbedderRelatedTest {
void test_creation() {
EmbedderYamlLocator locator = new EmbedderYamlLocator({
- 'fox': [pathTranslator.getResource('/tmp')]
+ 'fox': [pathTranslator.getResource(foxLib)]
});
EmbedderSdk sdk = new EmbedderSdk(resourceProvider, locator.embedderYamls);
@@ -41,7 +42,7 @@ class EmbedderSdkTest extends EmbedderRelatedTest {
void test_fromFileUri() {
EmbedderYamlLocator locator = new EmbedderYamlLocator({
- 'fox': [pathTranslator.getResource('/tmp')]
+ 'fox': [pathTranslator.getResource(foxLib)]
});
EmbedderSdk sdk = new EmbedderSdk(resourceProvider, locator.embedderYamls);
@@ -53,26 +54,56 @@ class EmbedderSdkTest extends EmbedderRelatedTest {
expect(source.fullName, posixToOSPath(posixPath));
}
- expectSource('/tmp/slippy.dart', 'dart:fox');
- expectSource('/tmp/deep/directory/file.dart', 'dart:deep');
- expectSource('/tmp/deep/directory/part.dart', 'dart:deep/part.dart');
+ expectSource('$foxLib/slippy.dart', 'dart:fox');
+ expectSource('$foxLib/deep/directory/file.dart', 'dart:deep');
+ expectSource('$foxLib/deep/directory/part.dart', 'dart:deep/part.dart');
+ }
+
+ void test_getLinkedBundle_hasBundle() {
+ pathTranslator.newFileWithBytes(
+ '$foxPath/sdk.ds', new PackageBundleAssembler().assemble().toBuffer());
+ EmbedderYamlLocator locator = new EmbedderYamlLocator({
+ 'fox': [pathTranslator.getResource(foxLib)]
+ });
+ // No bundle for spec mode.
+ {
+ EmbedderSdk sdk =
+ new EmbedderSdk(resourceProvider, locator.embedderYamls);
+ sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = false;
+ expect(sdk.getLinkedBundle(), isNull);
+ }
+ // Has bundle for strong mode.
+ {
+ EmbedderSdk sdk =
+ new EmbedderSdk(resourceProvider, locator.embedderYamls);
+ sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = true;
+ expect(sdk.getLinkedBundle(), isNotNull);
+ }
+ }
+
+ void test_getLinkedBundle_noBundle() {
+ EmbedderYamlLocator locator = new EmbedderYamlLocator({
+ 'fox': [pathTranslator.getResource(foxLib)]
+ });
+ EmbedderSdk sdk = new EmbedderSdk(resourceProvider, locator.embedderYamls);
+ expect(sdk.getLinkedBundle(), isNull);
}
void test_getSdkLibrary() {
EmbedderYamlLocator locator = new EmbedderYamlLocator({
- 'fox': [pathTranslator.getResource('/tmp')]
+ 'fox': [pathTranslator.getResource(foxLib)]
});
EmbedderSdk sdk = new EmbedderSdk(resourceProvider, locator.embedderYamls);
SdkLibrary lib = sdk.getSdkLibrary('dart:fox');
expect(lib, isNotNull);
- expect(lib.path, posixToOSPath('/tmp/slippy.dart'));
+ expect(lib.path, posixToOSPath('$foxLib/slippy.dart'));
expect(lib.shortName, 'dart:fox');
}
void test_mapDartUri() {
EmbedderYamlLocator locator = new EmbedderYamlLocator({
- 'fox': [pathTranslator.getResource('/tmp')]
+ 'fox': [pathTranslator.getResource(foxLib)]
});
EmbedderSdk sdk = new EmbedderSdk(resourceProvider, locator.embedderYamls);
@@ -83,10 +114,10 @@ class EmbedderSdkTest extends EmbedderRelatedTest {
expect(source.fullName, posixToOSPath(posixPath));
}
- expectSource('dart:core', '/tmp/core.dart');
- expectSource('dart:fox', '/tmp/slippy.dart');
- expectSource('dart:deep', '/tmp/deep/directory/file.dart');
- expectSource('dart:deep/part.dart', '/tmp/deep/directory/part.dart');
+ expectSource('dart:core', '$foxLib/core.dart');
+ expectSource('dart:fox', '$foxLib/slippy.dart');
+ expectSource('dart:deep', '$foxLib/deep/directory/file.dart');
+ expectSource('dart:deep/part.dart', '$foxLib/deep/directory/part.dart');
}
}
« no previous file with comments | « pkg/analyzer/test/src/context/builder_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698