summaryrefslogtreecommitdiffstats
path: root/t/031_custom_lifecycles.t
blob: 549c31647a35b0b939430ac1a4819bca4580522e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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);
}

role MyLifeCycle does Singleton { }

class MyClass { }

my $s = Bread::Board::ConstructorInjection.new(
    lifecycle => MyLifeCycle,
    name      => 'foo',
    class     => MyClass,
);

does_ok($s, MyLifeCycle);

done;

# vim:ft=perl6:foldmethod=manual