| 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 10 matching lines...) Expand all Loading... |
| 21 Expect.equals(FileSystemEntityType.LINK, | 21 Expect.equals(FileSystemEntityType.LINK, |
| 22 FileSystemEntity.typeSync(link, followLinks: false)); | 22 FileSystemEntity.typeSync(link, followLinks: false)); |
| 23 Expect.equals(FileSystemEntityType.DIRECTORY, | 23 Expect.equals(FileSystemEntityType.DIRECTORY, |
| 24 FileSystemEntity.typeSync(target, followLinks: false)); | 24 FileSystemEntity.typeSync(target, followLinks: false)); |
| 25 Expect.isTrue(FileSystemEntity.isLinkSync(link)); | 25 Expect.isTrue(FileSystemEntity.isLinkSync(link)); |
| 26 Expect.isFalse(FileSystemEntity.isLinkSync(target)); | 26 Expect.isFalse(FileSystemEntity.isLinkSync(target)); |
| 27 Expect.isTrue(new Directory(link).existsSync()); | 27 Expect.isTrue(new Directory(link).existsSync()); |
| 28 Expect.isTrue(new Directory(target).existsSync()); | 28 Expect.isTrue(new Directory(target).existsSync()); |
| 29 Expect.isTrue(new Link(link).existsSync()); | 29 Expect.isTrue(new Link(link).existsSync()); |
| 30 Expect.isFalse(new Link(target).existsSync()); | 30 Expect.isFalse(new Link(target).existsSync()); |
| 31 Expect.equals(target, new Link(link).targetSync()); |
| 31 | 32 |
| 32 String createdThroughLink = | 33 String createdThroughLink = |
| 33 base.append('link/createdThroughLink').toNativePath(); | 34 base.append('link/createdThroughLink').toNativePath(); |
| 34 String createdDirectly = base.append('target/createdDirectly').toNativePath(); | 35 String createdDirectly = base.append('target/createdDirectly').toNativePath(); |
| 35 new Directory(createdThroughLink).createSync(); | 36 new Directory(createdThroughLink).createSync(); |
| 36 new Directory(createdDirectly).createSync(); | 37 new Directory(createdDirectly).createSync(); |
| 37 Expect.isTrue(new Directory(createdThroughLink).existsSync()); | 38 Expect.isTrue(new Directory(createdThroughLink).existsSync()); |
| 38 Expect.isTrue(new Directory(createdDirectly).existsSync()); | 39 Expect.isTrue(new Directory(createdDirectly).existsSync()); |
| 39 Expect.isTrue(new Directory.fromPath(base.append('link/createdDirectly')) | 40 Expect.isTrue(new Directory.fromPath(base.append('link/createdDirectly')) |
| 40 .existsSync()); | 41 .existsSync()); |
| 41 Expect.isTrue(new Directory.fromPath(base.append('target/createdThroughLink')) | 42 Expect.isTrue(new Directory.fromPath(base.append('target/createdThroughLink')) |
| 42 .existsSync()); | 43 .existsSync()); |
| 43 Expect.equals(FileSystemEntityType.DIRECTORY, | 44 Expect.equals(FileSystemEntityType.DIRECTORY, |
| 44 FileSystemEntity.typeSync(createdThroughLink, | 45 FileSystemEntity.typeSync(createdThroughLink, |
| 45 followLinks: false)); | 46 followLinks: false)); |
| 46 Expect.equals(FileSystemEntityType.DIRECTORY, | 47 Expect.equals(FileSystemEntityType.DIRECTORY, |
| 47 FileSystemEntity.typeSync(createdDirectly, followLinks: false)); | 48 FileSystemEntity.typeSync(createdDirectly, followLinks: false)); |
| 48 | 49 |
| 49 new Directory.fromPath(base).deleteSync(recursive: true); | 50 new Directory.fromPath(base).deleteSync(recursive: true); |
| 50 } | 51 } |
| 51 | 52 |
| 52 | 53 |
| 53 main() { | 54 main() { |
| 54 testCreateSync(); | 55 testCreateSync(); |
| 55 } | 56 } |
| OLD | NEW |