| 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 import "dart:io"; | 5 import "dart:io"; |
| 6 | 6 |
| 7 | 7 |
| 8 createLink(String dst, String link, bool symbolic, void callback()) { | 8 createLink(String dst, String link, bool symbolic, void callback()) { |
| 9 var args = [ symbolic ? '-s' : '', dst, link ]; | 9 var args = [ symbolic ? '-s' : '', dst, link ]; |
| 10 var script = 'tests/standalone/io/ln.sh'; | 10 var script = 'tests/standalone/io/ln.sh'; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 var dirs = []; | 129 var dirs = []; |
| 130 for (var entry in temp.listSync(recursive:true)) { | 130 for (var entry in temp.listSync(recursive:true)) { |
| 131 if (entry is File) { | 131 if (entry is File) { |
| 132 files.add(entry.name); | 132 files.add(entry.name); |
| 133 } else { | 133 } else { |
| 134 Expect.isTrue(entry is Directory); | 134 Expect.isTrue(entry is Directory); |
| 135 dirs.add(entry.path); | 135 dirs.add(entry.path); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 Expect.equals(1, files.length); | 138 Expect.equals(1, files.length); |
| 139 Expect.isTrue(files[0].endsWith(x)); | 139 Expect.isTrue(files[0].endsWith('$y${Platform.pathSeparator}x')); |
| 140 Expect.equals(1, dirs.length); | 140 Expect.equals(1, dirs.length); |
| 141 Expect.isTrue(dirs[0].endsWith(y)); | 141 Expect.isTrue(dirs[0].endsWith(y)); |
| 142 | 142 |
| 143 files = []; | 143 files = []; |
| 144 dirs = []; | 144 dirs = []; |
| 145 var lister = temp.list(recursive: true); | 145 var lister = temp.list(recursive: true); |
| 146 lister.onFile = (f) => files.add(f); | 146 lister.onFile = (f) => files.add(f); |
| 147 lister.onDir = (d) => dirs.add(d); | 147 lister.onDir = (d) => dirs.add(d); |
| 148 lister.onDone = (success) { | 148 lister.onDone = (success) { |
| 149 Expect.isTrue(success); | 149 Expect.isTrue(success); |
| 150 Expect.equals(1, files.length); | 150 Expect.equals(1, files.length); |
| 151 Expect.isTrue(files[0].endsWith(x)); | 151 Expect.isTrue(files[0].endsWith('$y${Platform.pathSeparator}x')); |
| 152 Expect.equals(1, dirs.length); | 152 Expect.equals(1, dirs.length); |
| 153 Expect.isTrue(dirs[0].endsWith(y)); | 153 Expect.isTrue(dirs[0].endsWith(y)); |
| 154 temp.deleteSync(recursive: true); | 154 temp.deleteSync(recursive: true); |
| 155 temp2.deleteSync(recursive: true); | 155 temp2.deleteSync(recursive: true); |
| 156 }; | 156 }; |
| 157 }); | 157 }); |
| 158 } | 158 } |
| 159 | 159 |
| 160 | 160 |
| 161 testDirectoryListingBrokenLink() { | 161 testDirectoryListingBrokenLink() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 189 | 189 |
| 190 main() { | 190 main() { |
| 191 testFileExistsCreate(); | 191 testFileExistsCreate(); |
| 192 testFileDelete(); | 192 testFileDelete(); |
| 193 testFileWriteRead(); | 193 testFileWriteRead(); |
| 194 testDirectoryExistsCreate(); | 194 testDirectoryExistsCreate(); |
| 195 testDirectoryDelete(); | 195 testDirectoryDelete(); |
| 196 testDirectoryListing(); | 196 testDirectoryListing(); |
| 197 testDirectoryListingBrokenLink(); | 197 testDirectoryListingBrokenLink(); |
| 198 } | 198 } |
| OLD | NEW |