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

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

Issue 13771010: Fix recursive directory-deletion of top-level files/links. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Actually do the right thing. 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
« no previous file with comments | « runtime/bin/directory_win.cc ('k') | tests/standalone/io/file_system_delete_test.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Dart test program for testing error handling in directory I/O. 5 // Dart test program for testing error handling in directory I/O.
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import "dart:async"; 8 import "dart:async";
9 import "dart:io"; 9 import "dart:io";
10 import "dart:isolate"; 10 import "dart:isolate";
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 checkDeleteNonExistentFileException(e.error); 88 checkDeleteNonExistentFileException(e.error);
89 done(); 89 done();
90 }); 90 });
91 } 91 }
92 92
93 93
94 bool checkDeleteRecursivelyNonExistentFileException(e) { 94 bool checkDeleteRecursivelyNonExistentFileException(e) {
95 Expect.isTrue(e is DirectoryIOException); 95 Expect.isTrue(e is DirectoryIOException);
96 Expect.isTrue(e.osError != null); 96 Expect.isTrue(e.osError != null);
97 Expect.isTrue(e.toString().indexOf("Deletion failed") != -1); 97 Expect.isTrue(e.toString().indexOf("Deletion failed") != -1);
98 if (Platform.operatingSystem == "linux") { 98 // File not not found has error code 2 on all supported platforms.
99 Expect.equals(2, e.osError.errorCode); 99 Expect.equals(2, e.osError.errorCode);
100 } else if (Platform.operatingSystem == "macos") {
101 Expect.equals(2, e.osError.errorCode);
102 } else if (Platform.operatingSystem == "windows") {
103 Expect.equals(3, e.osError.errorCode);
104 }
105 100
106 return true; 101 return true;
107 } 102 }
108 103
109 104
110 void testDeleteRecursivelyNonExistent(Directory temp, Function done) { 105 void testDeleteRecursivelyNonExistent(Directory temp, Function done) {
111 Directory nonExistent = new Directory("${temp.path}/nonExistent"); 106 Directory nonExistent = new Directory("${temp.path}/nonExistent");
112 Expect.throws(() => nonExistent.deleteSync(recursive: true), 107 Expect.throws(() => nonExistent.deleteSync(recursive: true),
113 (e) => checkDeleteRecursivelyNonExistentFileException(e)); 108 (e) => checkDeleteRecursivelyNonExistentFileException(e));
114 109
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 main() { 214 main() {
220 runTest(testCreateInNonExistent); 215 runTest(testCreateInNonExistent);
221 runTest(testCreateTempInNonExistent); 216 runTest(testCreateTempInNonExistent);
222 runTest(testDeleteNonExistent); 217 runTest(testDeleteNonExistent);
223 runTest(testDeleteRecursivelyNonExistent); 218 runTest(testDeleteRecursivelyNonExistent);
224 runTest(testListNonExistent); 219 runTest(testListNonExistent);
225 runTest(testRenameNonExistent); 220 runTest(testRenameNonExistent);
226 runTest(testRenameFileAsDirectory); 221 runTest(testRenameFileAsDirectory);
227 runTest(testRenameOverwriteFile); 222 runTest(testRenameOverwriteFile);
228 } 223 }
OLDNEW
« no previous file with comments | « runtime/bin/directory_win.cc ('k') | tests/standalone/io/file_system_delete_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698