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

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

Issue 9570004: Revert "Rename blahHandler to onBlah throughout dart:io." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 | « tests/standalone/src/FileOutputStreamTest.dart ('k') | tests/standalone/src/HttpTest.dart » ('j') | 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 58a9a7b5f08fd83808c11f5dfaf3250403378eb7..f2ca38d7b2fd52092d1f997b69eeff070d422cbe 100644
--- a/tests/standalone/src/FileTest.dart
+++ b/tests/standalone/src/FileTest.dart
@@ -28,14 +28,15 @@ class FileTest {
static void createTempDirectory(Function doNext) {
tempDirectory = new Directory('');
- tempDirectory.onError = (e) {
+ tempDirectory.errorHandler = (e) {
Expect.fail("Failed creating temporary directory");
};
- tempDirectory.createTemp(doNext);
+ tempDirectory.createTempHandler = doNext;
+ tempDirectory.createTemp();
}
static void deleteTempDirectory() {
- tempDirectory.deleteRecursivelySync();
+ tempDirectory.deleteSync(recursive: true);
}
// Test for file read functionality.
@@ -44,7 +45,7 @@ class FileTest {
String filename = getFilename("bin/file_test.cc");
File file = new File(filename);
InputStream input = file.openInputStream();
- input.onData = () {
+ input.dataHandler = () {
List<int> buffer = new List<int>(42);
int bytesRead = input.readInto(buffer, 0, 12);
Expect.equals(12, bytesRead);
@@ -79,7 +80,7 @@ class FileTest {
// Test reading all using readInto.
file = new File(inFilename);
input = file.openInputStream();
- input.onData = () {
+ input.dataHandler = () {
List<int> buffer1 = new List<int>(42);
bytesRead = input.readInto(buffer1, 0, 42);
Expect.equals(42, bytesRead);
@@ -88,7 +89,7 @@ class FileTest {
// Test reading all using readInto and read.
file = new File(inFilename);
input = file.openInputStream();
- input.onData = () {
+ input.dataHandler = () {
bytesRead = input.readInto(buffer1, 0, 21);
Expect.equals(21, bytesRead);
buffer1 = input.read();
@@ -98,7 +99,7 @@ class FileTest {
// Test reading all using read and readInto.
file = new File(inFilename);
input = file.openInputStream();
- input.onData = () {
+ input.dataHandler = () {
buffer1 = input.read(21);
Expect.equals(21, buffer1.length);
bytesRead = input.readInto(buffer1, 0, 21);
@@ -108,7 +109,7 @@ class FileTest {
// Test reading all using read.
file = new File(inFilename);
input = file.openInputStream();
- input.onData = () {
+ input.dataHandler = () {
buffer1 = input.read();
Expect.equals(42, buffer1.length);
Expect.isTrue(input.closed);
@@ -119,14 +120,14 @@ class FileTest {
OutputStream output = file.openOutputStream();
bool writeDone = output.writeFrom(buffer1, 0, 42);
Expect.equals(false, writeDone);
- output.onNoPendingWrites = () {
+ output.noPendingWriteHandler = () {
output.close();
- output.onClosed = () {
+ output.closeHandler = () {
// Now read the contents of the file just written.
List<int> buffer2 = new List<int>(42);
file = new File(outFilename);
input = file.openInputStream();
- input.onData = () {
+ input.dataHandler = () {
bytesRead = input.readInto(buffer2, 0, 42);
Expect.equals(42, bytesRead);
// Now compare the two buffers to check if they are identical.
@@ -134,7 +135,7 @@ class FileTest {
Expect.equals(buffer1[i], buffer2[i]);
}
};
- input.onClosed = () {
+ input.closeHandler = () {
// Delete the output file.
file.deleteSync();
Expect.isFalse(file.existsSync());
@@ -152,14 +153,14 @@ class FileTest {
// Read a file and check part of it's contents.
String filename = getFilename("bin/file_test.cc");
File file = new File(filename);
- file.onError = (s) {
+ file.errorHandler = (s) {
Expect.fail("No errors expected : $s");
};
- file.open(FileMode.READ, (RandomAccessFile file) {
+ file.openHandler = (RandomAccessFile file) {
List<int> buffer = new List<int>(10);
- file.readList(buffer, 0, 5, (bytes_read) {
+ file.readListHandler = (bytes_read) {
Expect.equals(5, bytes_read);
- file.readList(buffer, 5, 5, (bytes_read) {
+ file.readListHandler = (bytes_read) {
Expect.equals(5, bytes_read);
Expect.equals(47, buffer[0]); // represents '/' in the file.
Expect.equals(47, buffer[1]); // represents '/' in the file.
@@ -171,10 +172,13 @@ class FileTest {
Expect.equals(114, buffer[7]); // represents 'r' in the file.
Expect.equals(105, buffer[8]); // represents 'i' in the file.
Expect.equals(103, buffer[9]); // represents 'g' in the file.
- file.close(() => null);
- });
- });
- });
+ file.close();
+ };
+ file.readList(buffer, 5, 5);
+ };
+ file.readList(buffer, 0, 5);
+ };
+ file.open();
}
static void testReadSync() {
@@ -206,48 +210,47 @@ class FileTest {
// Read a file.
String inFilename = getFilename("tests/vm/data/fixed_length_file");
final File file = new File(inFilename);
- file.onError = (s) {
+ file.errorHandler = (s) {
Expect.fail("No errors expected : $s");
};
- file.open(FileMode.READ, (RandomAccessFile openedFile) {
- openedFile.onError = (s) {
+ file.openHandler = (RandomAccessFile openedFile) {
+ openedFile.errorHandler = (s) {
Expect.fail("No errors expected : $s");
};
List<int> buffer1 = new List<int>(42);
- openedFile.readList(buffer1, 0, 42, (bytes_read) {
+ openedFile.readListHandler = (bytes_read) {
Expect.equals(42, bytes_read);
- openedFile.close(() {
+ openedFile.closeHandler = () {
// Write the contents of the file just read into another file.
String outFilename = tempDirectory.path + "/out_read_write";
final File file2 = new File(outFilename);
- file2.onError = (s) {
+ file2.errorHandler = (s) {
Expect.fail("No errors expected : $s");
};
- file2.create(() {
- file2.fullPath((s) {
+ file2.createHandler = () {
+ file2.fullPathHandler = (s) {
Expect.isTrue(new File(s).existsSync());
if (s[0] != '/' && s[0] != '\\' && s[1] != ':') {
Expect.fail("Not a full path");
}
- file2.open(FileMode.WRITE, (RandomAccessFile openedFile2) {
- openedFile2.onError = (s) {
+ file2.openHandler = (RandomAccessFile openedFile2) {
+ openedFile2.errorHandler = (s) {
Expect.fail("No errors expected : $s");
};
- openedFile2.writeList(buffer1, 0, bytes_read);
- openedFile2.onNoPendingWrites = () {
- openedFile2.close(() {
+ openedFile2.noPendingWriteHandler = () {
+ openedFile2.closeHandler = () {
List<int> buffer2 = new List<int>(bytes_read);
final File file3 = new File(outFilename);
- file3.onError = (s) {
+ file3.errorHandler = (s) {
Expect.fail("No errors expected : $s");
};
- file3.open(FileMode.READ, (RandomAccessFile openedFile3) {
- openedFile3.onError = (s) {
+ file3.openHandler = (RandomAccessFile openedFile3) {
+ openedFile3.errorHandler = (s) {
Expect.fail("No errors expected : $s");
};
- openedFile3.readList(buffer2, 0, 42, (bytes_read) {
+ openedFile3.readListHandler = (bytes_read) {
Expect.equals(42, bytes_read);
- openedFile3.close(() {
+ openedFile3.closeHandler = () {
// Now compare the two buffers to check if they
// are identical.
Expect.equals(buffer1.length, buffer2.length);
@@ -256,24 +259,37 @@ class FileTest {
}
// Delete the output file.
final file4 = file3;
- file4.delete(() {
- file4.exists((exists) {
+ file4.deleteHandler = () {
+ file4.existsHandler = (exists) {
Expect.isFalse(exists);
asyncTestDone("testReadWrite");
- });
- });
- });
- });
- });
- });
+ };
+ file4.exists();
+ };
+ file4.delete();
+ };
+ openedFile3.close();
+ };
+ openedFile3.readList(buffer2, 0, 42);
+ };
+ file3.open();
+ };
+ openedFile2.close();
};
- });
- });
- });
- });
- });
- });
+ openedFile2.writeList(buffer1, 0, bytes_read);
+ };
+ file2.open(FileMode.WRITE);
+ };
+ file2.fullPath();
+ };
+ file2.create();
+ };
+ openedFile.close();
+ };
+ openedFile.readList(buffer1, 0, 42);
+ };
asyncTestStarted();
+ file.open();
}
static void testWriteAppend() {
@@ -308,25 +324,29 @@ class FileTest {
List<int> buffer = content.charCodes();
OutputStream outStream = file.openOutputStream();
outStream.write(buffer);
- outStream.onNoPendingWrites = () {
+ outStream.noPendingWriteHandler = () {
outStream.close();
File file2 = new File(filename);
OutputStream appendingOutput =
file2.openOutputStream(FileMode.APPEND);
appendingOutput.write(buffer);
- appendingOutput.onNoPendingWrites = () {
+ appendingOutput.noPendingWriteHandler = () {
appendingOutput.close();
File file3 = new File(filename);
- file3.open(FileMode.READ, (RandomAccessFile openedFile) {
- openedFile.length((int length) {
+ file3.openHandler = (RandomAccessFile openedFile) {
+ openedFile.lengthHandler = (int length) {
Expect.equals(content.length * 2, length);
- openedFile.close(() {
- file3.delete(() {
+ openedFile.closeHandler = () {
+ file3.deleteHandler = () {
asyncTestDone("testOutputStreamWriteAppend");
- });
- });
- });
- });
+ };
+ file3.delete();
+ };
+ openedFile.close();
+ };
+ openedFile.length();
+ };
+ file3.open();
};
};
asyncTestStarted();
@@ -384,25 +404,30 @@ class FileTest {
static void testReadEmptyFile() {
String fileName = tempDirectory.path + "/empty_file";
File file = new File(fileName);
- file.onError = (s) {
+ file.errorHandler = (s) {
Expect.fail("No errors expected : $s");
};
- asyncTestStarted();
- file.create(() {
- file.open(FileMode.READ, (RandomAccessFile openedFile) {
- openedFile.readByte((int byte) {
+ file.createHandler = () {
+ file.openHandler = (RandomAccessFile openedFile) {
+ openedFile.readByteHandler = (int byte) {
Expect.fail("Read byte from empty file");
- });
- openedFile.onError = (String err) {
+ };
+ openedFile.errorHandler = (String err) {
Expect.isTrue(err.indexOf("failed") != -1);
- openedFile.close(() {
- file.delete(() {
+ openedFile.closeHandler = () {
+ file.deleteHandler = () {
asyncTestDone("testReadEmptyFile");
- });
- });
+ };
+ file.delete();
+ };
+ openedFile.close();
};
- });
- });
+ openedFile.readByte();
+ };
+ file.open();
+ };
+ asyncTestStarted();
+ file.create();
}
// Test for file write of different types of lists.
@@ -410,11 +435,10 @@ class FileTest {
asyncTestStarted();
final String fileName = "${tempDirectory.path}/testWriteVariousLists";
final File file = new File(fileName);
- file.onError = (s) {
- Expect.fail("No errors expected : $s");
- };
- file.create(() {
- file.open(FileMode.WRITE, (RandomAccessFile openedFile) {
+ file.create();
+ file.createHandler = () {
+ file.open(FileMode.WRITE);
+ file.openHandler = (RandomAccessFile openedFile) {
// Write bytes from 0 to 7.
openedFile.writeList([0], 0, 1);
openedFile.writeList(const [1], 0, 1);
@@ -429,28 +453,32 @@ class FileTest {
y = 12345678901234567890123456789012345678901234568153;
openedFile.writeList([y - x], 0, 1);
- openedFile.onError = (s) {
+ openedFile.errorHandler = (s) {
Expect.fail("No errors expected : $s");
};
- openedFile.onNoPendingWrites = () {
- openedFile.close(() {
- // Check the written bytes.
- final File file2 = new File(fileName);
- var openedFile2 = file2.openSync();
- var length = openedFile2.lengthSync();
- Expect.equals(8, length);
- List data = new List(length);
- openedFile2.readListSync(data, 0, length);
- for (var i = 0; i < data.length; i++) {
- Expect.equals(i, data[i]);
- }
- openedFile2.closeSync();
- file2.deleteSync();
- asyncTestDone("testWriteVariousLists");
- });
+ openedFile.noPendingWriteHandler = () {
+ openedFile.close();
};
- });
- });
+ openedFile.closeHandler = () {
+ // Check the written bytes.
+ final File file2 = new File(fileName);
+ var openedFile2 = file2.openSync();
+ var length = openedFile2.lengthSync();
+ Expect.equals(8, length);
+ List data = new List(length);
+ openedFile2.readListSync(data, 0, length);
+ for (var i = 0; i < data.length; i++) {
+ Expect.equals(i, data[i]);
+ }
+ openedFile2.closeSync();
+ file2.deleteSync();
+ asyncTestDone("testWriteVariousLists");
+ };
+ };
+ file.errorHandler = (s) {
+ Expect.fail("No errors expected : $s");
+ };
+ };
}
static void testDirectory() {
@@ -466,29 +494,40 @@ class FileTest {
var tempDir = tempDirectory.path;
var file = new File("${tempDir}/testDirectory");
var errors = 0;
- file.directory((d) => Expect.fail("non-existing file"));
- file.onError = (s) {
- file.onError = (s) => Expect.fail("no error expected");
- file.create(() {
- file.directory((Directory d) {
- d.onError = (s) => Expect.fail("no error expected");
- d.exists((exists) {
+ file.directory();
+ file.directoryHandler = (d) => Expect.fail("non-existing file");
+ file.errorHandler = (s) {
+ file.errorHandler = (s) => Expect.fail("no error expected");
+ file.create();
+ file.createHandler = () {
+ file.directory();
+ file.directoryHandler = (Directory d) {
+ d.exists();
+ d.errorHandler = (s) => Expect.fail("no error expected");
+ d.existsHandler = (exists) {
Expect.isTrue(exists);
Expect.isTrue(d.path.endsWith(tempDir));
- file.delete(() {
+ file.delete();
+ file.deleteHandler = () {
var file_dir = new File(".");
- file_dir.directory((d) => Expect.fail("non-existing file"));
- file_dir.onError = (s) {
+ file_dir.directory();
+ file_dir.directoryHandler = (d) {
+ Expect.fail("non-existing file");
+ };
+ file_dir.errorHandler = (s) {
var file_dir = new File(tempDir);
- file_dir.directory((d) => Expect.fail("non-existing file"));
- file_dir.onError = (s) {
+ file_dir.directory();
+ file_dir.directoryHandler = (d) {
+ Expect.fail("non-existing file");
+ };
+ file_dir.errorHandler = (s) {
port.toSendPort().send(1);
};
};
- });
- });
- });
- });
+ };
+ };
+ };
+ };
};
}
@@ -514,13 +553,14 @@ class FileTest {
static void testLength() {
String filename = getFilename("tests/vm/data/fixed_length_file");
RandomAccessFile input = (new File(filename)).openSync();
- input.onError = (s) {
+ input.errorHandler = (s) {
Expect.fail("No errors expected");
};
- input.length((length) {
+ input.lengthHandler = (length) {
Expect.equals(42, length);
- input.close(() => null);
- });
+ input.close();
+ };
+ input.length();
}
static void testLengthSync() {
@@ -534,29 +574,35 @@ class FileTest {
static void testPosition() {
String filename = getFilename("tests/vm/data/fixed_length_file");
RandomAccessFile input = (new File(filename)).openSync();
- input.onError = (s) {
+ input.errorHandler = (s) {
Expect.fail("No errors expected");
};
- input.position((position) {
+ input.positionHandler = (position) {
Expect.equals(0, position);
List<int> buffer = new List<int>(100);
- input.readList(buffer, 0, 12, (bytes_read) {
- input.position((position) {
+ input.readListHandler = (bytes_read) {
+ input.positionHandler = (position) {
Expect.equals(12, position);
- input.readList(buffer, 12, 6, (bytes_read) {
- input.position((position) {
+ input.readListHandler = (bytes_read) {
+ input.positionHandler = (position) {
Expect.equals(18, position);
- input.setPosition(8, () {
- input.position((position) {
+ input.setPositionHandler = () {
+ input.positionHandler = (position) {
Expect.equals(8, position);
- input.close(() => null);
- });
- });
- });
- });
- });
- });
- });
+ input.close();
+ };
+ input.position();
+ };
+ input.setPosition(8);
+ };
+ };
+ input.readList(buffer, 12, 6);
+ };
+ input.position();
+ };
+ input.readList(buffer, 0, 12);
+ };
+ input.position();
}
static void testPositionSync() {
@@ -576,31 +622,38 @@ class FileTest {
static void testTruncate() {
File file = new File(tempDirectory.path + "/out_truncate");
List buffer = const [65, 65, 65, 65, 65, 65, 65, 65, 65, 65];
- file.onError = (error) {
+ file.errorHandler = (error) {
Expect.fail("testTruncate: No errors expected");
};
- file.open(FileMode.WRITE, (RandomAccessFile openedFile) {
- openedFile.writeList(buffer, 0, 10);
- openedFile.onNoPendingWrites = () {
- openedFile.length((length) {
+ file.openHandler = (RandomAccessFile openedFile) {
+ openedFile.noPendingWriteHandler = () {
+ openedFile.lengthHandler = (length) {
Expect.equals(10, length);
- openedFile.truncate(5, () {
- openedFile.length((length) {
+ openedFile.truncateHandler = () {
+ openedFile.lengthHandler = (length) {
Expect.equals(5, length);
- openedFile.close(() {
- file.delete(() {
- file.exists((exists) {
+ openedFile.closeHandler = () {
+ file.deleteHandler = () {
+ file.existsHandler = (exists) {
Expect.isFalse(exists);
asyncTestDone("testTruncate");
- });
- });
- });
- });
- });
- });
+ };
+ file.exists();
+ };
+ file.delete();
+ };
+ openedFile.close();
+ };
+ openedFile.length();
+ };
+ openedFile.truncate(5);
+ };
+ openedFile.length();
};
- });
+ openedFile.writeList(buffer, 0, 10);
+ };
asyncTestStarted();
+ file.open(FileMode.WRITE);
}
static void testTruncateSync() {
@@ -714,13 +767,13 @@ class FileTest {
File file = new File(tempDirectory.path + "/out_close_exception_stream");
file.createSync();
InputStream input = file.openInputStream();
- input.onClosed = () {
+ input.closeHandler = () {
Expect.isTrue(input.closed);
Expect.isNull(input.readInto(buffer, 0, 12));
OutputStream output = file.openOutputStream();
output.close();
Expect.throws(() => output.writeFrom(buffer, 0, 12));
- output.onClosed = () {
+ output.closeHandler = () {
file.deleteSync();
asyncTestDone("testCloseExceptionStream");
};
@@ -827,22 +880,24 @@ class FileTest {
static void testMixedSyncAndAsync() {
var name = getFilename("tests/vm/data/fixed_length_file");
var f = new File(name);
- f.onError = (s) {
+ f.errorHandler = (s) {
Expect.fail("No errors expected");
};
- f.exists((exists) {
+ f.existsHandler = (exists) {
try {
f.existsSync();
Expect.fail("Expected exception");
} catch (var e) {
Expect.isTrue(e is FileIOException);
}
- });
+ };
+ f.exists();
}
static void testOpenDirectoryAsFile() {
var f = new File('.');
- f.open(FileMode.READ, (r) => Expect.fail('Directory opened as file'));
+ f.open();
+ f.openHandler = (r) => Expect.fail('Directory opened as file');
}
static void testOpenDirectoryAsFileSync() {
@@ -862,11 +917,12 @@ class FileTest {
});
var name = getFilename("tests/vm/data/fixed_length_file");
var f = new File(name);
- f.readAsBytes((bytes) {
+ f.readAsBytes();
+ f.readAsBytesHandler = (bytes) {
Expect.isTrue(new String.fromCharCodes(bytes).endsWith("42 bytes."));
port.toSendPort().send(bytes.length);
- });
- f.onError = (e) {
+ };
+ f.errorHandler = (e) {
Expect.fail("No errors expected: $e");
};
}
@@ -885,30 +941,34 @@ class FileTest {
});
var name = getFilename("tests/vm/data/fixed_length_file");
var f = new File(name);
- f.readAsText('UTF-8', (text) {
+ f.readAsText('UTF-8');
+ f.readAsTextHandler = (text) {
Expect.isTrue(text.endsWith("42 bytes."));
Expect.equals(42, text.length);
var name = getDataFilename("tests/standalone/src/read_as_text.dat");
var f = new File(name);
- f.onError = (e) => Expect.fail("No errors expected");
- f.readAsText('UTF-8', (text) {
+ f.errorHandler = (e) => Expect.fail("No errors expected");
+ f.readAsText('UTF-8');
+ f.readAsTextHandler = (text) {
Expect.equals(6, text.length);
var expected = [955, 120, 46, 32, 120, 10];
Expect.listEquals(expected, text.charCodes());
- f.readAsText('ISO-8859-1', (text) {
+ f.readAsText('ISO-8859-1');
+ f.readAsTextHandler = (text) {
Expect.equals(7, text.length);
var expected = [206, 187, 120, 46, 32, 120, 10];
Expect.listEquals(expected, text.charCodes());
- f.onError = (e) {
+ f.readAsText('ASCII');
+ f.errorHandler = (e) {
port.toSendPort().send(1);
};
- f.readAsText('ASCII', (text) {
+ f.readAsTextHandler = (text) {
Expect.fail("Non-ascii char should cause error");
- });
- });
- });
- });
- f.onError = (e) {
+ };
+ };
+ };
+ };
+ f.errorHandler = (e) {
Expect.fail("No errors expected: $e");
};
}
@@ -937,13 +997,14 @@ class FileTest {
});
var name = getFilename("tests/vm/data/fixed_length_file");
var f = new File(name);
- f.readAsLines('UTF-8', (lines) {
+ f.readAsLines('UTF-8');
+ f.readAsLinesHandler = (lines) {
Expect.equals(1, lines.length);
var line = lines[0];
Expect.isTrue(line.endsWith("42 bytes."));
port.toSendPort().send(line.length);
- });
- f.onError = (e) {
+ };
+ f.errorHandler = (e) {
Expect.fail("No errors expected: $e");
};
}
@@ -970,12 +1031,12 @@ class FileTest {
Expect.throws(f.readAsBytesSync, (e) => e is FileIOException);
Expect.throws(f.readAsTextSync, (e) => e is FileIOException);
Expect.throws(f.readAsLinesSync, (e) => e is FileIOException);
- f.readAsBytes((bytes) => Expect.fail("no bytes expected"));
- f.onError = (e) {
- f.readAsText('UTF-8', (text) => Expect.fail("no text expected"));
- f.onError = (e) {
- f.readAsLines('UTF-8', (lines) => Expect.fail("no lines expected"));
- f.onError = (e) {
+ f.readAsBytes();
+ f.errorHandler = (e) {
+ f.readAsText();
+ f.errorHandler = (e) {
+ f.readAsLines();
+ f.errorHandler = (e) {
port.toSendPort().send(1);
};
};
@@ -986,33 +1047,44 @@ class FileTest {
// that the file is not truncated when opened for appending.
static void testAppend() {
var file = new File('${tempDirectory.path}/out_append');
- file.open(FileMode.WRITE, (openedFile) {
- openedFile.writeString("asdf");
- openedFile.onNoPendingWrites = () {
- openedFile.close(() {
- file.open(FileMode.APPEND, (openedFile) {
- openedFile.length((length) {
+ file.openHandler = (openedFile) {
+ openedFile.noPendingWriteHandler = () {
+ openedFile.closeHandler = () {
+ file.openHandler = (openedFile) {
+ openedFile.lengthHandler = (length) {
Expect.equals(4, length);
- openedFile.writeString("asdf");
- openedFile.onNoPendingWrites = () {
- openedFile.length((length) {
- Expect.equals(8, length);
- openedFile.close(() {
- file.delete(() {
- file.exists((exists) {
- Expect.isFalse(exists);
- asyncTestDone("testAppend");
- });
- });
- });
- });
+ openedFile.setPositionHandler = () {
+ openedFile.noPendingWriteHandler = () {
+ openedFile.lengthHandler = (length) {
+ Expect.equals(8, length);
+ openedFile.closeHandler = () {
+ file.deleteHandler = () {
+ file.existsHandler = (exists) {
+ Expect.isFalse(exists);
+ asyncTestDone("testAppend");
+ };
+ file.exists();
+ };
+ file.delete();
+ };
+ openedFile.close();
+ };
+ openedFile.length();
+ };
+ openedFile.writeString("asdf");
};
- });
- });
- });
+ openedFile.setPosition(4);
+ };
+ openedFile.length();
+ };
+ file.open(FileMode.APPEND);
+ };
+ openedFile.close();
};
- });
+ openedFile.writeString("asdf");
+ };
asyncTestStarted();
+ file.open(FileMode.WRITE);
}
static void testAppendSync() {
« no previous file with comments | « tests/standalone/src/FileOutputStreamTest.dart ('k') | tests/standalone/src/HttpTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698