diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-02-26 18:40:14 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-02-26 18:40:14 -0600 |
commit | b4b04aaa5f710f713af97a0215e6c6e637010622 (patch) | |
tree | 0ddd4e5c9e86a66f60b0cdfd0062c547279d739a /t/11-multiple-instantiation.t | |
parent | fd718a9b47c6358418fbab892f16a18263d431ea (diff) | |
download | bread-board-declare-b4b04aaa5f710f713af97a0215e6c6e637010622.tar.gz bread-board-declare-b4b04aaa5f710f713af97a0215e6c6e637010622.zip |
another test
Diffstat (limited to 't/11-multiple-instantiation.t')
-rw-r--r-- | t/11-multiple-instantiation.t | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/t/11-multiple-instantiation.t b/t/11-multiple-instantiation.t new file mode 100644 index 0000000..7c5d8a2 --- /dev/null +++ b/t/11-multiple-instantiation.t @@ -0,0 +1,40 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +{ + package Bar; + use Moose; + + has foo => ( + is => 'ro', + isa => 'Str', + required => 1, + ); +} + +{ + package Foo; + use Moose; + use Bread::Board::Declare; + + has foo => ( + is => 'ro', + isa => 'Str', + value => 'FOO', + ); + + has bar => ( + is => 'ro', + isa => 'Bar', + dependencies => ['foo'], + ); +} + +my $foo1 = Foo->new; +is($foo1->bar->foo, 'FOO'); +my $foo2 = Foo->new(foo => 'BAR'); +is($foo2->bar->foo, 'BAR'); + +done_testing; |