| 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'; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 asyncTest(() => testDir(join(testsDir, 'standalone', 'io'))); | 23 asyncTest(() => testDir(join(testsDir, 'standalone', 'io'))); |
| 24 asyncTest(() => testDir(join(testsDir, 'lib', '..', 'standalone', 'io'))); | 24 asyncTest(() => testDir(join(testsDir, 'lib', '..', 'standalone', 'io'))); |
| 25 // Test a relative path. | 25 // Test a relative path. |
| 26 asyncTest(() => testDir('.')); | 26 asyncTest(() => testDir('.')); |
| 27 if (Platform.isWindows) { | 27 if (Platform.isWindows) { |
| 28 asyncTest(() =>testFile(join('\\\\?\\$testsDir', 'standalone', 'io', | 28 asyncTest(() =>testFile(join('\\\\?\\$testsDir', 'standalone', 'io', |
| 29 'resolve_symbolic_links_test.dart'))); | 29 'resolve_symbolic_links_test.dart'))); |
| 30 asyncTest(() => testDir('\\\\?\\$testsDir')); | 30 asyncTest(() => testDir('\\\\?\\$testsDir')); |
| 31 } | 31 } |
| 32 asyncTest(() => new Directory('').createTemp().then((tempDir) { | 32 asyncTest(() => Directory.systemTemp.createTemp('dart_resolve_symbolic_links') |
| 33 .then((tempDir) { |
| 33 String temp = tempDir.path; | 34 String temp = tempDir.path; |
| 34 return makeEntities(temp).then((_) => Future.wait( | 35 return makeEntities(temp).then((_) => Future.wait( |
| 35 [testFile(join(temp, 'dir1', 'file1')), | 36 [testFile(join(temp, 'dir1', 'file1')), |
| 36 testFile(join(temp, 'link1', 'file2')), | 37 testFile(join(temp, 'link1', 'file2')), |
| 37 testDir(join(temp, 'dir1', 'dir2', '..', '.', '..', 'dir1')), | 38 testDir(join(temp, 'dir1', 'dir2', '..', '.', '..', 'dir1')), |
| 38 testDir(join(temp, 'dir1', 'dir2', '..', '.', '..', 'dir1')), | 39 testDir(join(temp, 'dir1', 'dir2', '..', '.', '..', 'dir1')), |
| 39 testLink(join(temp, 'link1'))])) | 40 testLink(join(temp, 'link1'))])) |
| 40 .then((_) { | 41 .then((_) { |
| 41 if (Platform.isWindows) { | 42 if (Platform.isWindows) { |
| 42 // Windows applies '..' to a link without resolving the link first. | 43 // Windows applies '..' to a link without resolving the link first. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 Expect.isTrue(isAbsolute(resolved)); | 139 Expect.isTrue(isAbsolute(resolved)); |
| 139 // Test that resolveSymbolicLinks removes all links, .., and . segments. | 140 // Test that resolveSymbolicLinks removes all links, .., and . segments. |
| 140 Expect.isFalse(resolved.contains('..')); | 141 Expect.isFalse(resolved.contains('..')); |
| 141 Expect.isFalse(resolved.contains('./')); | 142 Expect.isFalse(resolved.contains('./')); |
| 142 Expect.isFalse(resolved.contains('link1')); | 143 Expect.isFalse(resolved.contains('link1')); |
| 143 return new Link(name).target() | 144 return new Link(name).target() |
| 144 .then((targetName) => FileSystemEntity.identical(targetName, resolved)) | 145 .then((targetName) => FileSystemEntity.identical(targetName, resolved)) |
| 145 .then((identical) => Expect.isTrue(identical)); | 146 .then((identical) => Expect.isTrue(identical)); |
| 146 }); | 147 }); |
| 147 } | 148 } |
| OLD | NEW |