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

Unified Diff: pkg/analyzer/test/generated/all_the_rest_test.dart

Issue 914373004: Use package: URIs for files in lib (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added test and fixed URI usage Created 5 years, 10 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/engine.dart ('k') | pkg/analyzer/test/source/package_map_resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/all_the_rest_test.dart
diff --git a/pkg/analyzer/test/generated/all_the_rest_test.dart b/pkg/analyzer/test/generated/all_the_rest_test.dart
index 18af984db65827052934ebfc7d05d9806e1d8ce0..c1c294b44fc1249236c7d7ef02bb96ee04159509 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -38,6 +38,10 @@ import '../reflective_tests.dart';
import 'parser_test.dart';
import 'resolver_test.dart';
import 'test_support.dart';
+import 'package:analyzer/source/package_map_resolver.dart';
+import 'package:analyzer/file_system/memory_file_system.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:path/src/context.dart';
main() {
@@ -8474,6 +8478,32 @@ class SourceFactoryTest {
result.fullName,
FileUtilities2.createFile("/does/not/exist.dart").getAbsolutePath());
}
+
+ void test_resolveUri_nonAbsolute_relative_package() {
+ MemoryResourceProvider provider = new MemoryResourceProvider();
+ Context context = provider.pathContext;
+ String packagePath = context.joinAll([context.separator, 'path', 'to', 'package']);
+ String libPath = context.joinAll([packagePath, 'lib']);
+ String dirPath = context.joinAll([libPath, 'dir']);
+ String firstPath = context.joinAll([dirPath, 'first.dart']);
+ String secondPath = context.joinAll([dirPath, 'second.dart']);
+
+ provider.newFolder(packagePath);
+ Folder libFolder = provider.newFolder(libPath);
+ provider.newFolder(dirPath);
+ File firstFile = provider.newFile(firstPath, '');
+ provider.newFile(secondPath, '');
+
+ PackageMapUriResolver resolver = new PackageMapUriResolver(provider, {'package' : [libFolder]});
+ SourceFactory factory = new SourceFactory([resolver]);
+ Source librarySource = firstFile.createSource(Uri.parse('package:package/dir/first.dart'));
+
+ Source result = factory.resolveUri(librarySource, 'second.dart');
+ expect(result, isNotNull);
+ expect(result.fullName, secondPath);
+ expect(result.uri.toString(), 'package:package/dir/second.dart');
+ }
+
void test_restoreUri() {
JavaFile file1 = FileUtilities2.createFile("/some/file1.dart");
JavaFile file2 = FileUtilities2.createFile("/some/file2.dart");
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/test/source/package_map_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698