### ----------------------------------------------------
### -- if
### -- Licenses: Artistic-2.0
### -- Authors: 
### -- File: t/if.rakutest
### ----------------------------------------------------
use Test;

plan 5;

use lib $*PROGRAM.sibling("lib");

does-load-bar    'use Bar',                                    'a bare use still works';
does-load-bar    'use if; use Bar',                            'a bare use after loading if works';
doesn't-load-bar 'use if; use Bar:if(0)',                      ':if(0) prevents loading a package';
does-load-bar    'use if; use Bar:if($*RAKU.version ~~ v6.*)', 'we can use $*RAKU.version in :if';
doesn't-load-bar 'use if; use Bar:if($*RAKU.version ~~ v7)',   'we can use $*RAKU.version in :if';

sub does-load-bar {
    my $*PACKAGE_LOADED = 0;
    EVAL $^code;
    is $*PACKAGE_LOADED, 1, $^comment
}

sub doesn't-load-bar {
    my $*PACKAGE_LOADED = 0;
    EVAL $^code;
    is $*PACKAGE_LOADED, 0, $^comment
}

# vim: expandtab shiftwidth=4


