| 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 // Directory listing test. | 5 // Directory listing test. |
| 6 | 6 |
| 7 #import("dart:io"); | 7 #import("dart:io"); |
| 8 #import("dart:isolate"); | 8 #import("dart:isolate"); |
| 9 | 9 |
| 10 class DirectoryTest { | 10 class DirectoryTest { |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 testCreateTempError() { | 400 testCreateTempError() { |
| 401 var location = illegalTempDirectoryLocation(); | 401 var location = illegalTempDirectoryLocation(); |
| 402 if (location == null) return; | 402 if (location == null) return; |
| 403 | 403 |
| 404 var port = new ReceivePort(); | 404 var port = new ReceivePort(); |
| 405 var future = new Directory(location).createTemp(); | 405 var future = new Directory(location).createTemp(); |
| 406 future.handleException((e) => port.close()); | 406 future.handleException((e) => port.close()); |
| 407 } | 407 } |
| 408 | 408 |
| 409 | 409 |
| 410 testRename() { |
| 411 var d = new Directory(''); |
| 412 var temp1 = d.createTempSync(); |
| 413 var temp2 = d.createTempSync(); |
| 414 var temp3 = temp1.renameSync(temp2.path); |
| 415 Expect.isFalse(temp1.existsSync()); |
| 416 Expect.isTrue(temp2.existsSync()); |
| 417 Expect.equals(temp3.path, temp2.path); |
| 418 |
| 419 temp2.rename(temp1.path).then((temp4) { |
| 420 Expect.isFalse(temp3.existsSync()); |
| 421 Expect.isFalse(temp2.existsSync()); |
| 422 Expect.isTrue(temp1.existsSync()); |
| 423 Expect.isTrue(temp4.existsSync()); |
| 424 Expect.equals(temp1.path, temp4.path); |
| 425 temp1.deleteRecursivelySync(); |
| 426 }); |
| 427 } |
| 428 |
| 429 |
| 410 main() { | 430 main() { |
| 411 DirectoryTest.testMain(); | 431 DirectoryTest.testMain(); |
| 412 NestedTempDirectoryTest.testMain(); | 432 NestedTempDirectoryTest.testMain(); |
| 413 testCreateTempErrorSync(); | 433 testCreateTempErrorSync(); |
| 414 testCreateTempError(); | 434 testCreateTempError(); |
| 435 testRename(); |
| 415 } | 436 } |
| OLD | NEW |