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

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

Issue 232773003: Make sure to always remove temp directory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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 // Testing file input stream, VM-only, standalone test. 4 // Testing file input stream, VM-only, standalone test.
5 5
6 import "dart:convert"; 6 import "dart:convert";
7 import "dart:io"; 7 import "dart:io";
8 8
9 import "package:async_helper/async_helper.dart"; 9 import "package:async_helper/async_helper.dart";
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 asyncStart(); 207 asyncStart();
208 var temp = Directory.systemTemp.createTempSync('file_input_stream_test'); 208 var temp = Directory.systemTemp.createTempSync('file_input_stream_test');
209 var file = new File('${temp.path}/input_stream_bad_offset.txt'); 209 var file = new File('${temp.path}/input_stream_bad_offset.txt');
210 var originalLength = writeLongFileSync(file); 210 var originalLength = writeLongFileSync(file);
211 var streamedBytes = 0; 211 var streamedBytes = 0;
212 file.openRead(start, end).listen( 212 file.openRead(start, end).listen(
213 (d) { 213 (d) {
214 streamedBytes += d.length; 214 streamedBytes += d.length;
215 }, 215 },
216 onDone: () { 216 onDone: () {
217 temp.delete(recursive: true); 217 if (temp.existsSync()) {
218 temp.delete(recursive: true);
Søren Gjesse 2014/04/10 14:27:59 Use deleteSync
219 }
218 }, 220 },
219 onError: (e) { 221 onError: (e) {
222 if (temp.existsSync()) {
223 temp.delete(recursive: true);
Søren Gjesse 2014/04/10 14:27:59 Use deleteSync or call asyncEnd in the Future retu
224 }
220 asyncEnd(); 225 asyncEnd();
221 }); 226 });
222 } 227 }
223 test(-1, null); 228 test(-1, null);
224 test(100, 99); 229 test(100, 99);
225 test(null, -1); 230 test(null, -1);
226 } 231 }
227 232
228 233
229 void testStringLineSplitterEnding(String name, int length) { 234 void testStringLineSplitterEnding(String name, int length) {
(...skipping 26 matching lines...) Expand all
256 testInputStreamDelete(); 261 testInputStreamDelete();
257 testInputStreamAppend(); 262 testInputStreamAppend();
258 testInputStreamOffset(); 263 testInputStreamOffset();
259 testInputStreamBadOffset(); 264 testInputStreamBadOffset();
260 // Check the length of these files as both are text files where one 265 // Check the length of these files as both are text files where one
261 // is without a terminating line separator which can easily be added 266 // is without a terminating line separator which can easily be added
262 // back if accidentally opened in a text editor. 267 // back if accidentally opened in a text editor.
263 testStringLineSplitterEnding("readline_test1.dat", 111); 268 testStringLineSplitterEnding("readline_test1.dat", 111);
264 testStringLineSplitterEnding("readline_test2.dat", 114); 269 testStringLineSplitterEnding("readline_test2.dat", 114);
265 } 270 }
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