Chromium Code Reviews| Index: tests/standalone/io/directory_test.dart |
| diff --git a/tests/standalone/io/directory_test.dart b/tests/standalone/io/directory_test.dart |
| index 488b1d02b0d07ed978258b4cd80dcdc3baf16191..81455a5d575d59c646e4c4e2958c90a67e161d1e 100644 |
| --- a/tests/standalone/io/directory_test.dart |
| +++ b/tests/standalone/io/directory_test.dart |
| @@ -186,6 +186,36 @@ class DirectoryTest { |
| d.deleteRecursivelySync(); |
| } |
| + static void testDeleteWindowsJunction() { |
|
Søren Gjesse
2012/08/17 07:07:37
Shouldn't we make this test run with symlinks on L
Mads Ager (google)
2012/08/17 07:08:46
Does this test leave a temporary directory behind.
Bob Nystrom
2012/08/20 23:24:32
Done.
Bob Nystrom
2012/08/20 23:24:32
Done.
|
| + if (Platform.operatingSystem != "windows") return; |
| + |
| + // temp/ |
| + // a/ |
| + // file.txt |
| + // b/ |
| + // a_junction -> a |
| + var d = new Directory("").createTempSync(); |
| + new Directory("${d.path}\\a").createSync(); |
| + |
| + var b = new Directory("${d.path}\\b"); |
| + b.createSync(); |
| + |
| + var f = new File("${d.path}\\a\\file.txt"); |
| + f.createSync(); |
| + Expect.isTrue(f.existsSync()); |
| + |
| + // Create a junction from temp/b/a_junction -> temp/a. |
| + var args = ["/c", "mklink", "/j", |
| + "${d.path}\\b\\a_junction", "${d.path}\\a"]; |
| + Process.run("cmd", args).then((_) { |
| + // Delete the directory containing the junction. |
| + b.deleteRecursivelySync(); |
| + |
| + // We should not have recursed through a_junction into a. |
| + Expect.isTrue(f.existsSync()); |
| + }); |
| + } |
| + |
| static void testExistsCreateDelete() { |
| new Directory("").createTemp().then((d) { |
| d.exists().then((bool exists) { |
| @@ -337,6 +367,7 @@ class DirectoryTest { |
| testDeleteTooLongName(); |
| testDeleteNonExistentSync(); |
| testDeleteTooLongNameSync(); |
| + testDeleteWindowsJunction(); |
| testExistsCreateDelete(); |
| testExistsCreateDeleteSync(); |
| testCreateTemp(); |
| @@ -436,6 +467,13 @@ testRename() { |
| }); |
| } |
| +Future<File> writeFile(File file, String contents) { |
|
Mads Ager (google)
2012/08/17 07:08:46
Where are you using this? Remove?
Bob Nystrom
2012/08/20 23:24:32
Done.
|
| + return file.open(FileMode.WRITE).chain((opened) { |
| + return opened.writeString(contents).chain((_) { |
| + return opened.close().transform((ignore) => file); |
| + }); |
| + }); |
| +} |
| main() { |
| DirectoryTest.testMain(); |