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

Unified Diff: pkg/analyzer/test/source/embedder_test.dart

Issue 2009303002: Embedder support refactoring (phase 1). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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/lib/src/generated/sdk.dart ('k') | pkg/analyzer_cli/lib/src/driver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/source/embedder_test.dart
diff --git a/pkg/analyzer/test/source/embedder_test.dart b/pkg/analyzer/test/source/embedder_test.dart
index 898aa1f68425921d64424766d0bbabec3ade64ea..08a30663ef5a31e8762b566f70eee3e77ae421cb 100644
--- a/pkg/analyzer/test/source/embedder_test.dart
+++ b/pkg/analyzer/test/source/embedder_test.dart
@@ -28,19 +28,20 @@ main() {
});
test('test_NullEmbedderYamls', () {
var resolver = new EmbedderUriResolver(null);
- expect(resolver.length, equals(0));
+ expect(resolver.length, 0);
});
test('test_NoEmbedderYamls', () {
var locator = new EmbedderYamlLocator({
'fox': [pathTranslator.getResource('/empty')]
});
- expect(locator.embedderYamls.length, equals(0));
+ expect(locator.embedderYamls.length, 0);
});
test('test_EmbedderYaml', () {
var locator = new EmbedderYamlLocator({
'fox': [pathTranslator.getResource('/tmp')]
});
- var resolver = new EmbedderUriResolver(locator.embedderYamls);
+ var resolver =
+ new EmbedderUriResolver(new EmbedderSdk(locator.embedderYamls));
expectResolved(dartUri, posixPath) {
Source source = resolver.resolveAbsolute(Uri.parse(dartUri));
@@ -48,8 +49,8 @@ main() {
expect(source.fullName, posixToOSPath(posixPath));
}
- // We have four mappings.
- expect(resolver.length, equals(4));
+ // We have five mappings.
+ expect(resolver.length, 5);
Brian Wilkerson 2016/05/25 17:45:56 Seems strange, if there are five mappings, that we
pquitslund 2016/05/25 17:52:00 Indeed! Forgot to update that bit. Fixed.
// Check that they map to the correct paths.
expectResolved('dart:fox', '/tmp/slippy.dart');
expectResolved('dart:bear', '/tmp/grizzly.dart');
@@ -59,13 +60,14 @@ main() {
test('test_BadYAML', () {
var locator = new EmbedderYamlLocator(null);
locator.addEmbedderYaml(null, r'''{{{,{{}}},}}''');
- expect(locator.embedderYamls.length, equals(0));
+ expect(locator.embedderYamls.length, 0);
});
test('test_restoreAbsolute', () {
var locator = new EmbedderYamlLocator({
'fox': [pathTranslator.getResource('/tmp')]
});
- var resolver = new EmbedderUriResolver(locator.embedderYamls);
+ var resolver =
+ new EmbedderUriResolver(new EmbedderSdk(locator.embedderYamls));
expectRestore(String dartUri, [String expected]) {
var parsedUri = Uri.parse(dartUri);
@@ -75,10 +77,10 @@ main() {
var restoreUri = resolver.restoreAbsolute(source);
expect(restoreUri, isNotNull, reason: dartUri);
// Verify that it is 'dart:fox'.
- expect(restoreUri.toString(), equals(expected ?? dartUri));
+ expect(restoreUri.toString(), expected ?? dartUri);
List<String> split = (expected ?? dartUri).split(':');
- expect(restoreUri.scheme, equals(split[0]));
- expect(restoreUri.path, equals(split[1]));
+ expect(restoreUri.scheme, split[0]);
+ expect(restoreUri.path, split[1]);
}
expectRestore('dart:deep');
@@ -91,7 +93,8 @@ main() {
var locator = new EmbedderYamlLocator({
'fox': [pathTranslator.getResource('/tmp')]
});
- var resolver = new EmbedderUriResolver(locator.embedderYamls);
+ var resolver =
+ new EmbedderUriResolver(new EmbedderSdk(locator.embedderYamls));
var sdk = resolver.dartSdk;
expectSource(String posixPath, String dartUri) {
@@ -110,18 +113,20 @@ main() {
var locator = new EmbedderYamlLocator({
'fox': [pathTranslator.getResource('/tmp')]
});
- var resolver = new EmbedderUriResolver(locator.embedderYamls);
+ var resolver =
+ new EmbedderUriResolver(new EmbedderSdk(locator.embedderYamls));
var sdk = resolver.dartSdk;
var lib = sdk.getSdkLibrary('dart:fox');
expect(lib, isNotNull);
expect(lib.path, posixToOSPath('/tmp/slippy.dart'));
- expect(lib.shortName, 'fox');
+ expect(lib.shortName, 'dart:fox');
});
test('test_EmbedderSdk_mapDartUri', () {
var locator = new EmbedderYamlLocator({
'fox': [pathTranslator.getResource('/tmp')]
});
- var resolver = new EmbedderUriResolver(locator.embedderYamls);
+ var resolver =
+ new EmbedderUriResolver(new EmbedderSdk(locator.embedderYamls));
var sdk = resolver.dartSdk;
expectSource(String dartUri, String posixPath) {
@@ -131,6 +136,7 @@ main() {
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');
@@ -151,6 +157,7 @@ buildResourceProvider() {
'/tmp/_embedder.yaml',
r'''
embedded_libs:
+ "dart:core" : "core.dart"
"dart:fox": "slippy.dart"
"dart:bear": "grizzly.dart"
"dart:relative": "../relative.dart"
« no previous file with comments | « pkg/analyzer/lib/src/generated/sdk.dart ('k') | pkg/analyzer_cli/lib/src/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698