| 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 | |
| 391 static void testCreateSystemTemp() { | 375 static void testCreateSystemTemp() { |
| 392 String template = 'dart_system_temp_dir'; | 376 String template = 'dart_system_temp_dir'; |
| 393 asyncStart(); | 377 asyncStart(); |
| 394 Future.wait([ | 378 Future.wait([ |
| 395 Directory.systemTemp.createTemp(template), | 379 Directory.systemTemp.createTemp(template), |
| 396 Directory.systemTemp.createTemp(template) | 380 Directory.systemTemp.createTemp(template) |
| 397 ]).then((tempDirs) { | 381 ]).then((tempDirs) { |
| 398 Expect.notEquals(tempDirs[0].path, tempDirs[1].path); | 382 Expect.notEquals(tempDirs[0].path, tempDirs[1].path); |
| 399 for (Directory t in tempDirs) { | 383 for (Directory t in tempDirs) { |
| 400 Expect.isTrue(t.existsSync()); | 384 Expect.isTrue(t.existsSync()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 testDeleteNonExistentSync(); | 437 testDeleteNonExistentSync(); |
| 454 testDeleteTooLongNameSync(); | 438 testDeleteTooLongNameSync(); |
| 455 testExistsCreateDelete(); | 439 testExistsCreateDelete(); |
| 456 testExistsCreateDeleteSync(); | 440 testExistsCreateDeleteSync(); |
| 457 testDeleteLinkSync(); | 441 testDeleteLinkSync(); |
| 458 testDeleteLinkAsFileSync(); | 442 testDeleteLinkAsFileSync(); |
| 459 testDeleteBrokenLinkAsFileSync(); | 443 testDeleteBrokenLinkAsFileSync(); |
| 460 testListBrokenLinkSync(); | 444 testListBrokenLinkSync(); |
| 461 testListLinkSync(); | 445 testListLinkSync(); |
| 462 testCreateTemp(); | 446 testCreateTemp(); |
| 463 testCreateTempRelative(); | |
| 464 testCreateSystemTemp(); | 447 testCreateSystemTemp(); |
| 465 testCreateDeleteTemp(); | 448 testCreateDeleteTemp(); |
| 466 testCurrent(); | 449 testCurrent(); |
| 467 testEquals(); | 450 testEquals(); |
| 468 } | 451 } |
| 469 } | 452 } |
| 470 | 453 |
| 471 class NestedTempDirectoryTest { | 454 class NestedTempDirectoryTest { |
| 472 List<Directory> createdDirectories; | 455 List<Directory> createdDirectories; |
| 473 Directory current; | 456 Directory current; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 DirectoryTest.testMain(); | 619 DirectoryTest.testMain(); |
| 637 NestedTempDirectoryTest.testMain(); | 620 NestedTempDirectoryTest.testMain(); |
| 638 testCreateTempErrorSync(); | 621 testCreateTempErrorSync(); |
| 639 testCreateTempError(); | 622 testCreateTempError(); |
| 640 testCreateExistingSync(); | 623 testCreateExistingSync(); |
| 641 testCreateExisting(); | 624 testCreateExisting(); |
| 642 testCreateDirExistingFileSync(); | 625 testCreateDirExistingFileSync(); |
| 643 testCreateDirExistingFile(); | 626 testCreateDirExistingFile(); |
| 644 testRename(); | 627 testRename(); |
| 645 } | 628 } |
| OLD | NEW |