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

Unified Diff: tests/standalone/io/file_system_links_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/link.dart ('k') | tests/standalone/io/link_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/file_system_links_test.dart
diff --git a/tests/standalone/io/file_system_links_test.dart b/tests/standalone/io/file_system_links_test.dart
index 25babf1282c445d298a84a61a99b81a7937fa3a4..d2e6796cb3d16a0b64a40a528fe3d46dab0bdb60 100644
--- a/tests/standalone/io/file_system_links_test.dart
+++ b/tests/standalone/io/file_system_links_test.dart
@@ -6,19 +6,8 @@ import "dart:io";
import "dart:isolate";
-createLink(String dst, String link, bool symbolic, void callback()) {
- var args = [ symbolic ? '-s' : '', dst, link ];
- var script = 'tests/standalone/io/ln.sh';
- if (!new File(script).existsSync()) {
- script = '../$script';
- }
- Process.run(script, args).then((result) {
- if (result.exitCode == 0) {
- callback();
- } else {
- throw new Exception('link creation failed');
- }
- });
+createLink(String dst, String link, void callback()) {
+ new Link(link).create(dst).then((_) => callback());
}
@@ -26,7 +15,7 @@ testFileExistsCreate() {
var temp = new Directory('').createTempSync();
var x = '${temp.path}${Platform.pathSeparator}x';
var y = '${temp.path}${Platform.pathSeparator}y';
- createLink(x, y, true, () {
+ createLink(x, y, () {
Expect.isFalse(new File(y).existsSync());
Expect.isFalse(new File(x).existsSync());
Expect.isTrue(FileSystemEntity.isLinkSync(y));
@@ -79,13 +68,13 @@ testFileDelete() {
var x = '${temp.path}${Platform.pathSeparator}x';
var y = '${temp.path}${Platform.pathSeparator}y';
new File(x).createSync();
- createLink(x, y, true, () {
+ createLink(x, y, () {
Expect.isTrue(new File(x).existsSync());
Expect.isTrue(new File(y).existsSync());
new File(y).deleteSync();
Expect.isTrue(new File(x).existsSync());
Expect.isFalse(new File(y).existsSync());
- createLink(x, y, false, () {
+ createLink(x, y, () {
Expect.isTrue(new File(x).existsSync());
Expect.isTrue(new File(y).existsSync());
new File(y).deleteSync();
@@ -102,7 +91,7 @@ testFileWriteRead() {
var x = '${temp.path}${Platform.pathSeparator}x';
var y = '${temp.path}${Platform.pathSeparator}y';
new File(x).createSync();
- createLink(x, y, true, () {
+ createLink(x, y, () {
var data = "asdf".codeUnits;
var output = new File(y).openWrite(mode: FileMode.WRITE);
output.writeBytes(data);
@@ -122,7 +111,7 @@ testDirectoryExistsCreate() {
var temp = new Directory('').createTempSync();
var x = '${temp.path}${Platform.pathSeparator}x';
var y = '${temp.path}${Platform.pathSeparator}y';
- createLink(x, y, true, () {
+ createLink(x, y, () {
Expect.isFalse(new Directory(x).existsSync());
Expect.isFalse(new Directory(y).existsSync());
Expect.throws(new Directory(y).createSync);
@@ -137,14 +126,14 @@ testDirectoryDelete() {
var y = '${temp.path}${Platform.pathSeparator}y';
var x = '${temp2.path}${Platform.pathSeparator}x';
new File(x).createSync();
- createLink(temp2.path, y, true, () {
+ createLink(temp2.path, y, () {
var link = new Directory(y);
Expect.isTrue(link.existsSync());
Expect.isTrue(temp2.existsSync());
link.deleteSync();
Expect.isFalse(link.existsSync());
Expect.isTrue(temp2.existsSync());
- createLink(temp2.path, y, true, () {
+ createLink(temp2.path, y, () {
Expect.isTrue(link.existsSync());
temp.deleteSync(recursive: true);
Expect.isFalse(link.existsSync());
@@ -163,7 +152,7 @@ testDirectoryListing() {
var y = '${temp.path}${Platform.pathSeparator}y';
var x = '${temp2.path}${Platform.pathSeparator}x';
new File(x).createSync();
- createLink(temp2.path, y, true, () {
+ createLink(temp2.path, y, () {
var files = [];
var dirs = [];
for (var entry in temp.listSync(recursive:true)) {
@@ -210,7 +199,7 @@ testDirectoryListingBrokenLink() {
var link = '${temp.path}${Platform.pathSeparator}link';
var doesNotExist = 'this_thing_does_not_exist';
new File(x).createSync();
- createLink(doesNotExist, link, true, () {
+ createLink(doesNotExist, link, () {
Expect.throws(() => temp.listSync(recursive: true),
(e) => e is DirectoryIOException);
var files = [];
« no previous file with comments | « sdk/lib/io/link.dart ('k') | tests/standalone/io/link_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698