| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 Expect.isTrue(files[0].endsWith(x)); | 136 Expect.isTrue(files[0].endsWith(x)); |
| 137 Expect.equals(1, dirs.length); | 137 Expect.equals(1, dirs.length); |
| 138 Expect.isTrue(dirs[0].endsWith(y)); | 138 Expect.isTrue(dirs[0].endsWith(y)); |
| 139 temp.deleteRecursivelySync(); | 139 temp.deleteRecursivelySync(); |
| 140 temp2.deleteRecursivelySync(); | 140 temp2.deleteRecursivelySync(); |
| 141 }; | 141 }; |
| 142 }); | 142 }); |
| 143 } | 143 } |
| 144 | 144 |
| 145 | 145 |
| 146 testDirectoryListingBrokenLink() { |
| 147 var temp = new Directory('').createTempSync(); |
| 148 var x = '${temp.path}${Platform.pathSeparator}x'; |
| 149 var link = '${temp.path}${Platform.pathSeparator}link'; |
| 150 var doesNotExist = 'this_thing_does_not_exist'; |
| 151 new File(x).createSync(); |
| 152 createLink(doesNotExist, link, true, () { |
| 153 var files = []; |
| 154 var dirs = []; |
| 155 var errors = []; |
| 156 var lister = temp.list(recursive: true); |
| 157 lister.onFile = (f) => files.add(f); |
| 158 lister.onDir = (d) => dirs.add(d); |
| 159 lister.onError = (d) => errors.add(d); |
| 160 lister.onDone = (success) { |
| 161 Expect.isFalse(success); |
| 162 Expect.equals(1, files.length); |
| 163 Expect.isTrue(files[0].endsWith(x)); |
| 164 Expect.equals(0, dirs.length); |
| 165 Expect.equals(1, errors.length); |
| 166 Expect.isTrue(errors[0].toString().contains(link)); |
| 167 temp.deleteRecursivelySync(); |
| 168 }; |
| 169 }); |
| 170 } |
| 171 |
| 172 |
| 146 main() { | 173 main() { |
| 147 testFileExistsCreate(); | 174 testFileExistsCreate(); |
| 148 testFileDelete(); | 175 testFileDelete(); |
| 149 testFileWriteRead(); | 176 testFileWriteRead(); |
| 150 testDirectoryExistsCreate(); | 177 testDirectoryExistsCreate(); |
| 151 testDirectoryDelete(); | 178 testDirectoryDelete(); |
| 152 testDirectoryListing(); | 179 testDirectoryListing(); |
| 180 testDirectoryListingBrokenLink(); |
| 153 } | 181 } |
| OLD | NEW |