Chromium Code Reviews| Index: tests/standalone/src/io/FileTest.dart |
| diff --git a/tests/standalone/src/io/FileTest.dart b/tests/standalone/src/io/FileTest.dart |
| index f691c5d1a6425fb2525d7837bfb342d279a69384..8add2fa5743c0e4c2da9460d119f0da6762f5b2c 100644 |
| --- a/tests/standalone/src/io/FileTest.dart |
| +++ b/tests/standalone/src/io/FileTest.dart |
| @@ -510,6 +510,33 @@ class FileTest { |
| Expect.throws(file_dir.directorySync, (e) { return e is FileIOException; }); |
| } |
| + static void testFileError() { |
| + void checkOpenNonExistentFileException(e) { |
| + print(e); |
| + Expect.isTrue(e is FileIOException); |
| + Expect.isTrue(e.osError != null); |
| + Expect.isTrue(e.toString().indexOf("Cannot open file") != -1); |
| + if (new Platform().operatingSystem() == "macos") { |
|
Mads Ager (google)
2012/03/09 09:40:13
Remember to broaden this one to the other platform
Søren Gjesse
2012/03/13 08:25:55
Done.
|
| + Expect.isTrue(e.toString().indexOf("No such file or directory") != -1); |
| + Expect.equals(2, e.osError.errorCode); |
| + } |
| + } |
| + |
| + var tempDir = tempDirectory.path; |
| + var file = new File("${tempDir}/nonExistentFile"); |
| + |
| + // Non-existing file should throw exception. |
| + try { |
| + file.openSync(); |
| + } catch (Exception e) { |
| + checkOpenNonExistentFileException(e); |
| + } |
| + |
| + file.open(FileMode.READ, (raf) => Expect.fail("Unreachable code")); |
| + file.onError = (e) => checkOpenNonExistentFileException(e); |
| + } |
| + |
| + |
| // Test for file length functionality. |
| static void testLength() { |
| String filename = getFilename("tests/vm/data/fixed_length_file"); |
| @@ -1040,7 +1067,7 @@ class FileTest { |
| // Main test entrypoint. |
| static testMain() { |
| - testRead(); |
| + /*testRead(); |
| testReadSync(); |
| testReadStream(); |
| testLength(); |
| @@ -1057,9 +1084,9 @@ class FileTest { |
| testReadAsLines(); |
| testReadAsLinesSync(); |
| testReadAsErrors(); |
| - |
| +*/ |
| createTempDirectory(() { |
| - testReadWrite(); |
| +/* testReadWrite(); |
| testReadWriteSync(); |
| testReadWriteStream(); |
| testReadEmptyFileSync(); |
| @@ -1075,7 +1102,8 @@ class FileTest { |
| testOutputStreamWriteAppend(); |
| testWriteVariousLists(); |
| testDirectory(); |
| - testDirectorySync(); |
| + testDirectorySync();*/ |
| + testFileError(); |
| }); |
| } |
| } |