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

Unified Diff: pkg/path/test/posix_test.dart

Issue 296233002: Add a path.formatUri method and release path 1.2.0. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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/path/test/posix_test.dart
diff --git a/pkg/path/test/posix_test.dart b/pkg/path/test/posix_test.dart
index 9da97c9660b86d7e44dc5c2e615da9eeee8aa3eb..e35865ec183b8b6455421214274adc8f4908f748 100644
--- a/pkg/path/test/posix_test.dart
+++ b/pkg/path/test/posix_test.dart
@@ -508,4 +508,30 @@ main() {
expect(context.toUri(r'_{_}_`_^_ _"_%_'),
Uri.parse('_%7B_%7D_%60_%5E_%20_%22_%25_'));
});
+
+ group('formatUri', () {
+ test('with a file: URI', () {
+ expect(context.formatUri(Uri.parse('file:///root/path/a/b')), 'a/b');
Bob Nystrom 2014/05/23 21:57:52 The tests would be a bit cleaner if you passed a s
nweiz 2014/05/23 22:18:04 Done.
+ expect(context.formatUri(Uri.parse('file:///other/path/a/b')),
+ '/other/path/a/b');
+ expect(context.formatUri(Uri.parse('file:///root/other')), '../other');
+ });
+
+ test('with an http: URI', () {
+ expect(context.formatUri(Uri.parse('http://dartlang.org/a/b')),
+ 'http://dartlang.org/a/b');
+ });
+
+ test('with a relative URI', () {
+ expect(context.formatUri(Uri.parse('a/b')), 'a/b');
+ });
+
+ test('with a root-relative URI', () {
+ expect(context.formatUri(Uri.parse('/a/b')), '/a/b');
+ });
+
+ test('with a String', () {
+ expect(context.formatUri('a/b'), 'a/b');
+ });
+ });
}

Powered by Google App Engine
This is Rietveld 408576698