summaryrefslogtreecommitdiffstats
path: root/t/infer.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-07-27 11:25:20 -0500
committerJesse Luehrs <doy@tozt.net>2011-07-27 11:39:01 -0500
commit946f6cd5f443b278239ec098bf4afda7c226688f (patch)
tree46e751a9858b40e1b525fd4263b6667c9c130a37 /t/infer.t
parent2d95b92582166f711e05c973f3e22950bbce6b2f (diff)
downloadbread-board-declare-946f6cd5f443b278239ec098bf4afda7c226688f.tar.gz
bread-board-declare-946f6cd5f443b278239ec098bf4afda7c226688f.zip
we want unknown stuff to become parameters here
Diffstat (limited to 't/infer.t')
-rw-r--r--t/infer.t20
1 files changed, 17 insertions, 3 deletions
diff --git a/t/infer.t b/t/infer.t
index 2b064a3..34703a0 100644
--- a/t/infer.t
+++ b/t/infer.t
@@ -104,10 +104,24 @@ use Test::Fatal;
}
{
+ my $c;
+ is(exception { $c = My::Container2->new }, undef,
+ "no error when not everything can be inferred");
like(
- exception { My::Container2->new },
- qr/^Only class types, role types, or subtypes of Object can be inferred\. I don't know what to do with type \(Str\)/,
- "correct error when not everything can be inferred"
+ exception { $c->baz },
+ qr/Mandatory parameter 'thing' missing/,
+ "error when resolving a service with unfulfilled parameters"
+ );
+ is(
+ exception {
+ my $baz = $c->resolve(
+ service => 'baz',
+ parameters => { thing => "THING" },
+ );
+ is($baz->thing, 'THING', "parameter provided correctly");
+ },
+ undef,
+ "no errors when parameters are given"
);
}