summaryrefslogblamecommitdiffstats
path: root/t/004_block_injection_w_out_class.t
blob: 8ac4d65415530f9072cf5594a001ce2e61692d6a (plain) (tree)
1
2
3
4
5
6
7
8
9




                 
                                                                            


                                                                                  


















                                                                        

                                
use v6;
use Test;

use Bread::Board;

# PERL6: doing anything at all with the type object for a role with required
# methods is broken
#sub does_ok(Mu $var, Mu $type, $msg = ("The object does '" ~ $type.perl ~ "'")) {
sub does_ok(Mu $var, Mu $type, $msg = ("The object does [some role]")) {
    ok($var.does($type), $msg);
}

my $s = Bread::Board::BlockInjection.new(
    name         => 'NoClass',
    block        => -> $s { return { foo => $s.param('foo') } },
    dependencies => {
        foo => Bread::Board::Literal.new(name => 'foo', value => 'FOO');
    },
);

isa_ok($s, Bread::Board::BlockInjection);
does_ok($s, Bread::Board::Service);

my $x = $s.get;
isa_ok($x, Hash);
is_deeply($x, { foo => 'FOO' });

done;

# vim:ft=perl6:foldmethod=manual