diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-02-21 02:00:06 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-02-21 02:00:06 -0600 |
commit | 0a7125e470e2067f75faf81f7e1890bc402e5e98 (patch) | |
tree | a6dd03e113cf77e50096307615f6225b0fc8c4b4 /t/40-mop.t | |
parent | 06f919c57dfc917e50e6858100cfbe3a1b57a1be (diff) | |
download | bread-board-declare-0a7125e470e2067f75faf81f7e1890bc402e5e98.tar.gz bread-board-declare-0a7125e470e2067f75faf81f7e1890bc402e5e98.zip |
test for mop stuff
Diffstat (limited to 't/40-mop.t')
-rw-r--r-- | t/40-mop.t | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/t/40-mop.t b/t/40-mop.t new file mode 100644 index 0000000..c8f0dd9 --- /dev/null +++ b/t/40-mop.t @@ -0,0 +1,38 @@ +#!/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', + value => 'FOO', + ); + + has bar => ( + is => 'ro', + isa => 'Str', + block => sub { + my $s = shift; + return $s->param('foo') . 'BAR'; + }, + dependencies => ['foo'], + ); +} + +{ + my $foo = Foo->new; + my $foo_attr = $foo->meta->get_attribute('foo'); + my $bar_attr = $foo->meta->get_attribute('bar'); + is($foo_attr->get_value($foo), 'FOO', "right value"); + is($bar_attr->get_value($foo), 'FOOBAR', "right value"); + ok(!$foo_attr->has_value($foo), "no value"); + ok(!$bar_attr->has_value($foo), "no value"); +} + +done_testing; |