Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Unified Diff: tests/standalone/io/delete_symlink_test.dart

Issue 12328037: Add missing files from previous commit (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/utf/utf_stream.dart ('k') | tests/standalone/io/http_client_connect_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/delete_symlink_test.dart
diff --git a/tests/standalone/io/delete_symlink_test.dart b/tests/standalone/io/delete_symlink_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..3161eb43df111bae9adda5681cdee20f119c7738
--- /dev/null
+++ b/tests/standalone/io/delete_symlink_test.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:io';
+import 'dart:isolate';
+
+void main() {
+ // temp/
+ // a/
+ // file.txt
+ // b/
+ // a_link -> a
+ var d = new Directory("").createTempSync();
+ var a = new Directory("${d.path}/a");
+ 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 symlink (or junction on Windows) from
+ // temp/b/a_link to temp/a.
+ var cmd = "ln";
+ var args = ['-s', "${d.path}/b/a_link", "${d.path}/a"];
+
+ if (Platform.operatingSystem == "windows") {
+ cmd = "cmd";
+ args = ["/c", "mklink", "/j", "${d.path}\\b\\a_link", "${d.path}\\a"];
+ }
+
+ var keepAlive = new ReceivePort();
+
+ Process.run(cmd, args).then((_) {
+ // Delete the directory containing the junction.
+ b.deleteSync(recursive: true);
+
+ // We should not have recursed through a_link into a.
+ Expect.isTrue(f.existsSync());
+
+ // Clean up after ourselves.
+ d.deleteSync(recursive: true);
+
+ // Terminate now that we are done with everything.
+ keepAlive.close();
+ });
+}
« no previous file with comments | « sdk/lib/utf/utf_stream.dart ('k') | tests/standalone/io/http_client_connect_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698