| 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 import "dart:io"; | 5 import "dart:io"; |
| 6 import "dart:isolate"; | 6 import "dart:isolate"; |
| 7 | 7 |
| 8 // Test the dart:io Link class. | 8 // Test the dart:io Link class. |
| 9 | 9 |
| 10 testCreateSync() { | 10 testCreateSync() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 Expect.isTrue(new Directory.fromPath(base.append('link/createdDirectly')) | 41 Expect.isTrue(new Directory.fromPath(base.append('link/createdDirectly')) |
| 42 .existsSync()); | 42 .existsSync()); |
| 43 Expect.isTrue(new Directory.fromPath(base.append('target/createdThroughLink')) | 43 Expect.isTrue(new Directory.fromPath(base.append('target/createdThroughLink')) |
| 44 .existsSync()); | 44 .existsSync()); |
| 45 Expect.equals(FileSystemEntityType.DIRECTORY, | 45 Expect.equals(FileSystemEntityType.DIRECTORY, |
| 46 FileSystemEntity.typeSync(createdThroughLink, | 46 FileSystemEntity.typeSync(createdThroughLink, |
| 47 followLinks: false)); | 47 followLinks: false)); |
| 48 Expect.equals(FileSystemEntityType.DIRECTORY, | 48 Expect.equals(FileSystemEntityType.DIRECTORY, |
| 49 FileSystemEntity.typeSync(createdDirectly, followLinks: false)); | 49 FileSystemEntity.typeSync(createdDirectly, followLinks: false)); |
| 50 | 50 |
| 51 // Test FileSystemEntity.identical on files, directories, and links, |
| 52 // reached by different paths. |
| 53 Expect.isTrue(FileSystemEntity.identicalSync(createdDirectly, |
| 54 createdDirectly)); |
| 55 Expect.isFalse(FileSystemEntity.identicalSync(createdDirectly, |
| 56 createdThroughLink)); |
| 57 Expect.isTrue(FileSystemEntity.identicalSync(createdDirectly, |
| 58 base.append('link/createdDirectly').toNativePath())); |
| 59 Expect.isTrue(FileSystemEntity.identicalSync(createdThroughLink, |
| 60 base.append('target/createdThroughLink').toNativePath())); |
| 61 |
| 62 Expect.isFalse(FileSystemEntity.identicalSync(target, link)); |
| 63 Expect.isTrue(FileSystemEntity.identicalSync(link, link)); |
| 64 Expect.isTrue(FileSystemEntity.identicalSync(target, target)); |
| 65 Expect.isTrue(FileSystemEntity.identicalSync(target, |
| 66 new Link(link).targetSync())); |
| 67 String absolutePath = new File(".").fullPathSync(); |
| 68 Expect.isTrue(FileSystemEntity.identicalSync(".", absolutePath)); |
| 69 |
| 70 String createdFile = base.append('target/createdFile').toNativePath(); |
| 71 new File(createdFile).createSync(); |
| 72 Expect.isTrue(FileSystemEntity.identicalSync(createdFile, createdFile)); |
| 73 Expect.isFalse(FileSystemEntity.identicalSync(createdFile, createdDirectly)); |
| 74 Expect.isTrue(FileSystemEntity.identicalSync(createdFile, |
| 75 base.append('link/createdFile').toNativePath())); |
| 76 Expect.throws(() => FileSystemEntity.identicalSync(createdFile, |
| 77 base.append('link/foo').toNativePath())); |
| 78 |
| 51 new Directory.fromPath(base).deleteSync(recursive: true); | 79 new Directory.fromPath(base).deleteSync(recursive: true); |
| 52 } | 80 } |
| 53 | 81 |
| 54 | 82 |
| 55 main() { | 83 main() { |
| 56 testCreateSync(); | 84 testCreateSync(); |
| 57 } | 85 } |
| OLD | NEW |