| 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 e76f7199f0fbecdd0fe1bf54541a61ea1c6ea623..2cc97b7aadb9b317115d2781736275618134e831 100644
|
| --- a/tests/standalone/io/file_system_watcher_test.dart
|
| +++ b/tests/standalone/io/file_system_watcher_test.dart
|
| @@ -300,6 +300,33 @@ void testWatchNonExisting() {
|
| }
|
|
|
|
|
| +void testWatchMoveSelf() {
|
| + // Windows keeps the directory handle open, even though it's deleted. It'll
|
| + // be flushed completely, once the watcher is closed as well.
|
| + if (Platform.isWindows) return;
|
| + var dir = Directory.systemTemp.createTempSync('dart_file_system_watcher');
|
| + var dir2 = new Directory(join(dir.path, 'dir'))..createSync();
|
| +
|
| + var watcher = dir2.watch();
|
| +
|
| + asyncStart();
|
| + var sub;
|
| + bool gotDelete = false;
|
| + sub = watcher.listen((event) {
|
| + if (event is FileSystemDeleteEvent) {
|
| + Expect.isTrue(event.path.endsWith('dir'));
|
| + gotDelete = true;
|
| + }
|
| + }, onDone: () {
|
| + Expect.isTrue(gotDelete);
|
| + dir.deleteSync(recursive: true);
|
| + asyncEnd();
|
| + });
|
| +
|
| + dir2.renameSync(join(dir.path, 'new_dir'));
|
| +}
|
| +
|
| +
|
| void main() {
|
| if (!FileSystemEntity.isWatchSupported) return;
|
| testWatchCreateFile();
|
| @@ -312,4 +339,5 @@ void main() {
|
| testMultipleEvents();
|
| testWatchNonRecursive();
|
| testWatchNonExisting();
|
| + testWatchMoveSelf();
|
| }
|
|
|