@@ -276,15 +276,17 @@ testRelativeLinksSync() {
276276}
277277
278278testIsDir () async {
279+ // Only run on Platforms that supports file watcher
279280 if (! Platform .isWindows && ! Platform .isLinux && ! Platform .isMacOS) return ;
280281 Directory sandbox = Directory .systemTemp.createTempSync ();
281282 Directory dir = new Directory (sandbox.path + Platform .pathSeparator + "dir" );
282283 dir.createSync ();
283284 File target = new File (sandbox.path + Platform .pathSeparator + "target" );
284285 target.createSync ();
285286
286- final eventCompleter = new Completer <FileSystemEvent >();
287+ var eventCompleter = new Completer <FileSystemEvent >();
287288 var subscription;
289+ // Check for link pointing to file
288290 subscription = dir.watch ().listen ((FileSystemEvent event) {
289291 if (event.path.endsWith ('link' )) {
290292 eventCompleter.complete (event);
@@ -293,8 +295,20 @@ testIsDir() async {
293295 });
294296 Link link = new Link (dir.path + Platform .pathSeparator + "link" );
295297 link.createSync (target.path);
296- final event = await eventCompleter.future;
297- // Link should not be marked as Dir.
298+ var event = await eventCompleter.future;
299+ Expect .isFalse (event.isDirectory);
300+
301+ // Check for link pointing to directory
302+ eventCompleter = new Completer <FileSystemEvent >();
303+ subscription = dir.watch ().listen ((FileSystemEvent event) {
304+ if (event.path.endsWith ('link2' )) {
305+ eventCompleter.complete (event);
306+ subscription.cancel ();
307+ }
308+ });
309+ link = new Link (dir.path + Platform .pathSeparator + "link2" );
310+ link.createSync (dir.path);
311+ event = await eventCompleter.future;
298312 Expect .isFalse (event.isDirectory);
299313
300314 sandbox.deleteSync (recursive: true );
0 commit comments