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

Unified Diff: tests/standalone/io/file_system_delete_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone/io/directory_error_test.dart ('k') | utils/pub/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/file_system_delete_test.dart
diff --git a/tests/standalone/io/file_system_delete_test.dart b/tests/standalone/io/file_system_delete_test.dart
index 8768ed7a0ca3c6536d4eb488de24c8aa39c4ddc8..e82cc717a7751613e1771d86896ddd51fc32a327 100644
--- a/tests/standalone/io/file_system_delete_test.dart
+++ b/tests/standalone/io/file_system_delete_test.dart
@@ -27,11 +27,13 @@ void testDeleteFileSync() {
file.createSync();
Expect.isTrue(file.existsSync());
- Expect.throws(() => new Directory(file.path).deleteSync());
- Expect.isTrue(file.existsSync());
+ new Directory(file.path).deleteSync(recursive: true);
+ Expect.isFalse(file.existsSync());
+
+ file.createSync();
Expect.isTrue(file.existsSync());
- Expect.throws(() => new Directory(file.path).deleteSync(recursive: true));
+ Expect.throws(() => new Directory(file.path).deleteSync());
Expect.isTrue(file.existsSync());
Expect.isTrue(file.existsSync());
@@ -56,12 +58,13 @@ void testDeleteFile() {
.then((_) => file.create())
.then((_) => file.exists().then(Expect.isTrue))
- .then((_) => throws(() => new Directory(file.path).delete()))
- .then((_) => file.exists().then(Expect.isTrue))
+ .then((_) => new Directory(file.path).delete(recursive: true))
+ .then((_) => file.exists().then(Expect.isFalse))
+
+ .then((_) => file.create())
.then((_) => file.exists().then(Expect.isTrue))
- .then((_) => throws(
- () => new Directory(file.path).delete(recursive: true)))
+ .then((_) => throws(() => new Directory(file.path).delete()))
.then((_) => file.exists().then(Expect.isTrue))
.then((_) => file.exists().then(Expect.isTrue))
@@ -161,11 +164,13 @@ void testDeleteFileLinkSync() {
link.createSync(file.path);
Expect.isTrue(link.existsSync());
- Expect.throws(() => new Directory(link.path).deleteSync());
- Expect.isTrue(link.existsSync());
+ new Directory(link.path).deleteSync(recursive: true);
+ Expect.isFalse(link.existsSync());
+
+ link.createSync(file.path);
Expect.isTrue(link.existsSync());
- Expect.throws(() => new Directory(link.path).deleteSync(recursive: true));
+ Expect.throws(() => new Directory(link.path).deleteSync());
Expect.isTrue(link.existsSync());
link.deleteSync();
@@ -199,12 +204,13 @@ void testDeleteFileLink() {
.then((_) => link.create(file.path))
.then((_) => link.exists().then(Expect.isTrue))
- .then((_) => throws(() => new Directory(link.path).delete()))
- .then((_) => link.exists().then(Expect.isTrue))
+ .then((_) => new Directory(link.path).delete(recursive: true))
+ .then((_) => link.exists().then(Expect.isFalse))
+
+ .then((_) => link.create(file.path))
.then((_) => link.exists().then(Expect.isTrue))
- .then((_) => throws(
- () => new Directory(link.path).delete(recursive: true)))
+ .then((_) => throws(() => new Directory(link.path).delete()))
.then((_) => link.exists().then(Expect.isTrue))
.then((_) => link.deleteSync())
@@ -323,11 +329,15 @@ void testDeleteBrokenLinkSync() {
directory.deleteSync();
Expect.isTrue(link.existsSync());
- Expect.throws(() => new Directory(link.path).deleteSync());
- Expect.isTrue(link.existsSync());
+ new Directory(link.path).deleteSync(recursive: true);
+ Expect.isFalse(link.existsSync());
+
+ directory.createSync();
+ link.createSync(directory.path);
+ directory.deleteSync();
Expect.isTrue(link.existsSync());
- Expect.throws(() => new Directory(link.path).deleteSync(recursive: true));
+ Expect.throws(() => new Directory(link.path).deleteSync());
Expect.isTrue(link.existsSync());
Expect.isTrue(link.existsSync());
@@ -358,12 +368,15 @@ void testDeleteBrokenLink() {
.then((_) => dir.delete())
.then((_) => link.exists().then(Expect.isTrue))
- .then((_) => throws(() => new Directory(link.path).delete()))
- .then((_) => link.exists().then(Expect.isTrue))
+ .then((_) => new Directory(link.path).delete(recursive: true))
+ .then((_) => link.exists().then(Expect.isFalse))
+
+ .then((_) => dir.create())
+ .then((_) => link.create(dir.path))
+ .then((_) => dir.delete())
.then((_) => link.exists().then(Expect.isTrue))
- .then((_) => throws(
- () => new Directory(link.path).delete(recursive: true)))
+ .then((_) => throws(() => new Directory(link.path).delete()))
.then((_) => link.exists().then(Expect.isTrue))
.then((_) => link.exists().then(Expect.isTrue))
« no previous file with comments | « tests/standalone/io/directory_error_test.dart ('k') | utils/pub/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698