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..769a76f34a49b92523cdcdd5a4de765619d9c91a 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('formatUri', () { |
+ test('with a file: URI', () { |
+ expect(context.formatUri(Uri.parse('file:///root/path/a/b')), |
+ 'file:///root/path/a/b'); |
+ }); |
+ |
+ test('with an http: URI', () { |
+ expect(context.formatUri(Uri.parse('http://dartlang.org/root/path/a/b')), |
+ 'a/b'); |
+ expect(context.formatUri(Uri.parse('http://dartlang.org/other/path/a/b')), |
+ 'http://dartlang.org/other/path/a/b'); |
+ expect(context.formatUri(Uri.parse('http://pub.dartlang.org/root/path')), |
+ 'http://pub.dartlang.org/root/path'); |
+ expect(context.formatUri(Uri.parse('http://dartlang.org/root/other')), |
+ '../other'); |
+ }); |
+ |
+ 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'); |
+ }); |
+ }); |
} |