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

Unified Diff: compiler/javatests/com/google/dart/compiler/SystemLibraryManagerTest.java

Issue 10826123: add tests for package uri's (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/javatests/com/google/dart/compiler/SystemLibraryManagerTest.java
===================================================================
--- compiler/javatests/com/google/dart/compiler/SystemLibraryManagerTest.java (revision 10190)
+++ compiler/javatests/com/google/dart/compiler/SystemLibraryManagerTest.java (working copy)
@@ -15,7 +15,7 @@
* @return the scheme specific path.
*/
private static String getPath(URI uri) {
- if (uri.getPath() != null) {
+ if (uri.getPath() != null && uri.getPath().length() != 0){
return uri.getPath();
}
return uri.getSchemeSpecificPart();
@@ -85,4 +85,33 @@
assertTrue(scheme.equals("file"));
assertTrue(getPath(translatedURI).endsWith("some/file.dart"));
}
+
+ public void testPackageExpand1() throws Exception {
+ URI shortUri = new URI("package:test.dart");
+ URI fullUri = systemLibraryManager.expandRelativeDartUri(shortUri);
+ assertNotNull(fullUri);
+ assertEquals("package", fullUri.getScheme());
+ assertEquals("test.dart", fullUri.getHost());
+ assertTrue(getPath(fullUri).endsWith("/test.dart"));
+ }
+
+ public void testPackageExpand2() throws Exception {
+ URI shortUri = new URI("package:test.dart");
+ URI fullUri1 = systemLibraryManager.expandRelativeDartUri(shortUri);
+ URI fullUri2 = systemLibraryManager.expandRelativeDartUri(fullUri1);
+ assertNotNull(fullUri2);
+ assertEquals("package", fullUri2.getScheme());
+ assertEquals("test.dart", fullUri2.getHost());
+ assertTrue(getPath(fullUri2).endsWith("/test.dart"));
+ }
+
+ public void testPackageTranslate1() throws Exception {
+ URI shortUri = new URI("package:test.dart");
+ URI fullUri = systemLibraryManager.expandRelativeDartUri(shortUri);
+ URI translatedURI = systemLibraryManager.resolveDartUri(fullUri);
+ assertNotNull(translatedURI);
+ String scheme = translatedURI.getScheme();
+ assertTrue(scheme.equals("file"));
+ assertTrue(getPath(translatedURI).endsWith("/test.dart"));
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698