### ----------------------------------------------------
### -- P5-X
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use v6.d;
use Test;
use P5-X;

my @exported = <r w x e d f l s z>.map: '&prefix:<-' ~ * ~ '>';

my @files = <r rw rwx rx>;
my @perms = <4  6   7  5>.map: (* ~ '00').parse-base(8);

plan @exported + @files * 6;

for @exported {
    ok defined(::($_)), "is $_ imported?";
}

indir $?FILE.IO.parent, {
    LEAVE unlink(@files);  # cleanup

    for @files.kv -> $index, $file {
        spurt($file,$file);
        chmod(@perms[$index],$file);

        is (-e $file),              1, "is -e '$file' ok";
        is (-s $file),    $file.chars, "is -s '$file' ok";
        is (-e -s $file),           1, "is -e -s '$file' ok";
        is (-s -e $file), $file.chars, "is -s -e '$file' ok";

        is (-z $file),    "", "is -z '$file' ok";
        is (-f -z $file), "", "is -f -z '$file' ok";
    }

#    is (-f -z "nowhere"), "", "is -f -z 'nowhere' ok";
}

# vim: expandtab shiftwidth=4


