Help language development. Donate to The Perl Foundation

FileSystem::Parent cpan:LEMBARK last updated on 2019-08-10

t/11-wanted.t
use v6.d;
use lib $*PROGRAM.parent(2).add( 'lib' ).absolute;

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;