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

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

Issue 11412033: Rename File.readAsText to File.readAsString. There is no Text type in Dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « sdk/lib/io/file_impl.dart ('k') | tests/standalone/io/file_fuzz_test.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 error handling in file I/O. 5 // Dart test program for testing error handling in file I/O.
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 #import("dart:isolate"); 8 #import("dart:isolate");
9 9
10 Directory tempDir() { 10 Directory tempDir() {
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 void testReadAsTextNonExistent() { 266 void testReadAsTextNonExistent() {
267 Directory temp = tempDir(); 267 Directory temp = tempDir();
268 ReceivePort p = new ReceivePort(); 268 ReceivePort p = new ReceivePort();
269 p.receive((x, y) { 269 p.receive((x, y) {
270 p.close(); 270 p.close();
271 temp.deleteSync(recursive: true); 271 temp.deleteSync(recursive: true);
272 }); 272 });
273 var file = new File("${temp.path}/nonExistentFile4"); 273 var file = new File("${temp.path}/nonExistentFile4");
274 274
275 // Non-existing file should throw exception. 275 // Non-existing file should throw exception.
276 Expect.throws(() => file.readAsTextSync(), 276 Expect.throws(() => file.readAsStringSync(),
277 (e) => checkOpenNonExistentFileException(e)); 277 (e) => checkOpenNonExistentFileException(e));
278 278
279 var readAsTextFuture = file.readAsText(Encoding.ASCII); 279 var readAsStringFuture = file.readAsString(Encoding.ASCII);
280 readAsTextFuture.then((data) => Expect.fail("Unreachable code")); 280 readAsStringFuture.then((data) => Expect.fail("Unreachable code"));
281 readAsTextFuture.handleException((e) { 281 readAsStringFuture.handleException((e) {
282 checkOpenNonExistentFileException(e); 282 checkOpenNonExistentFileException(e);
283 p.toSendPort().send(null); 283 p.toSendPort().send(null);
284 return true; 284 return true;
285 }); 285 });
286 } 286 }
287 287
288 testReadAsLinesNonExistent() { 288 testReadAsLinesNonExistent() {
289 Directory temp = tempDir(); 289 Directory temp = tempDir();
290 ReceivePort p = new ReceivePort(); 290 ReceivePort p = new ReceivePort();
291 p.receive((x, y) { 291 p.receive((x, y) {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 testReadAsBytesNonExistent(); 510 testReadAsBytesNonExistent();
511 testReadAsTextNonExistent(); 511 testReadAsTextNonExistent();
512 testReadAsLinesNonExistent(); 512 testReadAsLinesNonExistent();
513 testWriteByteToReadOnlyFile(); 513 testWriteByteToReadOnlyFile();
514 testWriteListToReadOnlyFile(); 514 testWriteListToReadOnlyFile();
515 testTruncateReadOnlyFile(); 515 testTruncateReadOnlyFile();
516 testOperateOnClosedFile(); 516 testOperateOnClosedFile();
517 testRepeatedlyCloseFile(); 517 testRepeatedlyCloseFile();
518 testRepeatedlyCloseFileSync(); 518 testRepeatedlyCloseFileSync();
519 } 519 }
OLDNEW
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | tests/standalone/io/file_fuzz_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698