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..9d2255d693204e19bd3c437be9b76f1bf0ef64a4 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, linkRelative: true).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 = []; |