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

Side by Side Diff: tests/standalone/io/file_test.dart

Issue 206393003: Test file write of sub-list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // Dart test program for testing file I/O. 5 // Dart test program for testing file I/O.
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:collection'; 9 import 'dart:collection';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 openedFile.writeFromSync(buffer, 0, buffer.length); 342 openedFile.writeFromSync(buffer, 0, buffer.length);
343 openedFile.closeSync(); 343 openedFile.closeSync();
344 // Reopen the file in write mode to ensure that we overwrite the content. 344 // Reopen the file in write mode to ensure that we overwrite the content.
345 openedFile = (new File(filename)).openSync(mode: WRITE); 345 openedFile = (new File(filename)).openSync(mode: WRITE);
346 openedFile.writeFromSync(buffer, 0, buffer.length); 346 openedFile.writeFromSync(buffer, 0, buffer.length);
347 Expect.equals(content.length, openedFile.lengthSync()); 347 Expect.equals(content.length, openedFile.lengthSync());
348 openedFile.closeSync(); 348 openedFile.closeSync();
349 // Open the file in append mode and ensure that we do not overwrite 349 // Open the file in append mode and ensure that we do not overwrite
350 // the existing content. 350 // the existing content.
351 openedFile = (new File(filename)).openSync(mode: APPEND); 351 openedFile = (new File(filename)).openSync(mode: APPEND);
352 openedFile.writeFromSync(buffer, 0, buffer.length); 352 openedFile.writeFromSync(buffer, 2, buffer.length - 2);
353 Expect.equals(content.length * 2, openedFile.lengthSync()); 353 Expect.equals(content.length + content.length - 4,
354 openedFile.lengthSync());
355 Expect.equals(content + content.substring(2, content.length - 2),
356 file.readAsStringSync());
354 openedFile.closeSync(); 357 openedFile.closeSync();
355 file.deleteSync(); 358 file.deleteSync();
356 } 359 }
357 360
358 static void testOutputStreamWriteAppend() { 361 static void testOutputStreamWriteAppend() {
359 asyncTestStarted(); 362 asyncTestStarted();
360 String content = "foobar"; 363 String content = "foobar";
361 String filename = tempDirectory.path + "/outstream_write_append"; 364 String filename = tempDirectory.path + "/outstream_write_append";
362 File file = new File(filename); 365 File file = new File(filename);
363 file.createSync(); 366 file.createSync();
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 testLastModified(); 1329 testLastModified();
1327 testDoubleAsyncOperation(); 1330 testDoubleAsyncOperation();
1328 asyncEnd(); 1331 asyncEnd();
1329 }); 1332 });
1330 } 1333 }
1331 } 1334 }
1332 1335
1333 main() { 1336 main() {
1334 FileTest.testMain(); 1337 FileTest.testMain();
1335 } 1338 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698