summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--t/01-basic.t1
-rw-r--r--t/40-mop.t38
2 files changed, 39 insertions, 0 deletions
diff --git a/t/01-basic.t b/t/01-basic.t
index c59a429..38590df 100644
--- a/t/01-basic.t
+++ b/t/01-basic.t
@@ -44,6 +44,7 @@ with_immutable {
$i = 0;
{
my $foo = Foo->new;
+ isa_ok($foo, 'Bread::Board::Container');
ok($foo->has_service($_), "has service $_")
for qw(bar baz quux);
ok(!$foo->has_service('foo'), "doesn't have service foo");
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;