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_posix_test; | 5 library pathos_posix_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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 expect(builder.withoutExtension('a/b/'), 'a/b/'); | 392 expect(builder.withoutExtension('a/b/'), 'a/b/'); |
393 expect(builder.withoutExtension('a/.'), 'a/.'); | 393 expect(builder.withoutExtension('a/.'), 'a/.'); |
394 expect(builder.withoutExtension('a/.b'), 'a/.b'); | 394 expect(builder.withoutExtension('a/.b'), 'a/.b'); |
395 expect(builder.withoutExtension('a.b/c'), 'a.b/c'); | 395 expect(builder.withoutExtension('a.b/c'), 'a.b/c'); |
396 expect(builder.withoutExtension(r'a.b\c'), r'a'); | 396 expect(builder.withoutExtension(r'a.b\c'), r'a'); |
397 expect(builder.withoutExtension(r'a/b\c'), r'a/b\c'); | 397 expect(builder.withoutExtension(r'a/b\c'), r'a/b\c'); |
398 expect(builder.withoutExtension(r'a/b\c.d'), r'a/b\c'); | 398 expect(builder.withoutExtension(r'a/b\c.d'), r'a/b\c'); |
399 expect(builder.withoutExtension('a/b.c/'), 'a/b/'); | 399 expect(builder.withoutExtension('a/b.c/'), 'a/b/'); |
400 expect(builder.withoutExtension('a/b.c//'), 'a/b//'); | 400 expect(builder.withoutExtension('a/b.c//'), 'a/b//'); |
401 }); | 401 }); |
| 402 |
| 403 test('fromUri', () { |
| 404 expect(builder.fromUri(Uri.parse('file:///path/to/foo')), '/path/to/foo'); |
| 405 expect(builder.fromUri(Uri.parse('file:///path/to/foo/')), '/path/to/foo/'); |
| 406 expect(builder.fromUri(Uri.parse('file:///')), '/'); |
| 407 expect(builder.fromUri(Uri.parse('foo/bar')), 'foo/bar'); |
| 408 expect(builder.fromUri(Uri.parse('/path/to/foo')), '/path/to/foo'); |
| 409 expect(builder.fromUri(Uri.parse('///path/to/foo')), '/path/to/foo'); |
| 410 expect(builder.fromUri(Uri.parse('file:///path/to/foo%23bar')), |
| 411 '/path/to/foo#bar'); |
| 412 expect(() => builder.fromUri(Uri.parse('http://dartlang.org')), |
| 413 throwsArgumentError); |
| 414 }); |
| 415 |
| 416 test('toUri', () { |
| 417 expect(builder.toUri('/path/to/foo'), Uri.parse('file:///path/to/foo')); |
| 418 expect(builder.toUri('/path/to/foo/'), Uri.parse('file:///path/to/foo/')); |
| 419 expect(builder.toUri('/'), Uri.parse('file:///')); |
| 420 expect(builder.toUri('foo/bar'), Uri.parse('foo/bar')); |
| 421 expect(builder.toUri('/path/to/foo#bar'), |
| 422 Uri.parse('file:///path/to/foo%23bar')); |
| 423 }); |
402 } | 424 } |
OLD | NEW |