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

Unified Diff: tests/standalone/io/file_test.dart

Issue 2477903002: Adjust tests/standalone/io/file_test not to resolve relative to Platform.executable. (Closed)
Patch Set: Created 4 years, 1 month 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 | « tests/standalone/io/empty_file ('k') | tests/standalone/io/file_test.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/file_test.dart
diff --git a/tests/standalone/io/file_test.dart b/tests/standalone/io/file_test.dart
index b987698471933629077f63d24486b1d4809d8173..8a8d6811ec21c4dd8c9dd6b1d74ec5d004885473 100644
--- a/tests/standalone/io/file_test.dart
+++ b/tests/standalone/io/file_test.dart
@@ -4,6 +4,8 @@
//
// Dart test program for testing file I/O.
+// OtherResources=empty_file
+// OtherResources=file_test.txt
// OtherResources=fixed_length_file
// OtherResources=read_as_text.dat
// OtherResources=readline_test1.dat
@@ -63,7 +65,7 @@ class FileTest {
// Test for file read functionality.
static void testReadStream() {
// Read a file and check part of it's contents.
- String filename = getFilename("bin/file_test.cc");
+ String filename = getFilename("file_test.txt");
File file = new File(filename);
Expect.isTrue('$file'.contains(file.path));
var subscription;
@@ -230,7 +232,7 @@ class FileTest {
static void testRead() {
asyncStart();
// Read a file and check part of it's contents.
- String filename = getFilename("bin/file_test.cc");
+ String filename = getFilename("file_test.txt");
File file = new File(filename);
file.open(mode: READ).then((RandomAccessFile file) {
List<int> buffer = new List<int>(10);
@@ -256,7 +258,7 @@ class FileTest {
static void testReadSync() {
// Read a file and check part of it's contents.
- String filename = getFilename("bin/file_test.cc");
+ String filename = getFilename("file_test.txt");
RandomAccessFile raf = (new File(filename)).openSync();
List<int> buffer = new List<int>(42);
int bytes_read = 0;
@@ -1071,7 +1073,7 @@ class FileTest {
static void testReadAsBytesEmptyFile() {
asyncTestStarted();
- var name = getFilename("tests/vm/data/empty_file");
+ var name = getFilename("empty_file");
var f = new File(name);
f.readAsBytes().then((bytes) {
Expect.equals(0, bytes.length);
@@ -1087,7 +1089,7 @@ class FileTest {
}
static void testReadAsBytesSyncEmptyFile() {
- var name = getFilename("tests/vm/data/empty_file");
+ var name = getFilename("empty_file");
var bytes = new File(name).readAsBytesSync();
Expect.equals(bytes.length, 0);
}
@@ -1122,7 +1124,7 @@ class FileTest {
static void testReadAsTextEmptyFile() {
asyncTestStarted();
- var name = getFilename("tests/vm/data/empty_file");
+ var name = getFilename("empty_file");
var f = new File(name);
f.readAsString(encoding: UTF8).then((text) {
Expect.equals(0, text.length);
@@ -1159,7 +1161,7 @@ class FileTest {
}
static void testReadAsTextSyncEmptyFile() {
- var name = getFilename("tests/vm/data/empty_file");
+ var name = getFilename("empty_file");
var text = new File(name).readAsStringSync();
Expect.equals(0, text.length);
}
@@ -1402,15 +1404,8 @@ 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);
- if (new File.fromUri(testPath).existsSync()) {
- return testPath.toFilePath();
- }
- return Uri.parse(Platform.resolvedExecutable)
- .resolve('../../runtime/$path').toFilePath();
+ return Platform.script.resolve(path).toFilePath();
}
// Main test entrypoint.
« no previous file with comments | « tests/standalone/io/empty_file ('k') | tests/standalone/io/file_test.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698