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

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

Issue 26968003: Remove DirectoryException and LinkException from dart:io and use FileException instaed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge with master. Created 7 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 | « tests/standalone/io/file_error_test.dart ('k') | tests/standalone/io/file_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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "package:async_helper/async_helper.dart"; 6 import "package:async_helper/async_helper.dart";
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 void testReadAsString() { 9 void testReadAsString() {
10 var tmp = Directory.systemTemp.createTempSync('dart_file_read_encoded'); 10 var tmp = Directory.systemTemp.createTempSync('dart_file_read_encoded');
11 11
12 var file = new File('${tmp.path}/file'); 12 var file = new File('${tmp.path}/file');
13 file.createSync(); 13 file.createSync();
14 14
15 file.writeAsBytesSync([0xb0]); 15 file.writeAsBytesSync([0xb0]);
16 16
17 Expect.throws(file.readAsStringSync, (e) => e is FileException); 17 Expect.throws(file.readAsStringSync, (e) => e is FileSystemException);
18 18
19 asyncStart(); 19 asyncStart();
20 file.readAsString().then((_) { 20 file.readAsString().then((_) {
21 Expect.fail("expected exception"); 21 Expect.fail("expected exception");
22 }).catchError((e) { 22 }).catchError((e) {
23 tmp.deleteSync(recursive: true); 23 tmp.deleteSync(recursive: true);
24 asyncEnd(); 24 asyncEnd();
25 }, test: (e) => e is FileException); 25 }, test: (e) => e is FileSystemException);
26 } 26 }
27 27
28 void testReadAsLines() { 28 void testReadAsLines() {
29 var tmp = Directory.systemTemp.createTempSync('dart_file_read_encoded'); 29 var tmp = Directory.systemTemp.createTempSync('dart_file_read_encoded');
30 30
31 var file = new File('${tmp.path}/file'); 31 var file = new File('${tmp.path}/file');
32 file.createSync(); 32 file.createSync();
33 33
34 file.writeAsBytesSync([0xb0]); 34 file.writeAsBytesSync([0xb0]);
35 35
36 Expect.throws(file.readAsLinesSync, (e) => e is FileException); 36 Expect.throws(file.readAsLinesSync, (e) => e is FileSystemException);
37 37
38 asyncStart(); 38 asyncStart();
39 file.readAsLines().then((_) { 39 file.readAsLines().then((_) {
40 Expect.fail("expected exception"); 40 Expect.fail("expected exception");
41 }).catchError((e) { 41 }).catchError((e) {
42 tmp.deleteSync(recursive: true); 42 tmp.deleteSync(recursive: true);
43 asyncEnd(); 43 asyncEnd();
44 }, test: (e) => e is FileException); 44 }, test: (e) => e is FileSystemException);
45 } 45 }
46 46
47 void main() { 47 void main() {
48 testReadAsString(); 48 testReadAsString();
49 testReadAsLines(); 49 testReadAsLines();
50 } 50 }
OLDNEW
« no previous file with comments | « tests/standalone/io/file_error_test.dart ('k') | tests/standalone/io/file_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698