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

Unified Diff: tests/standalone/src/io/FileInvalidArgumentsTest.dart

Issue 9630012: Error reporting on File in dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Style issues Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone/src/io/FileErrorTest.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/io/FileInvalidArgumentsTest.dart
diff --git a/tests/standalone/src/io/FileInvalidArgumentsTest.dart b/tests/standalone/src/io/FileInvalidArgumentsTest.dart
index c03beb03860b0da862658394fb9f70a8255a995e..413add9eb9e74f14eba5dd1e44a2891695df34e3 100644
--- a/tests/standalone/src/io/FileInvalidArgumentsTest.dart
+++ b/tests/standalone/src/io/FileInvalidArgumentsTest.dart
@@ -5,18 +5,17 @@
#import("dart:io");
class FileTest {
- static void testOpenInvalidArgs(name, [writable = false]) {
+ static void testOpenInvalidArgs(name) {
var file = new File(name);
try {
file.openSync();
Expect.fail('exception expected');
} catch (var e) {
- Expect.isTrue(e is FileIOException);
- Expect.isTrue(e.toString().contains('open file'));
+ Expect.isTrue(e is IllegalArgumentException);
}
- file.onError = (s) {
- Expect.isTrue(s.contains('open file'));
+ file.onError = (e) {
+ Expect.isTrue(e is IllegalArgumentException);
};
file.open(FileMode.READ, (opened) {
Expect.fail('non-string name open');
@@ -29,12 +28,11 @@ class FileTest {
file.existsSync();
Expect.fail('exception expected');
} catch (var e) {
- Expect.isTrue(e is FileIOException);
- Expect.isTrue(e.toString().contains('is not a string'));
+ Expect.isTrue(e is IllegalArgumentException);
}
- file.onError = (s) {
- Expect.isTrue(s.contains('is not a string'));
+ file.onError = (e) {
+ Expect.isTrue(e is IllegalArgumentException);
};
file.exists((bool) {
Expect.fail('non-string name exists');
@@ -47,16 +45,11 @@ class FileTest {
file.createSync();
Expect.fail('exception expected');
} catch (var e) {
- Expect.isTrue(e is FileIOException);
- Expect.isTrue(e.toString().contains('Cannot create file'));
+ Expect.isTrue(e is IllegalArgumentException);
}
- file.onError = (s) {
- Expect.isTrue(s.contains('Cannot create file'));
- };
- file.create((created) {
- Expect.fail('non-string name exists');
- });
+ file.onError = (e) => Expect.isTrue(e is IllegalArgumentException);
+ file.create(() => Expect.fail('non-string name exists'));
}
static void testReadListInvalidArgs(buffer, offset, length) {
@@ -169,12 +162,11 @@ class FileTest {
file.fullPathSync();
Expect.fail('exception expected');
} catch (var e) {
- Expect.isTrue(e is FileIOException);
- Expect.isTrue(e.toString().contains('fullPath failed'));
+ Expect.isTrue(e is IllegalArgumentException);
}
- file.onError = (s) {
- Expect.isTrue(s.contains('fullPath failed'));
+ file.onError = (e) {
+ Expect.isTrue(e is IllegalArgumentException);
};
file.fullPath((path) {
Expect.fail('full path invalid argument');
@@ -187,7 +179,6 @@ class FileTest {
main() {
FileTest.testOpenInvalidArgs(0);
- FileTest.testOpenInvalidArgs('name', 0);
FileTest.testExistsInvalidArgs(0);
FileTest.testCreateInvalidArgs(0);
FileTest.testReadListInvalidArgs(12, 0, 1);
« no previous file with comments | « tests/standalone/src/io/FileErrorTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698