OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |