| 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 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'); |
| 11 | 11 |
| 12 test('separator', () { | 12 test('separator', () { |
| 13 expect(builder.separator, '/'); | 13 expect(builder.separator, '/'); |
| 14 }); | 14 }); |
| 15 | 15 |
| 16 test('extension', () { | 16 test('extension', () { |
| 17 expect(builder.extension(''), ''); | 17 expect(builder.extension(''), ''); |
| 18 expect(builder.extension('foo.dart'), '.dart'); | 18 expect(builder.extension('foo.dart'), '.dart'); |
| 19 expect(builder.extension('foo.dart.js'), '.js'); | 19 expect(builder.extension('foo.dart.js'), '.js'); |
| 20 expect(builder.extension('a.b/c'), ''); | 20 expect(builder.extension('a.b/c'), ''); |
| 21 expect(builder.extension('a.b/c.d'), '.d'); | 21 expect(builder.extension('a.b/c.d'), '.d'); |
| 22 expect(builder.extension(r'a.b\c'), r'.b\c'); | 22 expect(builder.extension(r'a.b\c'), r'.b\c'); |
| 23 expect(builder.extension('foo.dart/'), '.dart'); |
| 24 expect(builder.extension('foo.dart//'), '.dart'); |
| 23 }); | 25 }); |
| 24 | 26 |
| 25 test('rootPrefix', () { | 27 test('rootPrefix', () { |
| 26 expect(builder.rootPrefix(''), ''); | 28 expect(builder.rootPrefix(''), ''); |
| 27 expect(builder.rootPrefix('a'), ''); | 29 expect(builder.rootPrefix('a'), ''); |
| 28 expect(builder.rootPrefix('a/b'), ''); | 30 expect(builder.rootPrefix('a/b'), ''); |
| 29 expect(builder.rootPrefix('http://dartlang.org/a/c'), | 31 expect(builder.rootPrefix('http://dartlang.org/a/c'), |
| 30 'http://dartlang.org'); | 32 'http://dartlang.org'); |
| 31 expect(builder.rootPrefix('file:///a/c'), 'file://'); | 33 expect(builder.rootPrefix('file:///a/c'), 'file://'); |
| 32 expect(builder.rootPrefix('/a/c'), '/'); | 34 expect(builder.rootPrefix('/a/c'), '/'); |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 Uri.parse('http://dartlang.org/path/to/foo')); | 685 Uri.parse('http://dartlang.org/path/to/foo')); |
| 684 expect(builder.toUri('http://dartlang.org/path/to/foo/'), | 686 expect(builder.toUri('http://dartlang.org/path/to/foo/'), |
| 685 Uri.parse('http://dartlang.org/path/to/foo/')); | 687 Uri.parse('http://dartlang.org/path/to/foo/')); |
| 686 expect(builder.toUri('file:///path/to/foo'), | 688 expect(builder.toUri('file:///path/to/foo'), |
| 687 Uri.parse('file:///path/to/foo')); | 689 Uri.parse('file:///path/to/foo')); |
| 688 expect(builder.toUri('foo/bar'), Uri.parse('foo/bar')); | 690 expect(builder.toUri('foo/bar'), Uri.parse('foo/bar')); |
| 689 expect(builder.toUri('http://dartlang.org/path/to/foo%23bar'), | 691 expect(builder.toUri('http://dartlang.org/path/to/foo%23bar'), |
| 690 Uri.parse('http://dartlang.org/path/to/foo%23bar')); | 692 Uri.parse('http://dartlang.org/path/to/foo%23bar')); |
| 691 }); | 693 }); |
| 692 } | 694 } |
| OLD | NEW |