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 library path.test.windows_test; | 5 library path.test.windows_test; |
6 | 6 |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'package:path/path.dart' as path; | 8 import 'package:path/path.dart' as path; |
9 | 9 |
10 import 'utils.dart'; | 10 import 'utils.dart'; |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 expect(context.toUri(r'foo\bar'), Uri.parse('foo/bar')); | 633 expect(context.toUri(r'foo\bar'), Uri.parse('foo/bar')); |
634 expect(context.toUri(r'C:\path\to\foo#bar'), | 634 expect(context.toUri(r'C:\path\to\foo#bar'), |
635 Uri.parse('file:///C:/path/to/foo%23bar')); | 635 Uri.parse('file:///C:/path/to/foo%23bar')); |
636 expect(context.toUri(r'\\server\share\path\to\foo#bar'), | 636 expect(context.toUri(r'\\server\share\path\to\foo#bar'), |
637 Uri.parse('file://server/share/path/to/foo%23bar')); | 637 Uri.parse('file://server/share/path/to/foo%23bar')); |
638 expect(context.toUri(r'C:\_{_}_`_^_ _"_%_'), | 638 expect(context.toUri(r'C:\_{_}_`_^_ _"_%_'), |
639 Uri.parse('file:///C:/_%7B_%7D_%60_%5E_%20_%22_%25_')); | 639 Uri.parse('file:///C:/_%7B_%7D_%60_%5E_%20_%22_%25_')); |
640 expect(context.toUri(r'_{_}_`_^_ _"_%_'), | 640 expect(context.toUri(r'_{_}_`_^_ _"_%_'), |
641 Uri.parse('_%7B_%7D_%60_%5E_%20_%22_%25_')); | 641 Uri.parse('_%7B_%7D_%60_%5E_%20_%22_%25_')); |
642 }); | 642 }); |
| 643 |
| 644 group('formatUri', () { |
| 645 test('with a file: URI', () { |
| 646 expect(context.formatUri(Uri.parse('file:///C:/root/path/a/b')), r'a\b'); |
| 647 expect(context.formatUri(Uri.parse('file:///C:/other/path/a/b')), |
| 648 r'C:\other\path\a\b'); |
| 649 expect(context.formatUri(Uri.parse('file:///D:/root/path/a/b')), |
| 650 r'D:\root\path\a\b'); |
| 651 expect(context.formatUri(Uri.parse('file:///C:/root/other')), |
| 652 r'..\other'); |
| 653 }); |
| 654 |
| 655 test('with an http: URI', () { |
| 656 expect(context.formatUri(Uri.parse('http://dartlang.org/a/b')), |
| 657 'http://dartlang.org/a/b'); |
| 658 }); |
| 659 |
| 660 test('with a relative URI', () { |
| 661 expect(context.formatUri(Uri.parse('a/b')), r'a\b'); |
| 662 }); |
| 663 |
| 664 test('with a root-relative URI', () { |
| 665 expect(context.formatUri(Uri.parse('/D:/a/b')), r'D:\a\b'); |
| 666 }); |
| 667 |
| 668 test('with a String', () { |
| 669 expect(context.formatUri('a/b'), r'a\b'); |
| 670 }); |
| 671 }); |
643 } | 672 } |
OLD | NEW |