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

Unified Diff: tests/standalone/io/file_stat_test.dart

Issue 16140008: dart:io | Make FileStat.stat throw an exception when the file does not exist, or cannot be accessed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 | « runtime/bin/file_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/file_stat_test.dart
diff --git a/tests/standalone/io/file_stat_test.dart b/tests/standalone/io/file_stat_test.dart
index 6f19767eb62997f82d8604680fee9a983a8b462a..171417b38a90896e36181e40f91643d956cd53dd 100644
--- a/tests/standalone/io/file_stat_test.dart
+++ b/tests/standalone/io/file_stat_test.dart
@@ -12,8 +12,8 @@ import 'dart:isolate';
void testStat() {
Directory directory = new Directory("").createTempSync();
File file = new File.fromPath(new Path(directory.path).append("file"));
- FileStat nonExistent = FileStat.statSync(file.path);
- Expect.equals(FileSystemEntityType.NOT_FOUND, nonExistent.type);
+ Expect.throws(file.statSync);
+ Expect.throws(() => FileStat.statSync(file.path));
file.writeAsStringSync("Dart IO library test of FileStat");
new Timer(const Duration(seconds: 2), () {
file.readAsStringSync();
@@ -50,9 +50,11 @@ Future testStatAsync() {
.then((directory) {
File file = new File.fromPath(new Path(directory.path).append("file"));
return FileStat.stat(file.path)
- .then((missingStat) {
- Expect.equals(FileSystemEntityType.NOT_FOUND, missingStat.type);
- })
+ .then((_) => Expect.fail("FileStat.stat should throw an exception."))
+ .catchError((e) => null)
+ .then((_) => file.stat())
+ .then((_) => Expect.fail("File.stat should throw an exception."))
+ .catchError((e) => null)
.then((_) => file.writeAsString("Dart IO library test of FileStat"))
.then((_) => new Future.delayed(const Duration(seconds: 2)))
.then((_) => file.readAsString())
« no previous file with comments | « runtime/bin/file_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698