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

Unified Diff: pkg/path/test/url_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: code review 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
« no previous file with comments | « pkg/path/test/posix_test.dart ('k') | pkg/path/test/windows_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/path/test/url_test.dart
diff --git a/pkg/path/test/url_test.dart b/pkg/path/test/url_test.dart
index 58c7b929a6e235b1421504294c5b237b6dd95763..27691d8523c82ea370b3a58d2a68c91dae92de06 100644
--- a/pkg/path/test/url_test.dart
+++ b/pkg/path/test/url_test.dart
@@ -741,4 +741,34 @@ main() {
expect(context.toUri(r'_%7B_%7D_%60_%5E_%20_%22_%25_'),
Uri.parse('_%7B_%7D_%60_%5E_%20_%22_%25_'));
});
+
+ group('prettyUri', () {
+ test('with a file: URI', () {
+ expect(context.prettyUri(Uri.parse('file:///root/path/a/b')),
+ 'file:///root/path/a/b');
+ });
+
+ test('with an http: URI', () {
+ expect(context.prettyUri('http://dartlang.org/root/path/a/b'), 'a/b');
+ expect(context.prettyUri('http://dartlang.org/root/path/a/../b'), 'b');
+ expect(context.prettyUri('http://dartlang.org/other/path/a/b'),
+ 'http://dartlang.org/other/path/a/b');
+ expect(context.prettyUri('http://pub.dartlang.org/root/path'),
+ 'http://pub.dartlang.org/root/path');
+ expect(context.prettyUri('http://dartlang.org/root/other'),
+ '../other');
+ });
+
+ test('with a relative URI', () {
+ expect(context.prettyUri('a/b'), 'a/b');
+ });
+
+ test('with a root-relative URI', () {
+ expect(context.prettyUri('/a/b'), '/a/b');
+ });
+
+ test('with a Uri object', () {
+ expect(context.prettyUri(Uri.parse('a/b')), 'a/b');
+ });
+ });
}
« no previous file with comments | « pkg/path/test/posix_test.dart ('k') | pkg/path/test/windows_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698