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

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

Issue 13818010: dart:io | Ensure that Directory.list terminates even when symbolic links create loops in the file s… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add documentation of new behavior. Created 7 years, 8 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
« runtime/bin/directory_linux.cc ('K') | « sdk/lib/io/directory.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "dart:async"; 6 import "dart:async";
7 import "dart:io"; 7 import "dart:io";
8 import "dart:isolate"; 8 import "dart:isolate";
9 9
10 // Test the dart:io Link class. 10 // Test the dart:io Link class.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 f.complete(null); 131 f.complete(null);
132 }); 132 });
133 } 133 }
134 } 134 }
135 Future.wait(futures).then((_) { 135 Future.wait(futures).then((_) {
136 baseDir.deleteSync(recursive: true); 136 baseDir.deleteSync(recursive: true);
137 }); 137 });
138 } 138 }
139 139
140 testCreateLoopingLink() {
141 Path base = new Path(new Directory('').createTempSync().path);
142 new Directory.fromPath(base.append('a/b/c')).create(recursive: true)
143 .then((_) =>
144 new Link.fromPath(base.append('a/b/c/d'))
145 .create(base.append('a/b').toNativePath()))
146 .then((_) =>
147 new Link.fromPath(base.append('a/b/c/e'))
148 .create(base.append('a').toNativePath()))
149 .then((_) =>
150 new Directory.fromPath(base.append('a'))
151 .list(recursive: true,followLinks: false)
Søren Gjesse 2013/04/10 11:33:23 space after ,
Bill Hesse 2013/04/10 12:49:47 Done.
152 .last)
153 .then((_) =>
154 // This directory listing must terminate, even though it contains loops.
155 new Directory.fromPath(base.append('a'))
156 .list(recursive: true,followLinks: true)
Søren Gjesse 2013/04/10 11:33:23 ditto.
157 .last)
158 .then((_) =>
159 // This directory listing must terminate, even though it contains loops.
160 new Directory.fromPath(base.append('a/b/c'))
161 .list(recursive: true, followLinks: true)
162 .last)
163 .then((_) =>
164 new Directory.fromPath(base).delete(recursive: true));
165 }
140 166
141 main() { 167 main() {
142 testCreateSync(); 168 testCreateSync();
169 testCreateLoopingLink();
143 } 170 }
OLDNEW
« runtime/bin/directory_linux.cc ('K') | « sdk/lib/io/directory.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698