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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 return "*"; | 432 return "*"; |
433 } | 433 } |
434 return null; | 434 return null; |
435 } | 435 } |
436 | 436 |
437 | 437 |
438 testCreateTempErrorSync() { | 438 testCreateTempErrorSync() { |
439 var location = illegalTempDirectoryLocation(); | 439 var location = illegalTempDirectoryLocation(); |
440 if (location != null) { | 440 if (location != null) { |
441 Expect.throws(new Directory(location).createTempSync, | 441 Expect.throws(new Directory(location).createTempSync, |
442 (e) => e is DirectoryException); | 442 (e) => e is DirectoryIOException); |
443 } | 443 } |
444 } | 444 } |
445 | 445 |
446 | 446 |
447 testCreateTempError() { | 447 testCreateTempError() { |
448 var location = illegalTempDirectoryLocation(); | 448 var location = illegalTempDirectoryLocation(); |
449 if (location == null) return; | 449 if (location == null) return; |
450 | 450 |
451 var resultPort = new ReceivePort(); | 451 var resultPort = new ReceivePort(); |
452 resultPort.receive((String message, ignored) { | 452 resultPort.receive((String message, ignored) { |
453 resultPort.close(); | 453 resultPort.close(); |
454 Expect.equals("error", message); | 454 Expect.equals("error", message); |
455 }); | 455 }); |
456 | 456 |
457 Directory dir = new Directory(location); | 457 Directory dir = new Directory(location); |
458 dir.onError = (error) { resultPort.toSendPort().send("error"); }; | 458 dir.onError = (error) { resultPort.toSendPort().send("error"); }; |
459 dir.createTemp(() => resultPort.toSendPort().send("success")); | 459 dir.createTemp(() => resultPort.toSendPort().send("success")); |
460 } | 460 } |
461 | 461 |
462 | 462 |
463 main() { | 463 main() { |
464 DirectoryTest.testMain(); | 464 DirectoryTest.testMain(); |
465 NestedTempDirectoryTest.testMain(); | 465 NestedTempDirectoryTest.testMain(); |
466 testCreateTempErrorSync(); | 466 testCreateTempErrorSync(); |
467 testCreateTempError(); | 467 testCreateTempError(); |
468 } | 468 } |
OLD | NEW |