<commit_before>use v6;

use Test;

plan 2;

my $forawhile = 1;
my $filename = "watch-path_checker";
END { unlink $filename if $filename }  # make sure we cleanup

unlink $filename; # in case we missed the cleanup
ok !$filename.IO.e, "make sure we don't have a file";

given $*DISTRO.name {
    when "macosx" {
#?rakudo.jvm skip "file system events NYI? RT #124828"
        subtest &macosx, "does watch-path work on Mac OS X";
    }
    default {
        pass "Nothing reliable to test yet";
    }
}

#====  specific tests from here
sub macosx {
    plan 22;
    my $s = IO::Notification.watch-path('.').grep({.path eq $filename}).unique;<commit_msg>[io grant] Test IO::Path.watch<commit_after>use v6;

use Test;

plan 4;

my $forawhile = 1;
my $filename = "watch-path_checker";
END { unlink $filename if $filename }  # make sure we cleanup

unlink $filename; # in case we missed the cleanup
ok !$filename.IO.e, "make sure we don't have a file";

given $*DISTRO.name {
    when "macosx" {
#?rakudo.jvm 3 skip "file system events NYI? RT #124828"
        subtest &macosx, "does watch-path work on Mac OS X";

        unlink $filename; # in case we missed the cleanup
        ok !$filename.IO.e, "make sure we don't have a file (2)";

        subtest { macosx :io-path }, "does IO::Path.watch work on Mac OS X";
    }
    default {
        skip "Only OSX tests available", 3;
    }
}

#====  specific tests from here
sub macosx (:$io-path) {
    plan 22;
    my $s = (
        $io-path ?? '.'.IO.watch !! IO::Notification.watch-path: '.'
    ).grep({.path eq $filename}).unique;
{'fraction_non_alphanumeric': 0.13968253968253969, 'fraction_numerical': 0.015873015873015872, 'mean_word_length': 2.959798994974874, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '734815', 'n_tokens_mistral': 583, 'n_tokens_neox': 552, 'n_words': 193}