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 // Dart test program for testing error handling in directory I/O. | 5 // Dart test program for testing error handling in directory I/O. |
6 | 6 |
7 import "dart:async"; | 7 import "dart:async"; |
8 import "dart:io"; | 8 import "dart:io"; |
9 import "dart:isolate"; | 9 import "dart:isolate"; |
10 | 10 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 Expect.isTrue(e.error is DirectoryIOException); | 163 Expect.isTrue(e.error is DirectoryIOException); |
164 done(); | 164 done(); |
165 }); | 165 }); |
166 } | 166 } |
167 | 167 |
168 | 168 |
169 void testRenameFileAsDirectory(Directory temp, Function done) { | 169 void testRenameFileAsDirectory(Directory temp, Function done) { |
170 File f = new File("${temp.path}/file"); | 170 File f = new File("${temp.path}/file"); |
171 var newPath = "${temp.path}/file2"; | 171 var newPath = "${temp.path}/file2"; |
172 f.createSync(); | 172 f.createSync(); |
173 var d = new Directory(f.name); | 173 var d = new Directory(f.path); |
174 Expect.throws(() => d.renameSync(newPath), | 174 Expect.throws(() => d.renameSync(newPath), |
175 (e) => e is DirectoryIOException); | 175 (e) => e is DirectoryIOException); |
176 var renameDone = d.rename(newPath); | 176 var renameDone = d.rename(newPath); |
177 renameDone.then((ignore) => Expect.fail('rename file as directory')) | 177 renameDone.then((ignore) => Expect.fail('rename file as directory')) |
178 .catchError((e) { | 178 .catchError((e) { |
179 Expect.isTrue(e.error is DirectoryIOException); | 179 Expect.isTrue(e.error is DirectoryIOException); |
180 done(); | 180 done(); |
181 }); | 181 }); |
182 } | 182 } |
183 | 183 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 main() { | 218 main() { |
219 runTest(testCreateInNonExistent); | 219 runTest(testCreateInNonExistent); |
220 runTest(testCreateTempInNonExistent); | 220 runTest(testCreateTempInNonExistent); |
221 runTest(testDeleteNonExistent); | 221 runTest(testDeleteNonExistent); |
222 runTest(testDeleteRecursivelyNonExistent); | 222 runTest(testDeleteRecursivelyNonExistent); |
223 runTest(testListNonExistent); | 223 runTest(testListNonExistent); |
224 runTest(testRenameNonExistent); | 224 runTest(testRenameNonExistent); |
225 runTest(testRenameFileAsDirectory); | 225 runTest(testRenameFileAsDirectory); |
226 runTest(testRenameOverwriteFile); | 226 runTest(testRenameOverwriteFile); |
227 } | 227 } |
OLD | NEW |