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

Unified Diff: pkg/pathos/test/pathos_posix_test.dart

Issue 16848002: Add toUri and fromUri functions to pathos. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Preserve trailing separators. Created 7 years, 6 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/pathos/lib/path.dart ('k') | pkg/pathos/test/pathos_url_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/pathos/test/pathos_posix_test.dart
diff --git a/pkg/pathos/test/pathos_posix_test.dart b/pkg/pathos/test/pathos_posix_test.dart
index ecdd1336ba3c39eac02bc4fda3edb9d663cf0121..a446f767e700cf37d739abf907b582e7800e2411 100644
--- a/pkg/pathos/test/pathos_posix_test.dart
+++ b/pkg/pathos/test/pathos_posix_test.dart
@@ -399,4 +399,26 @@ main() {
expect(builder.withoutExtension('a/b.c/'), 'a/b/');
expect(builder.withoutExtension('a/b.c//'), 'a/b//');
});
+
+ test('fromUri', () {
+ expect(builder.fromUri(Uri.parse('file:///path/to/foo')), '/path/to/foo');
+ expect(builder.fromUri(Uri.parse('file:///path/to/foo/')), '/path/to/foo/');
+ expect(builder.fromUri(Uri.parse('file:///')), '/');
+ expect(builder.fromUri(Uri.parse('foo/bar')), 'foo/bar');
+ expect(builder.fromUri(Uri.parse('/path/to/foo')), '/path/to/foo');
+ expect(builder.fromUri(Uri.parse('///path/to/foo')), '/path/to/foo');
+ expect(builder.fromUri(Uri.parse('file:///path/to/foo%23bar')),
+ '/path/to/foo#bar');
+ expect(() => builder.fromUri(Uri.parse('http://dartlang.org')),
+ throwsArgumentError);
+ });
+
+ test('toUri', () {
+ expect(builder.toUri('/path/to/foo'), Uri.parse('file:///path/to/foo'));
+ expect(builder.toUri('/path/to/foo/'), Uri.parse('file:///path/to/foo/'));
+ expect(builder.toUri('/'), Uri.parse('file:///'));
+ expect(builder.toUri('foo/bar'), Uri.parse('foo/bar'));
+ expect(builder.toUri('/path/to/foo#bar'),
+ Uri.parse('file:///path/to/foo%23bar'));
+ });
}
« no previous file with comments | « pkg/pathos/lib/path.dart ('k') | pkg/pathos/test/pathos_url_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698