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

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

Issue 12691002: dart:io | Add Link class, as sibling to File and Directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix Windows errors Created 7 years, 9 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "dart:io";
6 import "dart:isolate";
7
8 // Test the dart:io Link class.
9
10 testCreateSync() {
11 Path base = new Path(new Directory('').createTempSync().path);
12 String link = base.append('link').toNativePath();
13 String target = base.append('target').toNativePath();
14 new Directory(target).createSync();
15 new Link(link).createSync(target);
16
17 Expect.equals(FileSystemEntityType.DIRECTORY,
18 FileSystemEntity.typeSync(link));
19 Expect.equals(FileSystemEntityType.DIRECTORY,
20 FileSystemEntity.typeSync(target));
21 Expect.equals(FileSystemEntityType.LINK,
22 FileSystemEntity.typeSync(link, followLinks: false));
23 Expect.equals(FileSystemEntityType.DIRECTORY,
24 FileSystemEntity.typeSync(target, followLinks: false));
25 Expect.isTrue(FileSystemEntity.isLinkSync(link));
26 Expect.isFalse(FileSystemEntity.isLinkSync(target));
27 Expect.isTrue(new Directory(link).existsSync());
28 Expect.isTrue(new Directory(target).existsSync());
29 Expect.isTrue(new Link(link).existsSync());
30 Expect.isFalse(new Link(target).existsSync());
31
32 String createdThroughLink =
33 base.append('link/createdThroughLink').toNativePath();
34 String createdDirectly = base.append('target/createdDirectly').toNativePath();
35 new Directory(createdThroughLink).createSync();
36 new Directory(createdDirectly).createSync();
37 Expect.isTrue(new Directory(createdThroughLink).existsSync());
38 Expect.isTrue(new Directory(createdDirectly).existsSync());
39 Expect.isTrue(new Directory.fromPath(base.append('link/createdDirectly'))
40 .existsSync());
41 Expect.isTrue(new Directory.fromPath(base.append('target/createdThroughLink'))
42 .existsSync());
43 Expect.equals(FileSystemEntityType.DIRECTORY,
44 FileSystemEntity.typeSync(createdThroughLink,
45 followLinks: false));
46 Expect.equals(FileSystemEntityType.DIRECTORY,
47 FileSystemEntity.typeSync(createdDirectly, followLinks: false));
48
49 new Directory.fromPath(base).deleteSync(recursive: true);
50 }
51
52
53 main() {
54 testCreateSync();
55 }
OLDNEW
« no previous file with comments | « tests/standalone/io/file_system_links_test.dart ('k') | tests/standalone/io/windows_file_system_links_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698