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

Unified Diff: tests/standalone/src/FileTest.dart

Issue 8598011: Implement delete on File objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 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 | « runtime/bin/file_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/FileTest.dart
diff --git a/tests/standalone/src/FileTest.dart b/tests/standalone/src/FileTest.dart
index b16829587b5fd5990c4819deb05b1965c285109f..c393c73ce9115c7bde180710bee6496267703bea 100644
--- a/tests/standalone/src/FileTest.dart
+++ b/tests/standalone/src/FileTest.dart
@@ -44,15 +44,15 @@ class FileTest {
Expect.equals(42, bytesRead);
input.close();
// Write the contents of the file just read into another file.
- String outFilename = getFilename("tests/vm/data/fixed_length_file");
- file = new File(outFilename + "_out");
+ String outFilenameBase = getFilename("tests/vm/data/fixed_length_file");
+ file = new File(outFilenameBase + "_out");
OutputStream output = file.openOutputStream();
bool writeDone = output.writeFrom(buffer1, 0, 42);
Expect.equals(true, writeDone);
output.close();
// Now read the contents of the file just written.
List<int> buffer2 = new List<int>(42);
- file = new File(outFilename);
+ file = new File(outFilenameBase + "_out");
Bill Hesse 2011/11/18 12:26:04 Why wasn't this test failing before? Has that pro
Mads Ager (google) 2011/11/18 12:27:24 Because the test copies input file to output file.
input = file.openInputStream();
bytesRead = input.readInto(buffer2, 0, 42);
input.close();
@@ -61,6 +61,9 @@ class FileTest {
for (int i = 0; i < buffer1.length; i++) {
Expect.equals(buffer1[i], buffer2[i]);
}
+ // Delete the output file.
+ file.deleteSync();
+ Expect.isFalse(file.existsSync());
return 1;
}
@@ -154,7 +157,7 @@ class FileTest {
file.closeHandler = () {
// Now read the contents of the file just written.
List<int> buffer2 = new List<int>(bytes_read);
- file = new File(getFilename(outFilenameBase));
+ file = new File(getFilename(outFilenameBase + "_out"));
file.errorHandler = (s) {
Expect.fail("No errors expected");
};
@@ -168,6 +171,14 @@ class FileTest {
for (int i = 0; i < buffer1.length; i++) {
Expect.equals(buffer1[i], buffer2[i]);
}
+ // Delete the output file.
+ file.deleteHandler = () {
+ file.existsHandler = (exists) {
+ Expect.isFalse(exists);
+ };
+ file.exists();
+ };
+ file.delete();
};
file.close();
};
@@ -219,7 +230,7 @@ class FileTest {
file.closeSync();
// Now read the contents of the file just written.
List<int> buffer2 = new List<int>(bytes_read);
- file = new File(getFilename(outFilenameBase));
+ file = new File(getFilename(outFilenameBase + "_out"));
file.openSync();
bytes_read = file.readListSync(buffer2, 0, 42);
Expect.equals(42, bytes_read);
@@ -229,6 +240,9 @@ class FileTest {
for (int i = 0; i < buffer1.length; i++) {
Expect.equals(buffer1[i], buffer2[i]);
}
+ // Delete the output file.
+ file.deleteSync();
+ Expect.isFalse(file.existsSync());
return 1;
}
« no previous file with comments | « runtime/bin/file_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698