| 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 // Dart test program for testing FileSystemEntity.resolveSymbolicLinks | 5 // Dart test program for testing FileSystemEntity.resolveSymbolicLinks |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import "package:path/path.dart"; | 8 import "package:path/path.dart"; |
| 9 import "package:async_helper/async_helper.dart"; | 9 import "package:async_helper/async_helper.dart"; |
| 10 import 'dart:async'; | 10 import 'dart:async'; |
| 11 import 'dart:io'; | 11 import 'dart:io'; |
| 12 | 12 |
| 13 main() { | 13 main() { |
| 14 String testsDir = Platform.script.resolve('../..').toFilePath(); | 14 String testsDir = Directory.current.uri.resolve('tests').toFilePath(); |
| 15 |
| 15 // All of these tests test that resolveSymbolicLinks gives a path | 16 // All of these tests test that resolveSymbolicLinks gives a path |
| 16 // that points to the same place as the original, and that it removes | 17 // that points to the same place as the original, and that it removes |
| 17 // all links, .., and . segments, and that it produces an absolute path. | 18 // all links, .., and . segments, and that it produces an absolute path. |
| 18 asyncTest(() => testFile(join( | 19 asyncTest(() => testFile(join( |
| 19 testsDir, 'standalone', 'io', 'resolve_symbolic_links_test.dart'))); | 20 testsDir, 'standalone', 'io', 'resolve_symbolic_links_test.dart'))); |
| 20 asyncTest(() => testFile(join(testsDir, 'standalone', 'io', '..', 'io', | 21 asyncTest(() => testFile(join(testsDir, 'standalone', 'io', '..', 'io', |
| 21 'resolve_symbolic_links_test.dart'))); | 22 'resolve_symbolic_links_test.dart'))); |
| 22 | 23 |
| 23 asyncTest(() => testDir(join(testsDir, 'standalone', 'io'))); | 24 asyncTest(() => testDir(join(testsDir, 'standalone', 'io'))); |
| 24 asyncTest(() => testDir(join(testsDir, 'lib', '..', 'standalone', 'io'))); | 25 asyncTest(() => testDir(join(testsDir, 'lib', '..', 'standalone', 'io'))); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 Expect.isTrue(isAbsolute(resolved)); | 140 Expect.isTrue(isAbsolute(resolved)); |
| 140 // Test that resolveSymbolicLinks removes all links, .., and . segments. | 141 // Test that resolveSymbolicLinks removes all links, .., and . segments. |
| 141 Expect.isFalse(resolved.contains('..')); | 142 Expect.isFalse(resolved.contains('..')); |
| 142 Expect.isFalse(resolved.contains('./')); | 143 Expect.isFalse(resolved.contains('./')); |
| 143 Expect.isFalse(resolved.contains('link1')); | 144 Expect.isFalse(resolved.contains('link1')); |
| 144 return new Link(name).target() | 145 return new Link(name).target() |
| 145 .then((targetName) => FileSystemEntity.identical(targetName, resolved)) | 146 .then((targetName) => FileSystemEntity.identical(targetName, resolved)) |
| 146 .then((identical) => Expect.isTrue(identical)); | 147 .then((identical) => Expect.isTrue(identical)); |
| 147 }); | 148 }); |
| 148 } | 149 } |
| OLD | NEW |