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

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

Issue 13654002: Change how File/Directory/Link .delete works. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix windows error codes. Created 7 years, 8 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 "dart:io"; 5 import "dart:io";
6 import "dart:isolate"; 6 import "dart:isolate";
7 7
8 testJunctionTypeDelete() { 8 testJunctionTypeDelete() {
9 var temp = new Directory('').createTempSync(); 9 var temp = new Directory('').createTempSync();
10 var x = '${temp.path}${Platform.pathSeparator}x'; 10 var x = '${temp.path}${Platform.pathSeparator}x';
(...skipping 12 matching lines...) Expand all
23 Expect.equals(FileSystemEntityType.DIRECTORY, 23 Expect.equals(FileSystemEntityType.DIRECTORY,
24 FileSystemEntity.typeSync(x)); 24 FileSystemEntity.typeSync(x));
25 Expect.equals(FileSystemEntityType.LINK, 25 Expect.equals(FileSystemEntityType.LINK,
26 FileSystemEntity.typeSync(y, followLinks: false)); 26 FileSystemEntity.typeSync(y, followLinks: false));
27 Expect.equals(FileSystemEntityType.DIRECTORY, 27 Expect.equals(FileSystemEntityType.DIRECTORY,
28 FileSystemEntity.typeSync(x, followLinks: false)); 28 FileSystemEntity.typeSync(x, followLinks: false));
29 Expect.equals(x, new Link(y).targetSync()); 29 Expect.equals(x, new Link(y).targetSync());
30 30
31 // Test Junction pointing to a missing directory. 31 // Test Junction pointing to a missing directory.
32 new Directory(x).deleteSync(); 32 new Directory(x).deleteSync();
33 Expect.isTrue(new Directory(y).existsSync()); 33 Expect.isTrue(new Link(y).existsSync());
34 Expect.isFalse(new Directory(x).existsSync()); 34 Expect.isFalse(new Directory(x).existsSync());
35 Expect.isTrue(FileSystemEntity.isLinkSync(y)); 35 Expect.isTrue(FileSystemEntity.isLinkSync(y));
36 Expect.isFalse(FileSystemEntity.isLinkSync(x)); 36 Expect.isFalse(FileSystemEntity.isLinkSync(x));
37 Expect.isFalse(FileSystemEntity.isDirectorySync(y)); 37 Expect.isFalse(FileSystemEntity.isDirectorySync(y));
38 Expect.isFalse(FileSystemEntity.isDirectorySync(x)); 38 Expect.isFalse(FileSystemEntity.isDirectorySync(x));
39 Expect.equals(FileSystemEntityType.NOT_FOUND, 39 Expect.equals(FileSystemEntityType.LINK,
40 FileSystemEntity.typeSync(y)); 40 FileSystemEntity.typeSync(y));
41 Expect.equals(FileSystemEntityType.NOT_FOUND, 41 Expect.equals(FileSystemEntityType.NOT_FOUND,
42 FileSystemEntity.typeSync(x)); 42 FileSystemEntity.typeSync(x));
43 Expect.equals(FileSystemEntityType.LINK, 43 Expect.equals(FileSystemEntityType.LINK,
44 FileSystemEntity.typeSync(y, followLinks: false)); 44 FileSystemEntity.typeSync(y, followLinks: false));
45 Expect.equals(FileSystemEntityType.NOT_FOUND, 45 Expect.equals(FileSystemEntityType.NOT_FOUND,
46 FileSystemEntity.typeSync(x, followLinks: false)); 46 FileSystemEntity.typeSync(x, followLinks: false));
47 Expect.equals(x, new Link(y).targetSync()); 47 Expect.equals(x, new Link(y).targetSync());
48 48
49 // Delete Junction pointing to a missing directory. 49 // Delete Junction pointing to a missing directory.
50 new Directory(y).deleteSync(); 50 new Link(y).deleteSync();
51 Expect.isFalse(FileSystemEntity.isLinkSync(y)); 51 Expect.isFalse(FileSystemEntity.isLinkSync(y));
52 Expect.equals(FileSystemEntityType.NOT_FOUND, 52 Expect.equals(FileSystemEntityType.NOT_FOUND,
53 FileSystemEntity.typeSync(y)); 53 FileSystemEntity.typeSync(y));
54 Expect.throws(() => new Link(y).targetSync()); 54 Expect.throws(() => new Link(y).targetSync());
55 55
56 new Directory(x).createSync(); 56 new Directory(x).createSync();
57 new Link(y).create(x).then((_) { 57 new Link(y).create(x).then((_) {
58 Expect.equals(FileSystemEntityType.LINK, 58 Expect.equals(FileSystemEntityType.LINK,
59 FileSystemEntity.typeSync(y, followLinks: false)); 59 FileSystemEntity.typeSync(y, followLinks: false));
60 Expect.equals(FileSystemEntityType.DIRECTORY, 60 Expect.equals(FileSystemEntityType.DIRECTORY,
(...skipping 16 matching lines...) Expand all
77 }); 77 });
78 }); 78 });
79 } 79 }
80 80
81 81
82 main() { 82 main() {
83 if (Platform.operatingSystem == 'windows') { 83 if (Platform.operatingSystem == 'windows') {
84 testJunctionTypeDelete(); 84 testJunctionTypeDelete();
85 } 85 }
86 } 86 }
OLDNEW
« runtime/bin/file_win.cc ('K') | « tests/standalone/io/file_system_links_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698