summaryrefslogtreecommitdiffstats
path: root/t/11-multiple-instantiation.t
diff options
context:
space:
mode:
Diffstat (limited to 't/11-multiple-instantiation.t')
-rw-r--r--t/11-multiple-instantiation.t40
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;