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

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

Issue 156633002: Change FileStat static methods to return NOT_FOUND instead for throwing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 6 years, 10 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 | « sdk/lib/io/file_system_entity.dart ('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 28fbcc386798a8a248d0255853f1155850e45bd3..429d33705424ed852627b9b0d86fc4f58653374d 100644
--- a/tests/standalone/io/file_stat_test.dart
+++ b/tests/standalone/io/file_stat_test.dart
@@ -14,8 +14,10 @@ import "package:path/path.dart";
void testStat() {
Directory directory = Directory.systemTemp.createTempSync('dart_file_stat');
File file = new File(join(directory.path, "file"));
- Expect.throws(file.statSync);
- Expect.throws(() => FileStat.statSync(file.path));
+ FileStat fileStat = FileStat.statSync(file.path);
+ FileStat fileStatDirect = file.statSync();
+ Expect.equals(FileSystemEntityType.NOT_FOUND, fileStat.type);
+ Expect.equals(FileSystemEntityType.NOT_FOUND, fileStatDirect.type);
file.writeAsStringSync("Dart IO library test of FileStat");
new Timer(const Duration(seconds: 2), () {
file.readAsStringSync();
@@ -52,11 +54,11 @@ Future testStatAsync() {
.then((directory) {
File file = new File(join(directory.path, "file"));
return FileStat.stat(file.path)
- .then((_) => Expect.fail("FileStat.stat should throw an exception."))
- .catchError((e) => null)
+ .then((fileStat) => Expect.equals(FileSystemEntityType.NOT_FOUND,
+ fileStat.type))
.then((_) => file.stat())
- .then((_) => Expect.fail("File.stat should throw an exception."))
- .catchError((e) => null)
+ .then((fileStat) => Expect.equals(FileSystemEntityType.NOT_FOUND,
+ fileStat.type))
.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 | « sdk/lib/io/file_system_entity.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698