| 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: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(style: path.Style.url, | 9 var context = new path.Context(style: path.Style.url, |
| 10 current: 'http://dartlang.org/root/path'); | 10 current: 'http://dartlang.org/root/path'); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 expect(context.rootPrefix('a/b'), ''); | 30 expect(context.rootPrefix('a/b'), ''); |
| 31 expect(context.rootPrefix('http://dartlang.org/a/c'), | 31 expect(context.rootPrefix('http://dartlang.org/a/c'), |
| 32 'http://dartlang.org'); | 32 'http://dartlang.org'); |
| 33 expect(context.rootPrefix('file:///a/c'), 'file://'); | 33 expect(context.rootPrefix('file:///a/c'), 'file://'); |
| 34 expect(context.rootPrefix('/a/c'), '/'); | 34 expect(context.rootPrefix('/a/c'), '/'); |
| 35 expect(context.rootPrefix('http://dartlang.org/'), 'http://dartlang.org'); | 35 expect(context.rootPrefix('http://dartlang.org/'), 'http://dartlang.org'); |
| 36 expect(context.rootPrefix('file:///'), 'file://'); | 36 expect(context.rootPrefix('file:///'), 'file://'); |
| 37 expect(context.rootPrefix('http://dartlang.org'), 'http://dartlang.org'); | 37 expect(context.rootPrefix('http://dartlang.org'), 'http://dartlang.org'); |
| 38 expect(context.rootPrefix('file://'), 'file://'); | 38 expect(context.rootPrefix('file://'), 'file://'); |
| 39 expect(context.rootPrefix('/'), '/'); | 39 expect(context.rootPrefix('/'), '/'); |
| 40 expect(context.rootPrefix('foo/bar://'), ''); |
| 40 }); | 41 }); |
| 41 | 42 |
| 42 test('dirname', () { | 43 test('dirname', () { |
| 43 expect(context.dirname(''), '.'); | 44 expect(context.dirname(''), '.'); |
| 44 expect(context.dirname('a'), '.'); | 45 expect(context.dirname('a'), '.'); |
| 45 expect(context.dirname('a/b'), 'a'); | 46 expect(context.dirname('a/b'), 'a'); |
| 46 expect(context.dirname('a/b/c'), 'a/b'); | 47 expect(context.dirname('a/b/c'), 'a/b'); |
| 47 expect(context.dirname('a/b.c'), 'a'); | 48 expect(context.dirname('a/b.c'), 'a'); |
| 48 expect(context.dirname('a/'), '.'); | 49 expect(context.dirname('a/'), '.'); |
| 49 expect(context.dirname('a/.'), 'a'); | 50 expect(context.dirname('a/.'), 'a'); |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 | 766 |
| 766 test('with a root-relative URI', () { | 767 test('with a root-relative URI', () { |
| 767 expect(context.prettyUri('/a/b'), '/a/b'); | 768 expect(context.prettyUri('/a/b'), '/a/b'); |
| 768 }); | 769 }); |
| 769 | 770 |
| 770 test('with a Uri object', () { | 771 test('with a Uri object', () { |
| 771 expect(context.prettyUri(Uri.parse('a/b')), 'a/b'); | 772 expect(context.prettyUri(Uri.parse('a/b')), 'a/b'); |
| 772 }); | 773 }); |
| 773 }); | 774 }); |
| 774 } | 775 } |
| OLD | NEW |