Chromium Code Reviews| 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 // Delete the file, and then delete the directory. | 346 // Delete the file, and then delete the directory. |
| 347 file.delete(() { | 347 file.delete(() { |
| 348 tempDirectory.deleteSync(); | 348 tempDirectory.deleteSync(); |
| 349 Expect.isFalse(tempDirectory.existsSync()); | 349 Expect.isFalse(tempDirectory.existsSync()); |
| 350 }); | 350 }); |
| 351 }); | 351 }); |
| 352 }); | 352 }); |
| 353 }); | 353 }); |
| 354 } | 354 } |
| 355 | 355 |
| 356 static void testCurrent() { | |
| 357 Directory current = new Directory.current(); | |
| 358 if (new Platform().operatingSystem() != "windows") { | |
| 359 Expect.equals("/", current.path.substring(0, 1)); | |
|
Bill Hesse
2012/03/08 11:26:34
Why can't we test that Directory.current() is the
| |
| 360 } | |
| 361 } | |
| 362 | |
| 356 static void testMain() { | 363 static void testMain() { |
| 357 testListing(); | 364 testListing(); |
| 358 testListNonExistent(); | 365 testListNonExistent(); |
| 359 testListTooLongName(); | 366 testListTooLongName(); |
| 360 testDeleteNonExistent(); | 367 testDeleteNonExistent(); |
| 361 testDeleteTooLongName(); | 368 testDeleteTooLongName(); |
| 362 testDeleteNonExistentSync(); | 369 testDeleteNonExistentSync(); |
| 363 testDeleteTooLongNameSync(); | 370 testDeleteTooLongNameSync(); |
| 364 testExistsCreateDelete(); | 371 testExistsCreateDelete(); |
| 365 testExistsCreateDeleteSync(); | 372 testExistsCreateDeleteSync(); |
| 366 testCreateTemp(); | 373 testCreateTemp(); |
| 367 testCreateDeleteTemp(); | 374 testCreateDeleteTemp(); |
| 375 testCurrent(); | |
| 368 } | 376 } |
| 369 } | 377 } |
| 370 | 378 |
| 371 | 379 |
| 372 class NestedTempDirectoryTest { | 380 class NestedTempDirectoryTest { |
| 373 List<Directory> createdDirectories; | 381 List<Directory> createdDirectories; |
| 374 Directory current; | 382 Directory current; |
| 375 | 383 |
| 376 NestedTempDirectoryTest.run() | 384 NestedTempDirectoryTest.run() |
| 377 : createdDirectories = new List<Directory>(), | 385 : createdDirectories = new List<Directory>(), |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 dir.createTemp(() => resultPort.toSendPort().send("success")); | 458 dir.createTemp(() => resultPort.toSendPort().send("success")); |
| 451 } | 459 } |
| 452 | 460 |
| 453 | 461 |
| 454 main() { | 462 main() { |
| 455 DirectoryTest.testMain(); | 463 DirectoryTest.testMain(); |
| 456 NestedTempDirectoryTest.testMain(); | 464 NestedTempDirectoryTest.testMain(); |
| 457 testCreateTempErrorSync(); | 465 testCreateTempErrorSync(); |
| 458 testCreateTempError(); | 466 testCreateTempError(); |
| 459 } | 467 } |
| OLD | NEW |