use v6.d;
use Test;

use FileSystem::Parent;

my $verbose 
= %*ENV< VERBOSE > 
?? True 
!! False
;

sub filter_1
(
    IO:D $path --> Bool
)
{
    True
}

my $filter_2    := &filter_1;
my $filter_3    := -> IO:D $path { True };
my $filter_4    = $filter_3;

my $pass0   = scan-up :$verbose;
my $pass1   = scan-up :$verbose, filter => &filter_1;
my $pass2   = scan-up :$verbose, filter => $filter_2;
my $pass3   = scan-up :$verbose, filter => $filter_3;
my $pass4   = scan-up :$verbose, filter => $filter_4;

ok $pass0.cache.eager ~~ $pass1.eager, 'pass0 matches filter all sub';
ok $pass0.cache.eager ~~ $pass2.eager, 'pass0 matches filter all ref to sub';
ok $pass0.cache.eager ~~ $pass3.eager, 'pass0 matches filter all block';
ok $pass0.cache.eager ~~ $pass4.eager, 'pass0 matches filter all var assined block';

done-testing;
