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

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

Issue 2615673002: Make RandomAccessFile.writeFrom use the correct starting offset (Closed)
Patch Set: Add test Created 3 years, 11 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 | « runtime/bin/file.cc ('k') | no next file » | 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 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();
« no previous file with comments | « runtime/bin/file.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698