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

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

Issue 23532066: dart:io | Change creation of symbolic links with relative targets on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Drop .. and . segments from Windows link targets. Created 7 years, 3 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
Index: tests/standalone/io/link_test.dart
diff --git a/tests/standalone/io/link_test.dart b/tests/standalone/io/link_test.dart
index ccf534a05dd9ac8e1bab9a5dcb92cd2fffa7e50e..78aedc844fa867884b19e47b6752c48b2e494417 100644
--- a/tests/standalone/io/link_test.dart
+++ b/tests/standalone/io/link_test.dart
@@ -200,9 +200,41 @@ void testLinkErrorSync() {
(e) => e is LinkException);
}
+checkExists(String filePath) => Expect.isTrue(new File(filePath).existsSync());
+
+testRelativeLinksSync() {
+ Directory tempDirectory = new Directory('').createTempSync();
+ String temp = tempDirectory.path;
+ String oldWorkingDirectory = Directory.current.path;
+ // Make directories and files to test links.
+ new Directory(join(temp, 'dir1', 'dir2')).createSync(recursive: true);
+ new File(join(temp, 'dir1', 'file1')).createSync();
+ new File(join(temp, 'dir1', 'dir2', 'file2')).createSync();
+ // Make links whose path and/or target is given by a relative path.
+ new Link(join(temp, 'dir1', 'link1_2')).createSync('dir2');
+ Directory.current = temp;
+ new Link('link0_2').createSync(join('dir1', 'dir2'));
+ new Link(join('dir1', 'link1_0')).createSync('..');
+ Directory.current = 'dir1';
+ new Link(join('..', 'link0_1')).createSync('dir1');
+ new Link(join('dir2', 'link2_1')).createSync(join(temp, 'dir1'));
+ new Link(join(temp, 'dir1', 'dir2', 'link2_0')).createSync(join('..', '..'));
+ // Test that the links go to the right targets.
+ checkExists(join('..', 'link0_1', 'file1'));
+ checkExists(join('..', 'link0_2', 'file2'));
+ checkExists(join('link1_0', 'dir1', 'file1'));
+ checkExists(join('link1_2', 'file2'));
+ checkExists(join('dir2', 'link2_0', 'dir1', 'file1'));
+ checkExists(join('dir2', 'link2_1', 'file1'));
+ // Clean up
+ Directory.current = oldWorkingDirectory;
+ tempDirectory.deleteSync(recursive: true);
+}
+
main() {
testCreateSync();
testCreateLoopingLink();
testRenameSync();
testLinkErrorSync();
+ testRelativeLinksSync();
}
« tests/standalone/io/link_async_test.dart ('K') | « 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