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 pathos_windows_test; | 5 library pathos_windows_test; |
6 | 6 |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'package:pathos/path.dart' as path; | 8 import 'package:pathos/path.dart' as path; |
9 | 9 |
10 main() { | 10 main() { |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 expect(builder.withoutExtension(r'a\b\'), r'a\b\'); | 434 expect(builder.withoutExtension(r'a\b\'), r'a\b\'); |
435 expect(builder.withoutExtension(r'a\.'), r'a\.'); | 435 expect(builder.withoutExtension(r'a\.'), r'a\.'); |
436 expect(builder.withoutExtension(r'a\.b'), r'a\.b'); | 436 expect(builder.withoutExtension(r'a\.b'), r'a\.b'); |
437 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c'); | 437 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c'); |
438 expect(builder.withoutExtension(r'a/b.c/d'), r'a/b.c/d'); | 438 expect(builder.withoutExtension(r'a/b.c/d'), r'a/b.c/d'); |
439 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c'); | 439 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c'); |
440 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c'); | 440 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c'); |
441 expect(builder.withoutExtension(r'a.b/c'), r'a.b/c'); | 441 expect(builder.withoutExtension(r'a.b/c'), r'a.b/c'); |
442 expect(builder.withoutExtension(r'a\b.c\'), r'a\b\'); | 442 expect(builder.withoutExtension(r'a\b.c\'), r'a\b\'); |
443 }); | 443 }); |
| 444 |
| 445 test('fromUri', () { |
| 446 expect(builder.fromUri(Uri.parse('file:///C:/path/to/foo')), |
| 447 r'C:\path\to\foo'); |
| 448 expect(builder.fromUri(Uri.parse('file://hostname/path/to/foo')), |
| 449 r'\\hostname\path\to\foo'); |
| 450 expect(builder.fromUri(Uri.parse('file:///C:/')), r'C:\'); |
| 451 expect(builder.fromUri(Uri.parse('file://hostname/')), r'\\hostname\'); |
| 452 expect(builder.fromUri(Uri.parse('foo/bar')), r'foo\bar'); |
| 453 expect(builder.fromUri(Uri.parse('/C:/path/to/foo')), r'C:\path\to\foo'); |
| 454 expect(builder.fromUri(Uri.parse('///C:/path/to/foo')), r'C:\path\to\foo'); |
| 455 expect(builder.fromUri(Uri.parse('//hostname/path/to/foo')), |
| 456 r'\\hostname\path\to\foo'); |
| 457 expect(builder.fromUri(Uri.parse('file:///C:/path/to/foo%23bar')), |
| 458 r'C:\path\to\foo#bar'); |
| 459 expect(builder.fromUri(Uri.parse('file://hostname/path/to/foo%23bar')), |
| 460 r'\\hostname\path\to\foo#bar'); |
| 461 expect(() => builder.fromUri(Uri.parse('http://dartlang.org')), |
| 462 throwsArgumentError); |
| 463 }); |
| 464 |
| 465 test('toUri', () { |
| 466 expect(builder.toUri(r'C:\path\to\foo'), |
| 467 Uri.parse('file:///C:/path/to/foo')); |
| 468 expect(builder.toUri(r'C:\path\to\foo\'), |
| 469 Uri.parse('file:///C:/path/to/foo/')); |
| 470 expect(builder.toUri(r'C:\'), Uri.parse('file:///C:/')); |
| 471 expect(builder.toUri(r'\\hostname\'), Uri.parse('file://hostname/')); |
| 472 expect(builder.toUri(r'foo\bar'), Uri.parse('foo/bar')); |
| 473 expect(builder.toUri(r'C:\path\to\foo#bar'), |
| 474 Uri.parse('file:///C:/path/to/foo%23bar')); |
| 475 expect(builder.toUri(r'\\hostname\path\to\foo#bar'), |
| 476 Uri.parse('file://hostname/path/to/foo%23bar')); |
| 477 }); |
444 } | 478 } |
OLD | NEW |