Index: tests/standalone/io/file_copy_test.dart |
diff --git a/tests/standalone/io/file_copy_test.dart b/tests/standalone/io/file_copy_test.dart |
index 2ef7358dd53161624dad4664ed4450656111f7f5..2302a4a037b65e38bee4750a8ffad861c4b2083f 100644 |
--- a/tests/standalone/io/file_copy_test.dart |
+++ b/tests/standalone/io/file_copy_test.dart |
@@ -38,7 +38,6 @@ void testCopySync() { |
tmp.deleteSync(recursive: true); |
} |
- |
void testCopy() { |
asyncStart(); |
var tmp = Directory.systemTemp.createTempSync('dart-file-copy'); |
@@ -48,38 +47,32 @@ void testCopy() { |
Expect.equals(FILE_CONTENT1, file1.readAsStringSync()); |
// Copy to new file works. |
- file1.copy('${tmp.path}/file2') |
- .then((file2) { |
- Expect.equals(FILE_CONTENT1, file1.readAsStringSync()); |
- Expect.equals(FILE_CONTENT1, file2.readAsStringSync()); |
- |
- // Override works for files. |
- file2.writeAsStringSync(FILE_CONTENT2); |
- return file2.copy(file1.path) |
- .then((_) { |
- Expect.equals(FILE_CONTENT2, file1.readAsStringSync()); |
- Expect.equals(FILE_CONTENT2, file2.readAsStringSync()); |
- |
- // Fail when coping to directory. |
- var dir = new Directory('${tmp.path}/dir')..createSync(); |
- |
- return file1.copy(dir.path) |
- .then((_) => Expect.fail('expected error'), |
- onError: (_) {}) |
- .then((_) { |
- Expect.equals(FILE_CONTENT2, file1.readAsStringSync()); |
- }); |
- |
- }); |
- }) |
- .whenComplete(() { |
- tmp.deleteSync(recursive: true); |
- asyncEnd(); |
+ file1.copy('${tmp.path}/file2').then((file2) { |
+ Expect.equals(FILE_CONTENT1, file1.readAsStringSync()); |
+ Expect.equals(FILE_CONTENT1, file2.readAsStringSync()); |
+ |
+ // Override works for files. |
+ file2.writeAsStringSync(FILE_CONTENT2); |
+ return file2.copy(file1.path).then((_) { |
+ Expect.equals(FILE_CONTENT2, file1.readAsStringSync()); |
+ Expect.equals(FILE_CONTENT2, file2.readAsStringSync()); |
+ |
+ // Fail when coping to directory. |
+ var dir = new Directory('${tmp.path}/dir')..createSync(); |
+ |
+ return file1 |
+ .copy(dir.path) |
+ .then((_) => Expect.fail('expected error'), onError: (_) {}) |
+ .then((_) { |
+ Expect.equals(FILE_CONTENT2, file1.readAsStringSync()); |
+ }); |
}); |
- |
+ }).whenComplete(() { |
+ tmp.deleteSync(recursive: true); |
+ asyncEnd(); |
+ }); |
} |
- |
main() { |
testCopySync(); |
testCopy(); |