| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Dart test program for testing dart:io FileSystemEntity.Stat(). | 5 // Dart test program for testing dart:io FileSystemEntity.Stat(). |
| 6 | 6 |
| 7 import 'dart:async'; |
| 8 import 'dart:io'; |
| 9 |
| 10 import "package:async_helper/async_helper.dart"; |
| 7 import "package:expect/expect.dart"; | 11 import "package:expect/expect.dart"; |
| 8 import "package:path/path.dart"; | 12 import "package:path/path.dart"; |
| 9 import 'dart:async'; | |
| 10 import 'dart:io'; | |
| 11 import 'dart:isolate'; | |
| 12 | 13 |
| 13 void testStat() { | 14 void testStat() { |
| 14 Directory directory = new Directory("").createTempSync(); | 15 Directory directory = new Directory("").createTempSync(); |
| 15 File file = new File(join(directory.path, "file")); | 16 File file = new File(join(directory.path, "file")); |
| 16 Expect.throws(file.statSync); | 17 Expect.throws(file.statSync); |
| 17 Expect.throws(() => FileStat.statSync(file.path)); | 18 Expect.throws(() => FileStat.statSync(file.path)); |
| 18 file.writeAsStringSync("Dart IO library test of FileStat"); | 19 file.writeAsStringSync("Dart IO library test of FileStat"); |
| 19 new Timer(const Duration(seconds: 2), () { | 20 new Timer(const Duration(seconds: 2), () { |
| 20 file.readAsStringSync(); | 21 file.readAsStringSync(); |
| 21 directory.listSync(); | 22 directory.listSync(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 linkStat.changed.compareTo(linkStat.accessed) < 0); | 113 linkStat.changed.compareTo(linkStat.accessed) < 0); |
| 113 } | 114 } |
| 114 Expect.equals(7 << 6, linkStat.mode & (7 << 6)); // Includes +urwx. | 115 Expect.equals(7 << 6, linkStat.mode & (7 << 6)); // Includes +urwx. |
| 115 return directory.delete(recursive: true); | 116 return directory.delete(recursive: true); |
| 116 }); | 117 }); |
| 117 }); | 118 }); |
| 118 } | 119 } |
| 119 | 120 |
| 120 | 121 |
| 121 void main() { | 122 void main() { |
| 122 ReceivePort keepAlive = new ReceivePort(); | 123 asyncStart(); |
| 123 testStat(); | 124 testStat(); |
| 124 testStatAsync().then((_) => keepAlive.close()); | 125 testStatAsync().then((_) => asyncEnd()); |
| 125 } | 126 } |
| OLD | NEW |