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

Unified Diff: tests/standalone/io/directory_test.dart

Issue 2580133002: Fix directory existence query error (Closed)
Patch Set: Created 4 years 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
« runtime/bin/directory_android.cc ('K') | « runtime/bin/directory_macos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/directory_test.dart
diff --git a/tests/standalone/io/directory_test.dart b/tests/standalone/io/directory_test.dart
index 14685b105db00a29ecf491ec09132ea8b98b3b58..990d98266b224f01032367b64dab9d03ac477593 100644
--- a/tests/standalone/io/directory_test.dart
+++ b/tests/standalone/io/directory_test.dart
@@ -603,14 +603,24 @@ testRename() {
Expect.isTrue(temp2.existsSync());
Expect.equals(temp3.path, temp2.path);
- temp2.rename(temp1.path).then((temp4) {
- Expect.isFalse(temp3.existsSync());
- Expect.isFalse(temp2.existsSync());
- Expect.isTrue(temp1.existsSync());
- Expect.isTrue(temp4.existsSync());
- Expect.equals(temp1.path, temp4.path);
- temp1.deleteSync(recursive: true);
- });
+ var temp4 = temp2.renameSync(temp1.path);
+ Expect.isFalse(temp3.existsSync());
+ Expect.isFalse(temp2.existsSync());
+ Expect.isTrue(temp1.existsSync());
+ Expect.isTrue(temp4.existsSync());
+ Expect.equals(temp1.path, temp4.path);
+ temp1.deleteSync(recursive: true);
+
+ var file = new File('${temp4.path}/foo');
+ try {
+ new Directory('${temp4.path}/foo').renameSync('${temp4.path}/bar');
+ Expect.fail('Directory.rename should fail to rename a non-directory');
+ } catch (e) {
+ Expect.isTrue(e is FileSystemException);
+ if (Platform.isLinux || Platform.isMacOS) {
+ Expect.isTrue(e.osError.message.contains('No such file or directory'));
+ }
+ }
}
main() {
« runtime/bin/directory_android.cc ('K') | « runtime/bin/directory_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698