Index: tests/standalone/io/file_stat_test.dart |
diff --git a/tests/standalone/io/file_stat_test.dart b/tests/standalone/io/file_stat_test.dart |
index 429d33705424ed852627b9b0d86fc4f58653374d..d7e134da41ab09a45808d9803cd0bb0318f4c6fa 100644 |
--- a/tests/standalone/io/file_stat_test.dart |
+++ b/tests/standalone/io/file_stat_test.dart |
@@ -32,59 +32,56 @@ void testStat() { |
Expect.isTrue(fileStat.modified.compareTo(fileStat.accessed) < 0); |
Expect.isTrue(fileStat.changed.compareTo(fileStat.accessed) < 0); |
} |
- Expect.equals(6 << 6, fileStat.mode & (6 << 6)); // Mode includes +urw. |
+ Expect.equals(6 << 6, fileStat.mode & (6 << 6)); // Mode includes +urw. |
FileStat directoryStat = FileStat.statSync(directory.path); |
FileStat directoryStatDirect = directory.statSync(); |
Expect.equals(FileSystemEntityType.DIRECTORY, directoryStat.type); |
Expect.equals(FileSystemEntityType.DIRECTORY, directoryStatDirect.type); |
if (Platform.operatingSystem != 'windows') { |
- Expect.isTrue( |
- directoryStat.modified.compareTo(directoryStat.accessed) < 0); |
- Expect.isTrue( |
- directoryStat.changed.compareTo(directoryStat.accessed) < 0); |
+ Expect |
+ .isTrue(directoryStat.modified.compareTo(directoryStat.accessed) < 0); |
+ Expect |
+ .isTrue(directoryStat.changed.compareTo(directoryStat.accessed) < 0); |
} |
- Expect.equals(7 << 6, directoryStat.mode & (7 << 6)); // Includes +urwx. |
+ Expect.equals(7 << 6, directoryStat.mode & (7 << 6)); // Includes +urwx. |
directory.deleteSync(recursive: true); |
}); |
} |
- |
Future testStatAsync() { |
- return Directory.systemTemp.createTemp('dart_file_stat') |
- .then((directory) { |
+ return Directory.systemTemp.createTemp('dart_file_stat').then((directory) { |
File file = new File(join(directory.path, "file")); |
- return FileStat.stat(file.path) |
- .then((fileStat) => Expect.equals(FileSystemEntityType.NOT_FOUND, |
- fileStat.type)) |
- .then((_) => file.stat()) |
- .then((fileStat) => Expect.equals(FileSystemEntityType.NOT_FOUND, |
- fileStat.type)) |
- .then((_) => file.writeAsString("Dart IO library test of FileStat")) |
- .then((_) => new Future.delayed(const Duration(seconds: 2))) |
- .then((_) => file.readAsString()) |
- .then((_) => directory.list().last) |
- .then((_) => FileStat.stat(file.path)) |
- .then((FileStat fileStat) { |
+ return FileStat |
+ .stat(file.path) |
+ .then((fileStat) => |
+ Expect.equals(FileSystemEntityType.NOT_FOUND, fileStat.type)) |
+ .then((_) => file.stat()) |
+ .then((fileStat) => |
+ Expect.equals(FileSystemEntityType.NOT_FOUND, fileStat.type)) |
+ .then((_) => file.writeAsString("Dart IO library test of FileStat")) |
+ .then((_) => new Future.delayed(const Duration(seconds: 2))) |
+ .then((_) => file.readAsString()) |
+ .then((_) => directory.list().last) |
+ .then((_) => FileStat.stat(file.path)) |
+ .then((FileStat fileStat) { |
Expect.equals(FileSystemEntityType.FILE, fileStat.type); |
Expect.equals(32, fileStat.size); |
if (Platform.operatingSystem != 'windows') { |
Expect.isTrue(fileStat.modified.compareTo(fileStat.accessed) < 0); |
Expect.isTrue(fileStat.changed.compareTo(fileStat.accessed) < 0); |
} |
- Expect.equals(6 << 6, fileStat.mode & (6 << 6)); // Mode includes +urw. |
+ Expect.equals(6 << 6, fileStat.mode & (6 << 6)); // Mode includes +urw. |
return file.stat(); |
- }) |
- .then((FileStat fileStat) { |
+ }).then((FileStat fileStat) { |
Expect.equals(FileSystemEntityType.FILE, fileStat.type); |
Expect.equals(32, fileStat.size); |
if (Platform.operatingSystem != 'windows') { |
Expect.isTrue(fileStat.modified.compareTo(fileStat.accessed) < 0); |
Expect.isTrue(fileStat.changed.compareTo(fileStat.accessed) < 0); |
} |
- Expect.equals(6 << 6, fileStat.mode & (6 << 6)); // Mode includes +urw. |
+ Expect.equals(6 << 6, fileStat.mode & (6 << 6)); // Mode includes +urw. |
return FileStat.stat(directory.path); |
- }) |
- .then((FileStat directoryStat) { |
+ }).then((FileStat directoryStat) { |
Expect.equals(FileSystemEntityType.DIRECTORY, directoryStat.type); |
if (Platform.operatingSystem != 'windows') { |
Expect.isTrue( |
@@ -92,10 +89,9 @@ Future testStatAsync() { |
Expect.isTrue( |
directoryStat.changed.compareTo(directoryStat.accessed) < 0); |
} |
- Expect.equals(7 << 6, directoryStat.mode & (7 << 6)); // Includes +urwx. |
+ Expect.equals(7 << 6, directoryStat.mode & (7 << 6)); // Includes +urwx. |
return directory.stat(); |
- }) |
- .then((FileStat directoryStat) { |
+ }).then((FileStat directoryStat) { |
Expect.equals(FileSystemEntityType.DIRECTORY, directoryStat.type); |
if (Platform.operatingSystem != 'windows') { |
Expect.isTrue( |
@@ -103,24 +99,20 @@ Future testStatAsync() { |
Expect.isTrue( |
directoryStat.changed.compareTo(directoryStat.accessed) < 0); |
} |
- Expect.equals(7 << 6, directoryStat.mode & (7 << 6)); // Includes +urwx. |
+ Expect.equals(7 << 6, directoryStat.mode & (7 << 6)); // Includes +urwx. |
return new Link(directory.path).stat(); |
- }) |
- .then((FileStat linkStat) { |
+ }).then((FileStat linkStat) { |
Expect.equals(FileSystemEntityType.DIRECTORY, linkStat.type); |
if (Platform.operatingSystem != 'windows') { |
- Expect.isTrue( |
- linkStat.modified.compareTo(linkStat.accessed) < 0); |
- Expect.isTrue( |
- linkStat.changed.compareTo(linkStat.accessed) < 0); |
+ Expect.isTrue(linkStat.modified.compareTo(linkStat.accessed) < 0); |
+ Expect.isTrue(linkStat.changed.compareTo(linkStat.accessed) < 0); |
} |
- Expect.equals(7 << 6, linkStat.mode & (7 << 6)); // Includes +urwx. |
+ Expect.equals(7 << 6, linkStat.mode & (7 << 6)); // Includes +urwx. |
return directory.delete(recursive: true); |
}); |
}); |
} |
- |
void main() { |
asyncStart(); |
testStat(); |