Index: pkg/watcher/test/no_subscription/shared.dart |
diff --git a/pkg/watcher/test/no_subscription/shared.dart b/pkg/watcher/test/no_subscription/shared.dart |
index cd279e1ca2c88086e141b7ec27fb0016bd2b0860..6623ba363f349b76dfc4e86acc23f771828604f0 100644 |
--- a/pkg/watcher/test/no_subscription/shared.dart |
+++ b/pkg/watcher/test/no_subscription/shared.dart |
@@ -19,8 +19,7 @@ sharedTests() { |
// Subscribe to the events. |
var completer = new Completer(); |
var subscription = watcher.events.listen(wrapAsync((event) { |
- expect(event.type, equals(ChangeType.ADD)); |
- expect(event.path, endsWith("file.txt")); |
+ expect(event, isWatchEvent(ChangeType.ADD, "file.txt")); |
completer.complete(); |
})); |
@@ -41,10 +40,19 @@ sharedTests() { |
schedule(() { |
completer = new Completer(); |
subscription = watcher.events.listen(wrapAsync((event) { |
+ // TODO(nweiz): Remove this when either issue 14373 or 14793 is fixed. |
+ // Issue 14373 means that the new [Directory.watch] will emit an event |
+ // for "unwatched.txt" being created, and issue 14793 means we have to |
+ // check the filesystem, which leads us to assume that the file has been |
+ // modified. |
+ if (Platform.isMacOS && event.path.endsWith("unwatched.txt")) { |
+ expect(event, isWatchEvent(ChangeType.MODIFY, "unwatched.txt")); |
+ return; |
+ } |
+ |
// We should get an event for the third file, not the one added while |
// we weren't subscribed. |
- expect(event.type, equals(ChangeType.ADD)); |
- expect(event.path, endsWith("added.txt")); |
+ expect(event, isWatchEvent(ChangeType.ADD, "added.txt")); |
completer.complete(); |
})); |