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

Side by Side Diff: tests/standalone/io/resolve_symbolic_links_test.dart

Issue 23465020: Fix Windows test of resolveSymbolicLinks (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Dart test program for testing FileSystemEntity.resolveSymbolicLinks 5 // Dart test program for testing FileSystemEntity.resolveSymbolicLinks
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import "package:path/path.dart"; 8 import "package:path/path.dart";
9 import "package:async_helper/async_helper.dart"; 9 import "package:async_helper/async_helper.dart";
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 testLink(join(temp, 'link1', '..', '..', 'link1'))]); 54 testLink(join(temp, 'link1', '..', '..', 'link1'))]);
55 } 55 }
56 }) 56 })
57 .then((_) { 57 .then((_) {
58 Directory.current = temp; 58 Directory.current = temp;
59 return Future.wait([ 59 return Future.wait([
60 testFile('dir1/dir2/file2'), // Test forward slashes on Windows too. 60 testFile('dir1/dir2/file2'), // Test forward slashes on Windows too.
61 testFile('link1/file2'), 61 testFile('link1/file2'),
62 testFile(join('dir1', '..', 'dir1', '.', 'file1')), 62 testFile(join('dir1', '..', 'dir1', '.', 'file1')),
63 testDir('.'), 63 testDir('.'),
64 testDir('link1/.'),
65 testLink('link1')]); 64 testLink('link1')]);
66 }) 65 })
67 .then((_) { 66 .then((_) {
68 Directory.current = 'link1'; 67 Directory.current = 'link1';
69 if (Platform.isWindows) { 68 if (Platform.isWindows) {
70 return Future.wait([ 69 return Future.wait([
71 testFile('file2'), 70 testFile('file2'),
72 // Windows applies '..' to a link without resolving the link first. 71 // Windows applies '..' to a link without resolving the link first.
73 testFile('..\\dir1\\file1'), 72 testFile('..\\dir1\\file1'),
74 testDir('.'), 73 testLink('.'),
75 testDir('..'), 74 testDir('..'),
76 testLink('..\\link1')]); 75 testLink('..\\link1')]);
77 } else { 76 } else {
78 return Future.wait([ 77 return Future.wait([
79 testFile('file2'), 78 testFile('file2'),
80 // On non-Windows the link is changed to dir1/dir2 before .. happens. 79 // On non-Windows the link is changed to dir1/dir2 before .. happens.
81 testFile('../dir2/file2'), 80 testFile('../dir2/file2'),
82 testDir('.'), 81 testDir('.'),
83 testDir('..'), 82 testDir('..'),
83 testDir('link1/.'),
84 testLink('../../link1')]); 84 testLink('../../link1')]);
85 } 85 }
86 }) 86 })
87 .whenComplete(() => tempDir.delete(recursive: true)); 87 .whenComplete(() {
88 Directory.current = testsDir;
89 tempDir.delete(recursive: true);
90 });
88 })); 91 }));
89 } 92 }
90 93
91 Future makeEntities(String temp) { 94 Future makeEntities(String temp) {
92 return new Directory(join(temp, 'dir1', 'dir2')).create(recursive: true) 95 return new Directory(join(temp, 'dir1', 'dir2')).create(recursive: true)
93 .then((_) => new File(join(temp, 'dir1', 'dir2', 'file2')).create()) 96 .then((_) => new File(join(temp, 'dir1', 'dir2', 'file2')).create())
94 .then((_) => new File(join(temp, 'dir1', 'file1')).create()) 97 .then((_) => new File(join(temp, 'dir1', 'file1')).create())
95 .then((_) => new Link(join(temp, 'link1')) 98 .then((_) => new Link(join(temp, 'link1'))
96 .create(join(temp, 'dir1', 'dir2'))); 99 .create(join(temp, 'dir1', 'dir2')));
97 } 100 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 Expect.isTrue(isAbsolute(resolved)); 139 Expect.isTrue(isAbsolute(resolved));
137 // Test that resolveSymbolicLinks removes all links, .., and . segments. 140 // Test that resolveSymbolicLinks removes all links, .., and . segments.
138 Expect.isFalse(resolved.contains('..')); 141 Expect.isFalse(resolved.contains('..'));
139 Expect.isFalse(resolved.contains('./')); 142 Expect.isFalse(resolved.contains('./'));
140 Expect.isFalse(resolved.contains('link1')); 143 Expect.isFalse(resolved.contains('link1'));
141 return new Link(name).target() 144 return new Link(name).target()
142 .then((targetName) => FileSystemEntity.identical(targetName, resolved)) 145 .then((targetName) => FileSystemEntity.identical(targetName, resolved))
143 .then((identical) => Expect.isTrue(identical)); 146 .then((identical) => Expect.isTrue(identical));
144 }); 147 });
145 } 148 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698