| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 }); | 313 }); |
| 314 } | 314 } |
| 315 | 315 |
| 316 static void testCurrent() { | 316 static void testCurrent() { |
| 317 Directory current = new Directory.current(); | 317 Directory current = new Directory.current(); |
| 318 if (Platform.operatingSystem != "windows") { | 318 if (Platform.operatingSystem != "windows") { |
| 319 Expect.equals("/", current.path.substring(0, 1)); | 319 Expect.equals("/", current.path.substring(0, 1)); |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 | 322 |
| 323 static void testFromPath() { |
| 324 var name = new File('.').fullPathSync(); |
| 325 Directory current1 = new Directory(name); |
| 326 var path = new Path.fromNative(name); |
| 327 Directory current2 = new Directory.fromPath(path); |
| 328 Expect.equals(current1.path, current2.path); |
| 329 Expect.isTrue(current1.existsSync()); |
| 330 } |
| 331 |
| 323 static void testMain() { | 332 static void testMain() { |
| 324 testListing(); | 333 testListing(); |
| 325 testListNonExistent(); | 334 testListNonExistent(); |
| 326 testListTooLongName(); | 335 testListTooLongName(); |
| 327 testDeleteNonExistent(); | 336 testDeleteNonExistent(); |
| 328 testDeleteTooLongName(); | 337 testDeleteTooLongName(); |
| 329 testDeleteNonExistentSync(); | 338 testDeleteNonExistentSync(); |
| 330 testDeleteTooLongNameSync(); | 339 testDeleteTooLongNameSync(); |
| 331 testExistsCreateDelete(); | 340 testExistsCreateDelete(); |
| 332 testExistsCreateDeleteSync(); | 341 testExistsCreateDeleteSync(); |
| 333 testCreateTemp(); | 342 testCreateTemp(); |
| 334 testCreateDeleteTemp(); | 343 testCreateDeleteTemp(); |
| 335 testCurrent(); | 344 testCurrent(); |
| 345 testFromPath(); |
| 336 } | 346 } |
| 337 } | 347 } |
| 338 | 348 |
| 339 | 349 |
| 340 class NestedTempDirectoryTest { | 350 class NestedTempDirectoryTest { |
| 341 List<Directory> createdDirectories; | 351 List<Directory> createdDirectories; |
| 342 Directory current; | 352 Directory current; |
| 343 | 353 |
| 344 NestedTempDirectoryTest.run() | 354 NestedTempDirectoryTest.run() |
| 345 : createdDirectories = new List<Directory>() { | 355 : createdDirectories = new List<Directory>() { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 } | 437 } |
| 428 | 438 |
| 429 | 439 |
| 430 main() { | 440 main() { |
| 431 DirectoryTest.testMain(); | 441 DirectoryTest.testMain(); |
| 432 NestedTempDirectoryTest.testMain(); | 442 NestedTempDirectoryTest.testMain(); |
| 433 testCreateTempErrorSync(); | 443 testCreateTempErrorSync(); |
| 434 testCreateTempError(); | 444 testCreateTempError(); |
| 435 testRename(); | 445 testRename(); |
| 436 } | 446 } |
| OLD | NEW |