Index: pkg/watcher/test/directory_watcher_test.dart |
diff --git a/pkg/watcher/test/directory_watcher_test.dart b/pkg/watcher/test/directory_watcher_test.dart |
index 9070179a9df6c9407ca852c9d6648415a30b6c93..841dd0808ecc8ccd05a8ed0cfe96b59d62d93691 100644 |
--- a/pkg/watcher/test/directory_watcher_test.dart |
+++ b/pkg/watcher/test/directory_watcher_test.dart |
@@ -86,4 +86,23 @@ main() { |
writeFile("a/b/c/d/file.txt"); |
expectAddEvent("a/b/c/d/file.txt"); |
}); |
+ |
+ test('watches a directory created after the watcher', () { |
+ // Watch a subdirectory that doesn't exist yet. |
+ createWatcher(dir: "a"); |
+ |
+ // This implicity creates it. |
+ writeFile("a/b/c/d/file.txt"); |
+ expectAddEvent("a/b/c/d/file.txt"); |
+ }); |
+ |
+ test('when the watched directory is deleted, removes all files', () { |
+ writeFile("dir/a.txt"); |
+ writeFile("dir/b.txt"); |
+ |
+ createWatcher(dir: "dir"); |
+ |
+ deleteDir("dir"); |
+ expectRemoveEvents(["dir/a.txt", "dir/b.txt"]); |
+ }); |
} |