Index: tests/standalone/io/file_test.dart |
diff --git a/tests/standalone/io/file_test.dart b/tests/standalone/io/file_test.dart |
index 73db86b6e50dc64adaab231c66bf68b700d255ee..7c3295da55cb4bf79318313454453fef54c2d375 100644 |
--- a/tests/standalone/io/file_test.dart |
+++ b/tests/standalone/io/file_test.dart |
@@ -584,6 +584,28 @@ class FileTest { |
}); |
} |
+ static void testWriteFromOffset() { |
+ Directory tmp; |
+ RandomAccessFile raf; |
+ try { |
+ tmp = tempDirectory.createTempSync('write_from_offset_test_'); |
+ File f = new File('${tmp.path}/file')..createSync(); |
+ f.writeAsStringSync('pre-existing content\n', flush: true); |
+ raf = f.openSync(mode: FileMode.APPEND); |
+ String truth = "Hello world"; |
+ raf.writeFromSync(UTF8.encode('Hello world'), 2, 5); |
+ raf.flushSync(); |
+ Expect.equals(f.readAsStringSync(), 'pre-existing content\nllo'); |
+ } finally { |
+ if (raf != null) { |
+ raf.closeSync(); |
+ } |
+ if (tmp != null) { |
+ tmp.deleteSync(recursive: true); |
+ } |
+ } |
+ } |
+ |
static void testDirectory() { |
asyncTestStarted(); |
var tempDir = tempDirectory.path; |
@@ -1492,6 +1514,7 @@ class FileTest { |
testOutputStreamWriteAppend(); |
testOutputStreamWriteString(); |
testWriteVariousLists(); |
+ testWriteFromOffset(); |
testDirectory(); |
testDirectorySync(); |
testWriteStringUtf8(); |