summaryrefslogtreecommitdiffstats
path: root/t/inline-services.t
blob: fc047c8ab63d8c0fc4c76b5df50354b314ea347a (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
28
29
30
31
32
33
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;

{
    package Foo;
    use Moose;
    use Bread::Board::Declare;

    has foo => (
        is  => 'ro',
        isa => 'Str',
        block => sub {
            my ($s) = @_;
            return 'foo' . $s->param('bar') . $s->param('baz');
        },
        dependencies => {
            bar => dep('bar'),
            baz => dep(value => 'zab'),
        },
    );

    has bar => (
        is    => 'ro',
        isa   => 'Str',
        value => 'BAR',
    );
}

is(Foo->new->foo, 'fooBARzab', "inline dependencies resolved properly");

done_testing;