diff options
Diffstat (limited to 't/04-block.t')
-rw-r--r-- | t/04-block.t | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/t/04-block.t b/t/04-block.t new file mode 100644 index 0000000..a06a950 --- /dev/null +++ b/t/04-block.t @@ -0,0 +1,39 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +{ + package Foo; + use Moose; + use MooseX::Bread::Board; + + has foo => ( + is => 'ro', + isa => 'Str', + default => 'FOO', + ); + + has bar => ( + is => 'ro', + isa => 'Str', + value => 'BAR', + ); + + has baz => ( + is => 'ro', + isa => 'Baz', + block => sub { + my ($s, $self) = @_; + return $s->param('bar') . $self->foo; + }, + dependencies => ['bar'], + ); +} + +{ + my $foo = Foo->new; + is($foo->baz, 'BARFOO', "self is passed properly"); +} + +done_testing; |