Chromium Code Reviews| Index: tests/standalone/io/file_test.dart |
| diff --git a/tests/standalone/io/file_test.dart b/tests/standalone/io/file_test.dart |
| index b931475e23f23edeb843b3adc3d501f502a7526c..cdde84fa319b717871cb4f81388bd5576a0cb564 100644 |
| --- a/tests/standalone/io/file_test.dart |
| +++ b/tests/standalone/io/file_test.dart |
| @@ -1218,6 +1218,39 @@ class FileTest { |
| Expect.isFalse(file.existsSync()); |
| } |
| + // Test that opens the same file for writing then for appending to test |
|
Anders Johnsen
2013/06/14 07:54:35
Add test for rename of broken link. (Should fail,
Søren Gjesse
2013/06/14 11:00:10
Done.
|
| + // that the file is not truncated when opened for appending. |
| + static void testRename() { |
| + var file = new File('${tempDirectory.path}/rename_name'); |
| + file.create().then((file) { |
| + file.rename("${tempDirectory.path}/rename_newname").then((newfile) { |
| + file.exists().then((e) { |
| + Expect.isFalse(e); |
| + newfile.exists().then((e) { |
| + Expect.isTrue(e); |
| + newfile.delete().then((_) { |
| + file.exists().then((e) { |
| + Expect.isFalse(e); |
| + asyncTestDone("testRename"); |
| + }); |
| + }); |
| + }); |
| + }); |
| + }); |
| + }); |
| + asyncTestStarted(); |
| + } |
| + |
| + static void testRenameSync() { |
| + var file = new File('${tempDirectory.path}/rename_name_sync'); |
| + file.createSync(); |
| + var newfile = file.renameSync('${tempDirectory.path}/rename_newname_sync'); |
| + Expect.isFalse(file.existsSync()); |
| + Expect.isTrue(newfile.existsSync()); |
| + newfile.deleteSync(); |
| + Expect.isFalse(newfile.existsSync()); |
| + } |
| + |
| // Helper method to be able to run the test from the runtime |
| // directory, or the top directory. |
| static String getFilename(String path) => |
| @@ -1276,6 +1309,8 @@ class FileTest { |
| testDirectorySync(); |
| testWriteStringUtf8(); |
| testWriteStringUtf8Sync(); |
| + testRename(); |
| + testRenameSync(); |
| }); |
| } |
| } |