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

Side by Side Diff: pkg/pathos/test/pathos_url_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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/pathos/test/pathos_posix_test.dart ('k') | pkg/pathos/test/pathos_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:pathos/path.dart' as path; 6 import 'package:pathos/path.dart' as path;
7 7
8 main() { 8 main() {
9 var builder = new path.Builder(style: path.Style.url, 9 var builder = new path.Builder(style: path.Style.url,
10 root: 'http://dartlang.org/root/path'); 10 root: 'http://dartlang.org/root/path');
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 expect(builder.withoutExtension('a/b/'), 'a/b/'); 618 expect(builder.withoutExtension('a/b/'), 'a/b/');
619 expect(builder.withoutExtension('a/.'), 'a/.'); 619 expect(builder.withoutExtension('a/.'), 'a/.');
620 expect(builder.withoutExtension('a/.b'), 'a/.b'); 620 expect(builder.withoutExtension('a/.b'), 'a/.b');
621 expect(builder.withoutExtension('a.b/c'), 'a.b/c'); 621 expect(builder.withoutExtension('a.b/c'), 'a.b/c');
622 expect(builder.withoutExtension(r'a.b\c'), r'a'); 622 expect(builder.withoutExtension(r'a.b\c'), r'a');
623 expect(builder.withoutExtension(r'a/b\c'), r'a/b\c'); 623 expect(builder.withoutExtension(r'a/b\c'), r'a/b\c');
624 expect(builder.withoutExtension(r'a/b\c.d'), r'a/b\c'); 624 expect(builder.withoutExtension(r'a/b\c.d'), r'a/b\c');
625 expect(builder.withoutExtension('a/b.c/'), 'a/b/'); 625 expect(builder.withoutExtension('a/b.c/'), 'a/b/');
626 expect(builder.withoutExtension('a/b.c//'), 'a/b//'); 626 expect(builder.withoutExtension('a/b.c//'), 'a/b//');
627 }); 627 });
628
629
630 test('fromUri', () {
631 expect(builder.fromUri(Uri.parse('http://dartlang.org/path/to/foo')),
632 'http://dartlang.org/path/to/foo');
633 expect(builder.fromUri(Uri.parse('http://dartlang.org/path/to/foo/')),
634 'http://dartlang.org/path/to/foo/');
635 expect(builder.fromUri(Uri.parse('file:///path/to/foo')),
636 'file:///path/to/foo');
637 expect(builder.fromUri(Uri.parse('foo/bar')), 'foo/bar');
638 expect(builder.fromUri(Uri.parse('http://dartlang.org/path/to/foo%23bar')),
639 'http://dartlang.org/path/to/foo%23bar');
640 });
641
642 test('toUri', () {
643 expect(builder.toUri('http://dartlang.org/path/to/foo'),
644 Uri.parse('http://dartlang.org/path/to/foo'));
645 expect(builder.toUri('http://dartlang.org/path/to/foo/'),
646 Uri.parse('http://dartlang.org/path/to/foo/'));
647 expect(builder.toUri('file:///path/to/foo'),
648 Uri.parse('file:///path/to/foo'));
649 expect(builder.toUri('foo/bar'), Uri.parse('foo/bar'));
650 expect(builder.toUri('http://dartlang.org/path/to/foo%23bar'),
651 Uri.parse('http://dartlang.org/path/to/foo%23bar'));
652 });
628 } 653 }
OLDNEW
« no previous file with comments | « pkg/pathos/test/pathos_posix_test.dart ('k') | pkg/pathos/test/pathos_windows_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698