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

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: 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
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..d0b3b94b749af9f441fce07859d30480485db6b7 100644
--- a/pkg/pathos/test/pathos_posix_test.dart
+++ b/pkg/pathos/test/pathos_posix_test.dart
@@ -399,4 +399,20 @@ 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:///')), '/');
+ 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('http://dartlang.org')),
+ throwsArgumentError);
+ });
+
+ test('toUri', () {
+ 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'));
Bob Nystrom 2013/06/13 00:21:18 This feels odd to me. Will users expect this, or s
nweiz 2013/06/19 00:50:27 I think this is correct. Think about it from the p
+ });
}

Powered by Google App Engine
This is Rietveld 408576698