diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-04-15 23:52:31 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-04-15 23:52:31 -0500 |
commit | 1d668665354678a7c9f95e5eb97ae0e27c62cd4c (patch) | |
tree | 017f9113a22401e325ba5c215a8e64096438f208 /t | |
parent | 3405a817789d09aaad2a0476ec508ec4d5def9bf (diff) | |
download | bread-board-declare-1d668665354678a7c9f95e5eb97ae0e27c62cd4c.tar.gz bread-board-declare-1d668665354678a7c9f95e5eb97ae0e27c62cd4c.zip |
get auto-inferring services working
Diffstat (limited to 't')
-rw-r--r-- | t/50-infer.t | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/t/50-infer.t b/t/50-infer.t new file mode 100644 index 0000000..d3bd1cc --- /dev/null +++ b/t/50-infer.t @@ -0,0 +1,59 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +{ + package Foo; + use Moose; +} + +{ + package Bar; + use Moose; +} + +{ + package Baz; + use Moose; + + has foo => ( + is => 'ro', + isa => 'Foo', + required => 1, + ); + + has bar => ( + is => 'ro', + isa => 'Bar', + required => 1, + ); +} + +{ + package My::Container; + use Moose; + use Bread::Board::Declare; + + has foo => ( + is => 'ro', + isa => 'Foo', + ); + + has bar => ( + is => 'ro', + isa => 'Bar', + ); + + has baz => ( + is => 'ro', + isa => 'Baz', + ); +} + +my $c = My::Container->new; +isa_ok($c->baz, 'Baz'); +isa_ok($c->baz->foo, 'Foo'); +isa_ok($c->baz->bar, 'Bar'); + +done_testing; |