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

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

Issue 12295016: Add deletion of temp directory. This test leaves temp directories around. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 // Directory listing test that tests listSync on a missing directory. 5 // Directory listing test that tests listSync on a missing directory.
6 // 6 //
7 // TODO(7157): Merge this test into directory_test.dart testListNonExistent() 7 // TODO(7157): Merge this test into directory_test.dart testListNonExistent()
8 // when it no longer crashes on Windows, when issue 7157 is resolved. 8 // when it no longer crashes on Windows, when issue 7157 is resolved.
9 9
10 import "dart:io"; 10 import "dart:io";
11 import "dart:isolate"; 11 import "dart:isolate";
12 12
13 void testListNonExistent() { 13 void testListNonExistent() {
14 var keepAlive = new ReceivePort();
14 new Directory("").createTemp().then((d) { 15 new Directory("").createTemp().then((d) {
15 d.delete().then((ignore) { 16 d.delete().then((ignore) {
16 Expect.throws(() => d.listSync(), (e) => e is DirectoryIOException); 17 Expect.throws(() => d.listSync(), (e) => e is DirectoryIOException);
17 Expect.throws(() => d.listSync(recursive: true), 18 Expect.throws(() => d.listSync(recursive: true),
18 (e) => e is DirectoryIOException); 19 (e) => e is DirectoryIOException);
20 keepAlive.close();
19 }); 21 });
20 }); 22 });
21 } 23 }
22 24
23 void testListTooLongName() { 25 void testListTooLongName() {
26 var keepAlive = new ReceivePort();
24 new Directory("").createTemp().then((d) { 27 new Directory("").createTemp().then((d) {
25 var subDirName = 'subdir'; 28 var subDirName = 'subdir';
26 var subDir = new Directory("${d.path}/$subDirName"); 29 var subDir = new Directory("${d.path}/$subDirName");
27 subDir.create().then((ignore) { 30 subDir.create().then((ignore) {
28 // Construct a long string of the form 31 // Construct a long string of the form
29 // 'tempdir/subdir/../subdir/../subdir'. 32 // 'tempdir/subdir/../subdir/../subdir'.
30 var buffer = new StringBuffer(); 33 var buffer = new StringBuffer();
31 buffer.add(subDir.path); 34 buffer.add(subDir.path);
32 for (var i = 0; i < 1000; i++) { 35 for (var i = 0; i < 1000; i++) {
33 buffer.add("/../${subDirName}"); 36 buffer.add("/../${subDirName}");
34 } 37 }
35 var long = new Directory("${buffer.toString()}"); 38 var long = new Directory("${buffer.toString()}");
36 Expect.throws(() => long.listSync(), 39 Expect.throws(() => long.listSync(),
37 (e) => e is DirectoryIOException); 40 (e) => e is DirectoryIOException);
38 Expect.throws(() => long.listSync(recursive: true), 41 Expect.throws(() => long.listSync(recursive: true),
39 (e) => e is DirectoryIOException); 42 (e) => e is DirectoryIOException);
43 d.deleteSync(recursive: true);
44 keepAlive.close();
40 }); 45 });
41 }); 46 });
42 } 47 }
43 48
44 void main() { 49 void main() {
45 testListNonExistent(); 50 testListNonExistent();
46 testListTooLongName(); 51 testListTooLongName();
47 } 52 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698