| 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 // Test the Path class in dart:io. | 5 // Test the Path class in dart:io. |
| 6 | 6 |
| 7 #import("dart:io"); | 7 #import("dart:io"); |
| 8 | 8 |
| 9 void main() { | 9 void main() { |
| 10 testBaseFunctions(); | 10 testBaseFunctions(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 'absolute canonical'); | 67 'absolute canonical'); |
| 68 testGetters(new Path.fromNative(r"foo/bar\hest/.fisk"), | 68 testGetters(new Path.fromNative(r"foo/bar\hest/.fisk"), |
| 69 ['foo/bar/hest', '.fisk', '', 'fisk'], | 69 ['foo/bar/hest', '.fisk', '', 'fisk'], |
| 70 'canonical'); | 70 'canonical'); |
| 71 testGetters(new Path.fromNative(r"foo//bar\\hest/\/.fisk."), | 71 testGetters(new Path.fromNative(r"foo//bar\\hest/\/.fisk."), |
| 72 ['foo//bar//hest', '.fisk.', '.fisk', ''], | 72 ['foo//bar//hest', '.fisk.', '.fisk', ''], |
| 73 ''); | 73 ''); |
| 74 } else { | 74 } else { |
| 75 // Make sure that backslashes are uninterpreted on other platforms. | 75 // Make sure that backslashes are uninterpreted on other platforms. |
| 76 testGetters(new Path.fromNative(r"/foo\bar/bif/fisk.hest"), | 76 testGetters(new Path.fromNative(r"/foo\bar/bif/fisk.hest"), |
| 77 [@'/foo\bar/bif', 'fisk.hest', 'fisk', 'hest'], | 77 [r'/foo\bar/bif', 'fisk.hest', 'fisk', 'hest'], |
| 78 'absolute canonical'); | 78 'absolute canonical'); |
| 79 testGetters(new Path.fromNative(r"//foo\bar///bif////fisk.hest"), | 79 testGetters(new Path.fromNative(r"//foo\bar///bif////fisk.hest"), |
| 80 [@'//foo\bar///bif', 'fisk.hest', 'fisk', 'hest'], | 80 [r'//foo\bar///bif', 'fisk.hest', 'fisk', 'hest'], |
| 81 'absolute'); | 81 'absolute'); |
| 82 testGetters(new Path.fromNative(r"/foo\ bar/bif/gule\ fisk.hest"), | 82 testGetters(new Path.fromNative(r"/foo\ bar/bif/gule\ fisk.hest"), |
| 83 [@'/foo\ bar/bif', @'gule\ fisk.hest', @'gule\ fisk', 'hest'], | 83 [r'/foo\ bar/bif', r'gule\ fisk.hest', r'gule\ fisk', 'hest'], |
| 84 'absolute canonical'); | 84 'absolute canonical'); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 | 88 |
| 89 void testGetters(Path path, List components, String properties) { | 89 void testGetters(Path path, List components, String properties) { |
| 90 final int DIRNAME = 0; | 90 final int DIRNAME = 0; |
| 91 final int FILENAME = 1; | 91 final int FILENAME = 1; |
| 92 final int FILENAME_NO_EXTENSION = 2; | 92 final int FILENAME_NO_EXTENSION = 2; |
| 93 final int EXTENSION = 3; | 93 final int EXTENSION = 3; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 Expect.equals('.', | 172 Expect.equals('.', |
| 173 new Path('/a').relativeTo(new Path('/a')).toString()); | 173 new Path('/a').relativeTo(new Path('/a')).toString()); |
| 174 | 174 |
| 175 // Not implemented yet. Should return new Path('../b/c/d/'). | 175 // Not implemented yet. Should return new Path('../b/c/d/'). |
| 176 Expect.throws(() => | 176 Expect.throws(() => |
| 177 new Path('b/c/d/').relativeTo(new Path('a/'))); | 177 new Path('b/c/d/').relativeTo(new Path('a/'))); |
| 178 // Should always throw - no relative path can be constructed. | 178 // Should always throw - no relative path can be constructed. |
| 179 Expect.throws(() => | 179 Expect.throws(() => |
| 180 new Path('a/b').relativeTo(new Path('../../d'))); | 180 new Path('a/b').relativeTo(new Path('../../d'))); |
| 181 } | 181 } |
| OLD | NEW |