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

Side by Side Diff: tests/standalone/io/delete_symlink_test.dart

Issue 23886004: Update dart:io tests to use asyncStart/asyncEnd (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:io';
6
7 import "package:async_helper/async_helper.dart";
5 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
6 import 'dart:io';
7 import 'dart:isolate';
8 9
9 void main() { 10 void main() {
10 // temp/ 11 // temp/
11 // a/ 12 // a/
12 // file.txt 13 // file.txt
13 // b/ 14 // b/
14 // a_link -> a 15 // a_link -> a
15 var d = new Directory("").createTempSync(); 16 var d = new Directory("").createTempSync();
16 var a = new Directory("${d.path}/a"); 17 var a = new Directory("${d.path}/a");
17 a.createSync(); 18 a.createSync();
18 19
19 var b = new Directory("${d.path}/b"); 20 var b = new Directory("${d.path}/b");
20 b.createSync(); 21 b.createSync();
21 22
22 var f = new File("${d.path}/a/file.txt"); 23 var f = new File("${d.path}/a/file.txt");
23 f.createSync(); 24 f.createSync();
24 Expect.isTrue(f.existsSync()); 25 Expect.isTrue(f.existsSync());
25 26
26 // Create a symlink (or junction on Windows) from 27 // Create a symlink (or junction on Windows) from
27 // temp/b/a_link to temp/a. 28 // temp/b/a_link to temp/a.
28 var cmd = "ln"; 29 var cmd = "ln";
29 var args = ['-s', "${d.path}/b/a_link", "${d.path}/a"]; 30 var args = ['-s', "${d.path}/b/a_link", "${d.path}/a"];
30 31
31 if (Platform.operatingSystem == "windows") { 32 if (Platform.operatingSystem == "windows") {
32 cmd = "cmd"; 33 cmd = "cmd";
33 args = ["/c", "mklink", "/j", "${d.path}\\b\\a_link", "${d.path}\\a"]; 34 args = ["/c", "mklink", "/j", "${d.path}\\b\\a_link", "${d.path}\\a"];
34 } 35 }
35 36
36 var keepAlive = new ReceivePort(); 37 asyncStart();
37 38
38 Process.run(cmd, args).then((_) { 39 Process.run(cmd, args).then((_) {
39 // Delete the directory containing the junction. 40 // Delete the directory containing the junction.
40 b.deleteSync(recursive: true); 41 b.deleteSync(recursive: true);
41 42
42 // We should not have recursed through a_link into a. 43 // We should not have recursed through a_link into a.
43 Expect.isTrue(f.existsSync()); 44 Expect.isTrue(f.existsSync());
44 45
45 // Clean up after ourselves. 46 // Clean up after ourselves.
46 d.deleteSync(recursive: true); 47 d.deleteSync(recursive: true);
47 48
48 // Terminate now that we are done with everything. 49 // Terminate now that we are done with everything.
49 keepAlive.close(); 50 asyncEnd();
50 }); 51 });
51 } 52 }
OLDNEW
« no previous file with comments | « tests/standalone/io/async_catch_errors_test.dart ('k') | tests/standalone/io/directory_chdir_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698