Help language development. Donate to The Perl Foundation

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

t/15-want-dir.t
use v6.d;
use lib $*PROGRAM.parent(2).add( 'lib' ).absolute;

use Test;
use FileSystem::Parent;

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

sub pick_all
(
    IO $path --> Bool
)
{
    $path ~~ :e
}

my $append  = 'lib';

my $pass0  = scan-up :$verbose, :$append, filter => &pick_all;
ok $pass0,  'scan-up with want dir';

my $pass1  = scan-up :$verbose  :$append, filter => &pick_all, :from( $*PROGRAM-NAME );
ok $pass1,  'scan-up with want dir and start';

my @want0   = $pass0.eager;
my @want1   = $pass1.eager;

put "# Pass0:\t", @want0;
put "# Pass1:\t", @want1;

ok $pass0 ~~ $pass1, 'Bin and $*Program-Name return same list.';

done-testing;