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

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

Issue 17848003: dart:io | Add rename to Link (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix again Created 7 years, 6 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/link_async_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/link_test.dart
diff --git a/tests/standalone/io/link_test.dart b/tests/standalone/io/link_test.dart
index 7bef4c55641f77018c4ea7c8b6a89645d3cf386a..956e29f35e6efe33b0b6fdd8e7dd9e1f415bd13f 100644
--- a/tests/standalone/io/link_test.dart
+++ b/tests/standalone/io/link_test.dart
@@ -173,6 +173,28 @@ testCreateLoopingLink() {
new Directory.fromPath(base).delete(recursive: true));
}
+testRenameSync() {
+ testRename(Path base, String target) {
+ Link link1 = new Link.fromPath(base.append('c'))..createSync(target);
+ Expect.isTrue(link1.existsSync());
+ Link link2 = link1.renameSync(base.append('d').toNativePath());
+ Expect.isFalse(link1.existsSync());
+ Expect.isTrue(link2.existsSync());
+ link2.deleteSync();
+ Expect.isFalse(link2.existsSync());
+ }
+
+ Directory baseDir = new Directory('').createTempSync();
+ Path base = new Path(baseDir.path);
+ Directory dir = new Directory.fromPath(base.append('a'))..createSync();
+ File file = new File.fromPath(base.append('b'))..createSync();
+
+ testRename(base, file.path);
+ testRename(base, dir.path);
+
+ baseDir.deleteSync(recursive: true);
+}
+
void testLinkErrorSync() {
Expect.throws(() =>
new Link('some-dir-that-doent exist/some link file/bla/fisk').createSync(
@@ -183,5 +205,6 @@ void testLinkErrorSync() {
main() {
testCreateSync();
testCreateLoopingLink();
+ testRenameSync();
testLinkErrorSync();
}
« no previous file with comments | « tests/standalone/io/link_async_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698