Index: tests/standalone/io/file_test.dart |
diff --git a/tests/standalone/io/file_test.dart b/tests/standalone/io/file_test.dart |
index 0519b9243941d1acbc2f495b4cb99dbb2e0ff9d1..946aac90d9646aae47798dfe65bb32b89c403fd3 100644 |
--- a/tests/standalone/io/file_test.dart |
+++ b/tests/standalone/io/file_test.dart |
@@ -4,6 +4,10 @@ |
// |
// Dart test program for testing file I/O. |
+// OtherResources=fixed_length_file |
+// OtherResources=read_as_text.dat |
+// OtherResources=readline_test1.dat |
+ |
import 'dart:async'; |
import 'dart:convert'; |
import 'dart:collection'; |
@@ -90,7 +94,7 @@ class FileTest { |
asyncTestStarted(); |
// Read a file. |
- String inFilename = getFilename("tests/vm/data/fixed_length_file"); |
+ String inFilename = getFilename("fixed_length_file"); |
File file; |
int bytesRead; |
@@ -274,7 +278,7 @@ class FileTest { |
Expect.equals(116, buffer[11]); // represents 't' in the file. |
raf.closeSync(); |
- filename = getFilename("tests/vm/data/fixed_length_file"); |
+ filename = getFilename("fixed_length_file"); |
File file = new File(filename); |
int len = file.lengthSync(); |
int read(int length) { |
@@ -296,7 +300,7 @@ class FileTest { |
static void testReadWrite() { |
asyncTestStarted(); |
// Read a file. |
- String inFilename = getFilename("tests/vm/data/fixed_length_file"); |
+ String inFilename = getFilename("fixed_length_file"); |
final File file = new File(inFilename); |
file.open(mode: READ).then((openedFile) { |
List<int> buffer1 = new List<int>(42); |
@@ -437,7 +441,7 @@ class FileTest { |
static void testReadWriteSync() { |
// Read a file. |
- String inFilename = getFilename("tests/vm/data/fixed_length_file"); |
+ String inFilename = getFilename("fixed_length_file"); |
RandomAccessFile file = (new File(inFilename)).openSync(); |
List<int> buffer1 = new List<int>(42); |
int bytes_read = 0; |
@@ -475,7 +479,7 @@ class FileTest { |
static void testReadWriteNoArgsSync() { |
// Read a file. |
- String inFilename = getFilename("tests/vm/data/fixed_length_file"); |
+ String inFilename = getFilename("fixed_length_file"); |
RandomAccessFile file = (new File(inFilename)).openSync(); |
List<int> buffer1 = new List<int>(42); |
int bytes_read = 0; |
@@ -615,7 +619,7 @@ class FileTest { |
// Test for file length functionality. |
static void testLength() { |
asyncTestStarted(); |
- String filename = getFilename("tests/vm/data/fixed_length_file"); |
+ String filename = getFilename("fixed_length_file"); |
File file = new File(filename); |
RandomAccessFile openedFile = file.openSync(); |
openedFile.length().then((length) { |
@@ -628,7 +632,7 @@ class FileTest { |
} |
static void testLengthSync() { |
- String filename = getFilename("tests/vm/data/fixed_length_file"); |
+ String filename = getFilename("fixed_length_file"); |
File file = new File(filename); |
RandomAccessFile openedFile = file.openSync(); |
Expect.equals(42, file.lengthSync()); |
@@ -639,7 +643,7 @@ class FileTest { |
// Test for file position functionality. |
static void testPosition() { |
asyncTestStarted(); |
- String filename = getFilename("tests/vm/data/fixed_length_file"); |
+ String filename = getFilename("fixed_length_file"); |
RandomAccessFile input = (new File(filename)).openSync(); |
input.position().then((position) { |
Expect.equals(0, position); |
@@ -664,7 +668,7 @@ class FileTest { |
} |
static void testPositionSync() { |
- String filename = getFilename("tests/vm/data/fixed_length_file"); |
+ String filename = getFilename("fixed_length_file"); |
RandomAccessFile input = (new File(filename)).openSync(); |
Expect.equals(0, input.positionSync()); |
List<int> buffer = new List<int>(100); |
@@ -1056,7 +1060,7 @@ class FileTest { |
static void testReadAsBytes() { |
asyncTestStarted(); |
- var name = getFilename("tests/vm/data/fixed_length_file"); |
+ var name = getFilename("fixed_length_file"); |
var f = new File(name); |
f.readAsBytes().then((bytes) { |
Expect.isTrue(new String.fromCharCodes(bytes).endsWith("42 bytes.")); |
@@ -1076,7 +1080,7 @@ class FileTest { |
} |
static void testReadAsBytesSync() { |
- var name = getFilename("tests/vm/data/fixed_length_file"); |
+ var name = getFilename("fixed_length_file"); |
var bytes = new File(name).readAsBytesSync(); |
Expect.isTrue(new String.fromCharCodes(bytes).endsWith("42 bytes.")); |
Expect.equals(bytes.length, 42); |
@@ -1090,12 +1094,12 @@ class FileTest { |
static void testReadAsText() { |
asyncTestStarted(); |
- var name = getFilename("tests/vm/data/fixed_length_file"); |
+ var name = getFilename("fixed_length_file"); |
var f = new File(name); |
f.readAsString(encoding: UTF8).then((text) { |
Expect.isTrue(text.endsWith("42 bytes.")); |
Expect.equals(42, text.length); |
- var name = getFilename("tests/standalone/io/read_as_text.dat"); |
+ var name = getFilename("read_as_text.dat"); |
var f = new File(name); |
f.readAsString(encoding: UTF8).then((text) { |
Expect.equals(6, text.length); |
@@ -1128,11 +1132,11 @@ class FileTest { |
} |
static void testReadAsTextSync() { |
- var name = getFilename("tests/vm/data/fixed_length_file"); |
+ var name = getFilename("fixed_length_file"); |
var text = new File(name).readAsStringSync(); |
Expect.isTrue(text.endsWith("42 bytes.")); |
Expect.equals(42, text.length); |
- name = getFilename("tests/standalone/io/read_as_text.dat"); |
+ name = getFilename("read_as_text.dat"); |
text = new File(name).readAsStringSync(); |
Expect.equals(6, text.length); |
var expected = [955, 120, 46, 32, 120, 10]; |
@@ -1162,7 +1166,7 @@ class FileTest { |
static void testReadAsLines() { |
asyncTestStarted(); |
- var name = getFilename("tests/vm/data/fixed_length_file"); |
+ var name = getFilename("fixed_length_file"); |
var f = new File(name); |
f.readAsLines(encoding: UTF8).then((lines) { |
Expect.equals(1, lines.length); |
@@ -1174,13 +1178,13 @@ class FileTest { |
} |
static void testReadAsLinesSync() { |
- var name = getFilename("tests/vm/data/fixed_length_file"); |
+ var name = getFilename("fixed_length_file"); |
var lines = new File(name).readAsLinesSync(); |
Expect.equals(1, lines.length); |
var line = lines[0]; |
Expect.isTrue(line.endsWith("42 bytes.")); |
Expect.equals(42, line.length); |
- name = getFilename("tests/standalone/io/readline_test1.dat"); |
+ name = getFilename("readline_test1.dat"); |
lines = new File(name).readAsLinesSync(); |
Expect.equals(10, lines.length); |
} |
@@ -1401,10 +1405,10 @@ class FileTest { |
// Helper method to be able to run the test from the runtime |
// directory, or the top directory. |
static String getFilename(String path) { |
- var testPath = Platform.script.resolve('../../../$path'); |
+ var testPath = Platform.script.resolve(path); |
return new File.fromUri(testPath).existsSync() |
? testPath.toFilePath() |
- : Platform.script.resolve('../../../runtime/$path').toFilePath(); |
+ : Uri.parse(Platform.executable).resolve('../../runtime/$path').toFilePath(); |
} |
// Main test entrypoint. |