From 946f6cd5f443b278239ec098bf4afda7c226688f Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 27 Jul 2011 11:25:20 -0500 Subject: we want unknown stuff to become parameters here --- t/infer.t | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 't/infer.t') 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" ); } -- cgit v1.2.3-54-g00ecf