summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-09-29 13:12:45 -0500
committerJesse Luehrs <doy@tozt.net>2011-09-29 13:12:45 -0500
commitc513dd3113943da6b6d1b42203d18a2bbb908de1 (patch)
tree3c40292a05df3d03d72411201f48c5598119ad1b /t
parent3d719db0faf9c9b5ada4973b8225d9927ed968f7 (diff)
downloadbread-board-declare-c513dd3113943da6b6d1b42203d18a2bbb908de1.tar.gz
bread-board-declare-c513dd3113943da6b6d1b42203d18a2bbb908de1.zip
allow specifying dependencies inline
Diffstat (limited to 't')
-rw-r--r--t/inline-services.t33
1 files changed, 33 insertions, 0 deletions
diff --git a/t/inline-services.t b/t/inline-services.t
new file mode 100644
index 0000000..fc047c8
--- /dev/null
+++ b/t/inline-services.t
@@ -0,0 +1,33 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+{
+ package Foo;
+ use Moose;
+ use Bread::Board::Declare;
+
+ has foo => (
+ is => 'ro',
+ isa => 'Str',
+ block => sub {
+ my ($s) = @_;
+ return 'foo' . $s->param('bar') . $s->param('baz');
+ },
+ dependencies => {
+ bar => dep('bar'),
+ baz => dep(value => 'zab'),
+ },
+ );
+
+ has bar => (
+ is => 'ro',
+ isa => 'Str',
+ value => 'BAR',
+ );
+}
+
+is(Foo->new->foo, 'fooBARzab', "inline dependencies resolved properly");
+
+done_testing;