| 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:async"; | 7 import "dart:async"; |
| 8 import "dart:io"; | 8 import "dart:io"; |
| 9 | 9 |
| 10 import "package:async_helper/async_helper.dart"; | 10 import "package:async_helper/async_helper.dart"; |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 for (Directory t in tempDirs) { | 365 for (Directory t in tempDirs) { |
| 366 Expect.isTrue(t.existsSync()); | 366 Expect.isTrue(t.existsSync()); |
| 367 t.deleteSync(); | 367 t.deleteSync(); |
| 368 Expect.isFalse(t.existsSync()); | 368 Expect.isFalse(t.existsSync()); |
| 369 } | 369 } |
| 370 asyncEnd(); | 370 asyncEnd(); |
| 371 }); | 371 }); |
| 372 } | 372 } |
| 373 } | 373 } |
| 374 | 374 |
| 375 static void testCreateTempRelative() { |
| 376 String template = 'dart_relative_temp_dir'; |
| 377 Directory base = new Directory('tmp'); |
| 378 base.createSync(); |
| 379 Expect.isTrue(base.existsSync()); |
| 380 try { |
| 381 Directory tmp = base.createTempSync(template); |
| 382 Expect.isTrue(tmp.existsSync()); |
| 383 Directory tmpCurrent = Directory.current.createTempSync(template); |
| 384 Expect.isTrue(tmpCurrent.existsSync()); |
| 385 tmpCurrent.deleteSync(); |
| 386 } finally { |
| 387 base.deleteSync(recursive: true); |
| 388 } |
| 389 } |
| 390 |
| 375 static void testCreateSystemTemp() { | 391 static void testCreateSystemTemp() { |
| 376 String template = 'dart_system_temp_dir'; | 392 String template = 'dart_system_temp_dir'; |
| 377 asyncStart(); | 393 asyncStart(); |
| 378 Future.wait([ | 394 Future.wait([ |
| 379 Directory.systemTemp.createTemp(template), | 395 Directory.systemTemp.createTemp(template), |
| 380 Directory.systemTemp.createTemp(template) | 396 Directory.systemTemp.createTemp(template) |
| 381 ]).then((tempDirs) { | 397 ]).then((tempDirs) { |
| 382 Expect.notEquals(tempDirs[0].path, tempDirs[1].path); | 398 Expect.notEquals(tempDirs[0].path, tempDirs[1].path); |
| 383 for (Directory t in tempDirs) { | 399 for (Directory t in tempDirs) { |
| 384 Expect.isTrue(t.existsSync()); | 400 Expect.isTrue(t.existsSync()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 testDeleteNonExistentSync(); | 453 testDeleteNonExistentSync(); |
| 438 testDeleteTooLongNameSync(); | 454 testDeleteTooLongNameSync(); |
| 439 testExistsCreateDelete(); | 455 testExistsCreateDelete(); |
| 440 testExistsCreateDeleteSync(); | 456 testExistsCreateDeleteSync(); |
| 441 testDeleteLinkSync(); | 457 testDeleteLinkSync(); |
| 442 testDeleteLinkAsFileSync(); | 458 testDeleteLinkAsFileSync(); |
| 443 testDeleteBrokenLinkAsFileSync(); | 459 testDeleteBrokenLinkAsFileSync(); |
| 444 testListBrokenLinkSync(); | 460 testListBrokenLinkSync(); |
| 445 testListLinkSync(); | 461 testListLinkSync(); |
| 446 testCreateTemp(); | 462 testCreateTemp(); |
| 463 testCreateTempRelative(); |
| 447 testCreateSystemTemp(); | 464 testCreateSystemTemp(); |
| 448 testCreateDeleteTemp(); | 465 testCreateDeleteTemp(); |
| 449 testCurrent(); | 466 testCurrent(); |
| 450 testEquals(); | 467 testEquals(); |
| 451 } | 468 } |
| 452 } | 469 } |
| 453 | 470 |
| 454 class NestedTempDirectoryTest { | 471 class NestedTempDirectoryTest { |
| 455 List<Directory> createdDirectories; | 472 List<Directory> createdDirectories; |
| 456 Directory current; | 473 Directory current; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 DirectoryTest.testMain(); | 636 DirectoryTest.testMain(); |
| 620 NestedTempDirectoryTest.testMain(); | 637 NestedTempDirectoryTest.testMain(); |
| 621 testCreateTempErrorSync(); | 638 testCreateTempErrorSync(); |
| 622 testCreateTempError(); | 639 testCreateTempError(); |
| 623 testCreateExistingSync(); | 640 testCreateExistingSync(); |
| 624 testCreateExisting(); | 641 testCreateExisting(); |
| 625 testCreateDirExistingFileSync(); | 642 testCreateDirExistingFileSync(); |
| 626 testCreateDirExistingFile(); | 643 testCreateDirExistingFile(); |
| 627 testRename(); | 644 testRename(); |
| 628 } | 645 } |
| OLD | NEW |