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.posix_test; | 5 library path.test.posix_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 main() { | 10 main() { |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 455 |
456 test('fromUri', () { | 456 test('fromUri', () { |
457 expect(builder.fromUri(Uri.parse('file:///path/to/foo')), '/path/to/foo'); | 457 expect(builder.fromUri(Uri.parse('file:///path/to/foo')), '/path/to/foo'); |
458 expect(builder.fromUri(Uri.parse('file:///path/to/foo/')), '/path/to/foo/'); | 458 expect(builder.fromUri(Uri.parse('file:///path/to/foo/')), '/path/to/foo/'); |
459 expect(builder.fromUri(Uri.parse('file:///')), '/'); | 459 expect(builder.fromUri(Uri.parse('file:///')), '/'); |
460 expect(builder.fromUri(Uri.parse('foo/bar')), 'foo/bar'); | 460 expect(builder.fromUri(Uri.parse('foo/bar')), 'foo/bar'); |
461 expect(builder.fromUri(Uri.parse('/path/to/foo')), '/path/to/foo'); | 461 expect(builder.fromUri(Uri.parse('/path/to/foo')), '/path/to/foo'); |
462 expect(builder.fromUri(Uri.parse('///path/to/foo')), '/path/to/foo'); | 462 expect(builder.fromUri(Uri.parse('///path/to/foo')), '/path/to/foo'); |
463 expect(builder.fromUri(Uri.parse('file:///path/to/foo%23bar')), | 463 expect(builder.fromUri(Uri.parse('file:///path/to/foo%23bar')), |
464 '/path/to/foo#bar'); | 464 '/path/to/foo#bar'); |
| 465 expect(builder.fromUri(Uri.parse('_%7B_%7D_%60_%5E_%20_%22_%25_')), |
| 466 r'_{_}_`_^_ _"_%_'); |
465 expect(() => builder.fromUri(Uri.parse('http://dartlang.org')), | 467 expect(() => builder.fromUri(Uri.parse('http://dartlang.org')), |
466 throwsArgumentError); | 468 throwsArgumentError); |
467 }); | 469 }); |
468 | 470 |
469 test('toUri', () { | 471 test('toUri', () { |
470 expect(builder.toUri('/path/to/foo'), Uri.parse('file:///path/to/foo')); | 472 expect(builder.toUri('/path/to/foo'), Uri.parse('file:///path/to/foo')); |
471 expect(builder.toUri('/path/to/foo/'), Uri.parse('file:///path/to/foo/')); | 473 expect(builder.toUri('/path/to/foo/'), Uri.parse('file:///path/to/foo/')); |
472 expect(builder.toUri('/'), Uri.parse('file:///')); | 474 expect(builder.toUri('/'), Uri.parse('file:///')); |
473 expect(builder.toUri('foo/bar'), Uri.parse('foo/bar')); | 475 expect(builder.toUri('foo/bar'), Uri.parse('foo/bar')); |
474 expect(builder.toUri('/path/to/foo#bar'), | 476 expect(builder.toUri('/path/to/foo#bar'), |
475 Uri.parse('file:///path/to/foo%23bar')); | 477 Uri.parse('file:///path/to/foo%23bar')); |
| 478 expect(builder.toUri(r'/_{_}_`_^_ _"_%_'), |
| 479 Uri.parse('file:///_%7B_%7D_%60_%5E_%20_%22_%25_')); |
| 480 expect(builder.toUri(r'_{_}_`_^_ _"_%_'), |
| 481 Uri.parse('_%7B_%7D_%60_%5E_%20_%22_%25_')); |
476 }); | 482 }); |
477 } | 483 } |
OLD | NEW |