OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Test "relative" on all styles of path.Context, on all platforms. | 5 // Test "relative" on all styles of path.Context, on all platforms. |
6 | 6 |
7 import "package:unittest/unittest.dart"; | 7 import "package:test/test.dart"; |
8 import "package:path/path.dart" as path; | 8 import "package:path/path.dart" as path; |
9 | 9 |
10 import "utils.dart"; | 10 import "utils.dart"; |
11 | 11 |
12 void main() { | 12 void main() { |
13 test("test relative", () { | 13 test("test relative", () { |
14 relativeTest(new path.Context(style: path.Style.posix, current: '.'), '/'); | 14 relativeTest(new path.Context(style: path.Style.posix, current: '.'), '/'); |
15 relativeTest(new path.Context(style: path.Style.posix, current: '/'), '/'); | 15 relativeTest(new path.Context(style: path.Style.posix, current: '/'), '/'); |
16 relativeTest( | 16 relativeTest( |
17 new path.Context(style: path.Style.windows, current: r'd:\'), r'c:\'); | 17 new path.Context(style: path.Style.windows, current: r'd:\'), r'c:\'); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // Should always throw - no relative path can be constructed. | 78 // Should always throw - no relative path can be constructed. |
79 if (isRelative) { | 79 if (isRelative) { |
80 expect(() => context.relative('.', from: '..'), throwsPathException); | 80 expect(() => context.relative('.', from: '..'), throwsPathException); |
81 expect(() => context.relative('a/b', from: '../../d'), throwsPathException); | 81 expect(() => context.relative('a/b', from: '../../d'), throwsPathException); |
82 expect(() => context.relative('a/b', from: '${prefix}a/b'), | 82 expect(() => context.relative('a/b', from: '${prefix}a/b'), |
83 throwsPathException); | 83 throwsPathException); |
84 // An absolute path relative from a relative path returns the absolute path. | 84 // An absolute path relative from a relative path returns the absolute path. |
85 expectRelative('${prefix}a/b', '${prefix}a/b', 'c/d'); | 85 expectRelative('${prefix}a/b', '${prefix}a/b', 'c/d'); |
86 } | 86 } |
87 } | 87 } |
OLD | NEW |