Index: tests/standalone/io/file_system_watcher_test.dart |
diff --git a/tests/standalone/io/file_system_watcher_test.dart b/tests/standalone/io/file_system_watcher_test.dart |
index 94108dccd129d843aecb7bcbdd3a5e057b649c47..bf116c7b97693afe1b9a2372efac59c152721b89 100644 |
--- a/tests/standalone/io/file_system_watcher_test.dart |
+++ b/tests/standalone/io/file_system_watcher_test.dart |
@@ -20,6 +20,7 @@ void testWatchCreateFile() { |
sub = watcher.listen((event) { |
if (event is FileSystemCreateEvent && |
event.path.endsWith('file')) { |
+ Expect.isFalse(event.isDirectory); |
asyncEnd(); |
sub.cancel(); |
dir.deleteSync(recursive: true); |
@@ -33,6 +34,31 @@ void testWatchCreateFile() { |
} |
+void testWatchCreateDir() { |
+ var dir = Directory.systemTemp.createTempSync('dart_file_system_watcher'); |
+ var dir2 = new Directory(dir.path + '/dir'); |
Bill Hesse
2013/10/28 17:05:33
I really think we should always use join(dir.path,
Anders Johnsen
2013/10/28 17:14:41
Done.
|
+ |
+ var watcher = dir.watch(); |
+ |
+ asyncStart(); |
+ var sub; |
+ sub = watcher.listen((event) { |
+ if (event is FileSystemCreateEvent && |
+ event.path.endsWith('dir')) { |
+ Expect.isTrue(event.isDirectory); |
+ asyncEnd(); |
+ sub.cancel(); |
+ dir.deleteSync(recursive: true); |
+ } |
+ }, onError: (e) { |
+ dir.deleteSync(recursive: true); |
+ throw e; |
+ }); |
+ |
+ dir2.createSync(); |
Bill Hesse
2013/10/28 17:05:33
Why not just dir2.create?
Anders Johnsen
2013/10/28 17:14:41
It does not add anything either way for this tests
|
+} |
+ |
+ |
void testWatchModifyFile() { |
var dir = Directory.systemTemp.createTempSync('dart_file_system_watcher'); |
var file = new File(dir.path + '/file'); |
@@ -273,6 +299,7 @@ void testWatchNonExisting() { |
void main() { |
if (!FileSystemEntity.isWatchSupported) return; |
testWatchCreateFile(); |
+ testWatchCreateDir(); |
testWatchModifyFile(); |
testWatchMoveFile(); |
testWatchDeleteFile(); |