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 main() { | 10 main() { |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 expect(builder.fromUri(Uri.parse('file://hostname/')), r'\\hostname\'); | 496 expect(builder.fromUri(Uri.parse('file://hostname/')), r'\\hostname\'); |
497 expect(builder.fromUri(Uri.parse('foo/bar')), r'foo\bar'); | 497 expect(builder.fromUri(Uri.parse('foo/bar')), r'foo\bar'); |
498 expect(builder.fromUri(Uri.parse('/C:/path/to/foo')), r'C:\path\to\foo'); | 498 expect(builder.fromUri(Uri.parse('/C:/path/to/foo')), r'C:\path\to\foo'); |
499 expect(builder.fromUri(Uri.parse('///C:/path/to/foo')), r'C:\path\to\foo'); | 499 expect(builder.fromUri(Uri.parse('///C:/path/to/foo')), r'C:\path\to\foo'); |
500 expect(builder.fromUri(Uri.parse('//hostname/path/to/foo')), | 500 expect(builder.fromUri(Uri.parse('//hostname/path/to/foo')), |
501 r'\\hostname\path\to\foo'); | 501 r'\\hostname\path\to\foo'); |
502 expect(builder.fromUri(Uri.parse('file:///C:/path/to/foo%23bar')), | 502 expect(builder.fromUri(Uri.parse('file:///C:/path/to/foo%23bar')), |
503 r'C:\path\to\foo#bar'); | 503 r'C:\path\to\foo#bar'); |
504 expect(builder.fromUri(Uri.parse('file://hostname/path/to/foo%23bar')), | 504 expect(builder.fromUri(Uri.parse('file://hostname/path/to/foo%23bar')), |
505 r'\\hostname\path\to\foo#bar'); | 505 r'\\hostname\path\to\foo#bar'); |
| 506 expect(builder.fromUri(Uri.parse('_%7B_%7D_%60_%5E_%20_%22_%25_')), |
| 507 r'_{_}_`_^_ _"_%_'); |
506 expect(() => builder.fromUri(Uri.parse('http://dartlang.org')), | 508 expect(() => builder.fromUri(Uri.parse('http://dartlang.org')), |
507 throwsArgumentError); | 509 throwsArgumentError); |
508 }); | 510 }); |
509 | 511 |
510 test('toUri', () { | 512 test('toUri', () { |
511 expect(builder.toUri(r'C:\path\to\foo'), | 513 expect(builder.toUri(r'C:\path\to\foo'), |
512 Uri.parse('file:///C:/path/to/foo')); | 514 Uri.parse('file:///C:/path/to/foo')); |
513 expect(builder.toUri(r'C:\path\to\foo\'), | 515 expect(builder.toUri(r'C:\path\to\foo\'), |
514 Uri.parse('file:///C:/path/to/foo/')); | 516 Uri.parse('file:///C:/path/to/foo/')); |
515 expect(builder.toUri(r'C:\'), Uri.parse('file:///C:/')); | 517 expect(builder.toUri(r'C:\'), Uri.parse('file:///C:/')); |
516 expect(builder.toUri(r'\\hostname\'), Uri.parse('file://hostname/')); | 518 expect(builder.toUri(r'\\hostname\'), Uri.parse('file://hostname/')); |
517 expect(builder.toUri(r'foo\bar'), Uri.parse('foo/bar')); | 519 expect(builder.toUri(r'foo\bar'), Uri.parse('foo/bar')); |
518 expect(builder.toUri(r'C:\path\to\foo#bar'), | 520 expect(builder.toUri(r'C:\path\to\foo#bar'), |
519 Uri.parse('file:///C:/path/to/foo%23bar')); | 521 Uri.parse('file:///C:/path/to/foo%23bar')); |
520 expect(builder.toUri(r'\\hostname\path\to\foo#bar'), | 522 expect(builder.toUri(r'\\hostname\path\to\foo#bar'), |
521 Uri.parse('file://hostname/path/to/foo%23bar')); | 523 Uri.parse('file://hostname/path/to/foo%23bar')); |
| 524 expect(builder.toUri(r'C:\_{_}_`_^_ _"_%_'), |
| 525 Uri.parse('file:///C:/_%7B_%7D_%60_%5E_%20_%22_%25_')); |
| 526 expect(builder.toUri(r'_{_}_`_^_ _"_%_'), |
| 527 Uri.parse('_%7B_%7D_%60_%5E_%20_%22_%25_')); |
522 }); | 528 }); |
523 } | 529 } |
OLD | NEW |