| Index: tests/standalone/io/path_test.dart
|
| diff --git a/tests/standalone/io/path_test.dart b/tests/standalone/io/path_test.dart
|
| index b448c9a379ed0fc54dd4854d65ff15df42a97a7b..a2b39a603dbbdbb3b5baf3a200e31d5b1ca87791 100644
|
| --- a/tests/standalone/io/path_test.dart
|
| +++ b/tests/standalone/io/path_test.dart
|
| @@ -10,6 +10,7 @@ void main() {
|
| testBaseFunctions();
|
| testCanonicalize();
|
| testJoinAppend();
|
| + testRelativeTo();
|
| }
|
|
|
| void testBaseFunctions() {
|
| @@ -163,8 +164,9 @@ void testJoinAppend() {
|
| // .join can only join a relative path to a path.
|
| // It cannot join an absolute path to a path.
|
| Expect.throws(() => new Path('/a/b/').join(new Path('/c/d')));
|
| +}
|
|
|
| - // Test Path.relativeTo.
|
| +void testRelativeTo() {
|
| Expect.equals('c/d',
|
| new Path('/a/b/c/d').relativeTo(new Path('/a/b')).toString());
|
| Expect.equals('c/d',
|
| @@ -172,6 +174,19 @@ void testJoinAppend() {
|
| Expect.equals('.',
|
| new Path('/a').relativeTo(new Path('/a')).toString());
|
|
|
| + // Trailing / in base path represents directory
|
| + Expect.equals('../../z/x/y',
|
| + new Path('/a/b/z/x/y').relativeTo(new Path('/a/b/c/d/')).toString());
|
| + Expect.equals('../z/x/y',
|
| + new Path('/a/b/z/x/y').relativeTo(new Path('/a/b/c/d')).toString());
|
| + Expect.equals('../z/x/y/',
|
| + new Path('/a/b/z/x/y/').relativeTo(new Path('/a/b/c/d')).toString());
|
| +
|
| + Expect.equals('../../z/x/y',
|
| + new Path('/z/x/y').relativeTo(new Path('/a/b/c')).toString());
|
| + Expect.equals('../../../z/x/y',
|
| + new Path('/z/x/y').relativeTo(new Path('/a/b/c/')).toString());
|
| +
|
| // Not implemented yet. Should return new Path('../b/c/d/').
|
| Expect.throws(() =>
|
| new Path('b/c/d/').relativeTo(new Path('a/')));
|
|
|