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

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

Issue 1192363009: Fix deletion of directory in test (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« 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:io'; 8 import 'dart:io';
9 9
10 import "package:async_helper/async_helper.dart"; 10 import "package:async_helper/async_helper.dart";
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 void writeSync(Directory dir) { 57 void writeSync(Directory dir) {
58 var f = new File(dir.path + '/write_sync'); 58 var f = new File(dir.path + '/write_sync');
59 var raf = f.openSync(mode: WRITE_ONLY); 59 var raf = f.openSync(mode: WRITE_ONLY);
60 raf.writeStringSync('Hello'); 60 raf.writeStringSync('Hello');
61 raf.setPositionSync(0); 61 raf.setPositionSync(0);
62 raf.writeStringSync('Hello'); 62 raf.writeStringSync('Hello');
63 raf.setPositionSync(0); 63 raf.setPositionSync(0);
64 Expect.throws(() => raf.readByteSync()); 64 Expect.throws(() => raf.readByteSync());
65 raf.close();
65 } 66 }
66 67
67 Future openWrite(Directory dir) async { 68 Future openWrite(Directory dir) async {
68 var f = new File(dir.path + '/open_write'); 69 var f = new File(dir.path + '/open_write');
69 var sink = f.openWrite(mode: WRITE_ONLY); 70 var sink = f.openWrite(mode: WRITE_ONLY);
70 sink.write('Hello'); 71 sink.write('Hello');
71 await sink.close(); 72 await sink.close();
72 sink = await f.openWrite(mode: WRITE_ONLY_APPEND); 73 sink = await f.openWrite(mode: WRITE_ONLY_APPEND);
73 sink.write('Hello'); 74 sink.write('Hello');
74 await sink.close(); 75 await sink.close();
75 Expect.equals(f.lengthSync(), 10); 76 Expect.equals(f.lengthSync(), 10);
76 } 77 }
77 78
78 main() async { 79 main() async {
79 asyncStart(); 80 asyncStart();
80 await withTempDir('file_write_only_test', write); 81 await withTempDir('file_write_only_test_1', write);
81 withTempDirSync('file_write_only_test', writeSync); 82 withTempDirSync('file_write_only_test_2', writeSync);
82 await withTempDir('file_write_only_test', openWrite); 83 await withTempDir('file_write_only_test_3', openWrite);
83 asyncEnd(); 84 asyncEnd();
84 } 85 }
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