| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 if (new Directory("/tmp").existsSync()) { | 285 if (new Directory("/tmp").existsSync()) { |
| 286 stage0(); | 286 stage0(); |
| 287 } else { | 287 } else { |
| 288 emptyTemplateTestRunning = true; | 288 emptyTemplateTestRunning = true; |
| 289 stage3(); | 289 stage3(); |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 | 292 |
| 293 static void testCreateDeleteTemp() { | 293 static void testCreateDeleteTemp() { |
| 294 new Directory("").createTemp().then((tempDirectory) { | 294 new Directory("").createTemp().then((tempDirectory) { |
| 295 String filename = tempDirectory.path + | 295 String filename = |
| 296 Platform.pathSeparator + "dart_testfile"; | 296 "${tempDirectory.path}${Platform.pathSeparator}dart_testfile"; |
| 297 File file = new File(filename); | 297 File file = new File(filename); |
| 298 Expect.isFalse(file.existsSync()); | 298 Expect.isFalse(file.existsSync()); |
| 299 file.create().then((ignore) { | 299 file.create().then((ignore) { |
| 300 file.exists().then((exists) { | 300 file.exists().then((exists) { |
| 301 Expect.isTrue(exists); | 301 Expect.isTrue(exists); |
| 302 // Try to delete the directory containing the file - should throw. | 302 // Try to delete the directory containing the file - should throw. |
| 303 Expect.throws(tempDirectory.deleteSync); | 303 Expect.throws(tempDirectory.deleteSync); |
| 304 Expect.isTrue(tempDirectory.existsSync()); | 304 Expect.isTrue(tempDirectory.existsSync()); |
| 305 | 305 |
| 306 // Delete the file, and then delete the directory. | 306 // Delete the file, and then delete the directory. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 future.handleException((e) => port.close()); | 406 future.handleException((e) => port.close()); |
| 407 } | 407 } |
| 408 | 408 |
| 409 | 409 |
| 410 main() { | 410 main() { |
| 411 DirectoryTest.testMain(); | 411 DirectoryTest.testMain(); |
| 412 NestedTempDirectoryTest.testMain(); | 412 NestedTempDirectoryTest.testMain(); |
| 413 testCreateTempErrorSync(); | 413 testCreateTempErrorSync(); |
| 414 testCreateTempError(); | 414 testCreateTempError(); |
| 415 } | 415 } |
| OLD | NEW |