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

Side by Side Diff: test/url_test.dart

Issue 1225373003: Fix path.toUri for relative paths. (Closed) Base URL: git@github.com:dart-lang/path@master
Patch Set: merge Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « test/posix_test.dart ('k') | test/windows_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:unittest/unittest.dart'; 5 import 'package:unittest/unittest.dart';
6 import 'package:path/path.dart' as path; 6 import 'package:path/path.dart' as path;
7 7
8 main() { 8 main() {
9 var context = new path.Context( 9 var context = new path.Context(
10 style: path.Style.url, current: 'http://dartlang.org/root/path'); 10 style: path.Style.url, current: 'http://dartlang.org/root/path');
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 expect(context.fromUri('http://dartlang.org/path/to/foo'), 714 expect(context.fromUri('http://dartlang.org/path/to/foo'),
715 'http://dartlang.org/path/to/foo'); 715 'http://dartlang.org/path/to/foo');
716 }); 716 });
717 }); 717 });
718 718
719 test('toUri', () { 719 test('toUri', () {
720 expect(context.toUri('http://dartlang.org/path/to/foo'), 720 expect(context.toUri('http://dartlang.org/path/to/foo'),
721 Uri.parse('http://dartlang.org/path/to/foo')); 721 Uri.parse('http://dartlang.org/path/to/foo'));
722 expect(context.toUri('http://dartlang.org/path/to/foo/'), 722 expect(context.toUri('http://dartlang.org/path/to/foo/'),
723 Uri.parse('http://dartlang.org/path/to/foo/')); 723 Uri.parse('http://dartlang.org/path/to/foo/'));
724 expect(context.toUri('path/to/foo/'), Uri.parse('path/to/foo/'));
724 expect( 725 expect(
725 context.toUri('file:///path/to/foo'), Uri.parse('file:///path/to/foo')); 726 context.toUri('file:///path/to/foo'), Uri.parse('file:///path/to/foo'));
726 expect(context.toUri('foo/bar'), Uri.parse('foo/bar')); 727 expect(context.toUri('foo/bar'), Uri.parse('foo/bar'));
727 expect(context.toUri('http://dartlang.org/path/to/foo%23bar'), 728 expect(context.toUri('http://dartlang.org/path/to/foo%23bar'),
728 Uri.parse('http://dartlang.org/path/to/foo%23bar')); 729 Uri.parse('http://dartlang.org/path/to/foo%23bar'));
729 // Since the input path is also a URI, special characters should already 730 // Since the input path is also a URI, special characters should already
730 // be percent encoded there too. 731 // be percent encoded there too.
731 expect(context.toUri(r'http://foo.com/_%7B_%7D_%60_%5E_%20_%22_%25_'), 732 expect(context.toUri(r'http://foo.com/_%7B_%7D_%60_%5E_%20_%22_%25_'),
732 Uri.parse('http://foo.com/_%7B_%7D_%60_%5E_%20_%22_%25_')); 733 Uri.parse('http://foo.com/_%7B_%7D_%60_%5E_%20_%22_%25_'));
733 expect(context.toUri(r'_%7B_%7D_%60_%5E_%20_%22_%25_'), 734 expect(context.toUri(r'_%7B_%7D_%60_%5E_%20_%22_%25_'),
(...skipping 22 matching lines...) Expand all
756 757
757 test('with a root-relative URI', () { 758 test('with a root-relative URI', () {
758 expect(context.prettyUri('/a/b'), '/a/b'); 759 expect(context.prettyUri('/a/b'), '/a/b');
759 }); 760 });
760 761
761 test('with a Uri object', () { 762 test('with a Uri object', () {
762 expect(context.prettyUri(Uri.parse('a/b')), 'a/b'); 763 expect(context.prettyUri(Uri.parse('a/b')), 'a/b');
763 }); 764 });
764 }); 765 });
765 } 766 }
OLDNEW
« no previous file with comments | « test/posix_test.dart ('k') | test/windows_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698