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

Unified Diff: pkg/pathos/test/pathos_windows_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/test/pathos_url_test.dart ('k') | pkg/stack_trace/lib/src/frame.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/pathos/test/pathos_windows_test.dart
diff --git a/pkg/pathos/test/pathos_windows_test.dart b/pkg/pathos/test/pathos_windows_test.dart
index 6d22742fee0c5a30c7b702db3586df24eee1a759..a7c81827ce20fc9306785c85e0a1cb60a145eb01 100644
--- a/pkg/pathos/test/pathos_windows_test.dart
+++ b/pkg/pathos/test/pathos_windows_test.dart
@@ -441,4 +441,38 @@ main() {
expect(builder.withoutExtension(r'a.b/c'), r'a.b/c');
expect(builder.withoutExtension(r'a\b.c\'), r'a\b\');
});
+
+ test('fromUri', () {
+ expect(builder.fromUri(Uri.parse('file:///C:/path/to/foo')),
+ r'C:\path\to\foo');
+ expect(builder.fromUri(Uri.parse('file://hostname/path/to/foo')),
+ r'\\hostname\path\to\foo');
+ expect(builder.fromUri(Uri.parse('file:///C:/')), r'C:\');
+ expect(builder.fromUri(Uri.parse('file://hostname/')), r'\\hostname\');
+ expect(builder.fromUri(Uri.parse('foo/bar')), r'foo\bar');
+ expect(builder.fromUri(Uri.parse('/C:/path/to/foo')), r'C:\path\to\foo');
+ expect(builder.fromUri(Uri.parse('///C:/path/to/foo')), r'C:\path\to\foo');
+ expect(builder.fromUri(Uri.parse('//hostname/path/to/foo')),
+ r'\\hostname\path\to\foo');
+ expect(builder.fromUri(Uri.parse('file:///C:/path/to/foo%23bar')),
+ r'C:\path\to\foo#bar');
+ expect(builder.fromUri(Uri.parse('file://hostname/path/to/foo%23bar')),
+ r'\\hostname\path\to\foo#bar');
+ expect(() => builder.fromUri(Uri.parse('http://dartlang.org')),
+ throwsArgumentError);
+ });
+
+ test('toUri', () {
+ expect(builder.toUri(r'C:\path\to\foo'),
+ Uri.parse('file:///C:/path/to/foo'));
+ expect(builder.toUri(r'C:\path\to\foo\'),
+ Uri.parse('file:///C:/path/to/foo/'));
+ expect(builder.toUri(r'C:\'), Uri.parse('file:///C:/'));
+ expect(builder.toUri(r'\\hostname\'), Uri.parse('file://hostname/'));
+ expect(builder.toUri(r'foo\bar'), Uri.parse('foo/bar'));
+ expect(builder.toUri(r'C:\path\to\foo#bar'),
+ Uri.parse('file:///C:/path/to/foo%23bar'));
+ expect(builder.toUri(r'\\hostname\path\to\foo#bar'),
+ Uri.parse('file://hostname/path/to/foo%23bar'));
+ });
}
« no previous file with comments | « pkg/pathos/test/pathos_url_test.dart ('k') | pkg/stack_trace/lib/src/frame.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698