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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "package:path/path.dart"; 6 import "package:path/path.dart";
7 import "dart:async"; 7 import "dart:async";
8 import "dart:io"; 8 import "dart:io";
9 import "dart:isolate"; 9 import "dart:isolate";
10 10
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 baseDir.deleteSync(recursive: true); 193 baseDir.deleteSync(recursive: true);
194 } 194 }
195 195
196 void testLinkErrorSync() { 196 void testLinkErrorSync() {
197 Expect.throws(() => 197 Expect.throws(() =>
198 new Link('some-dir-that-doent exist/some link file/bla/fisk').createSync( 198 new Link('some-dir-that-doent exist/some link file/bla/fisk').createSync(
199 'bla bla bla/b lalal/blfir/sdfred/es'), 199 'bla bla bla/b lalal/blfir/sdfred/es'),
200 (e) => e is LinkException); 200 (e) => e is LinkException);
201 } 201 }
202 202
203 checkExists(String filePath) => Expect.isTrue(new File(filePath).existsSync());
204
205 testRelativeLinksSync() {
206 Directory tempDirectory = new Directory('').createTempSync();
207 String temp = tempDirectory.path;
208 String oldWorkingDirectory = Directory.current.path;
209 // Make directories and files to test links.
210 new Directory(join(temp, 'dir1', 'dir2')).createSync(recursive: true);
211 new File(join(temp, 'dir1', 'file1')).createSync();
212 new File(join(temp, 'dir1', 'dir2', 'file2')).createSync();
213 // Make links whose path and/or target is given by a relative path.
214 new Link(join(temp, 'dir1', 'link1_2')).createSync('dir2');
215 Directory.current = temp;
216 new Link('link0_2').createSync(join('dir1', 'dir2'));
217 new Link(join('dir1', 'link1_0')).createSync('..');
218 Directory.current = 'dir1';
219 new Link(join('..', 'link0_1')).createSync('dir1');
220 new Link(join('dir2', 'link2_1')).createSync(join(temp, 'dir1'));
221 new Link(join(temp, 'dir1', 'dir2', 'link2_0')).createSync(join('..', '..'));
222 // Test that the links go to the right targets.
223 checkExists(join('..', 'link0_1', 'file1'));
224 checkExists(join('..', 'link0_2', 'file2'));
225 checkExists(join('link1_0', 'dir1', 'file1'));
226 checkExists(join('link1_2', 'file2'));
227 checkExists(join('dir2', 'link2_0', 'dir1', 'file1'));
228 checkExists(join('dir2', 'link2_1', 'file1'));
229 // Clean up
230 Directory.current = oldWorkingDirectory;
231 tempDirectory.deleteSync(recursive: true);
232 }
233
203 main() { 234 main() {
204 testCreateSync(); 235 testCreateSync();
205 testCreateLoopingLink(); 236 testCreateLoopingLink();
206 testRenameSync(); 237 testRenameSync();
207 testLinkErrorSync(); 238 testLinkErrorSync();
239 testRelativeLinksSync();
208 } 240 }
OLDNEW
« 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