From: Dave Rolsky Date: Sun, 17 Oct 2010 20:41:34 +0000 (-0500) Subject: Make sure all tests lives, and test that we can pass a hashref to buildargs X-Git-Tag: 1.16~23^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b8f320d72b764f761c3cedea345c24377f1b7bb7;p=gitmo%2FMoose.git Make sure all tests lives, and test that we can pass a hashref to buildargs --- diff --git a/t/010_basics/022_buildargs_warning.t b/t/010_basics/022_buildargs_warning.t index f9cd94c..7c99849 100644 --- a/t/010_basics/022_buildargs_warning.t +++ b/t/010_basics/022_buildargs_warning.t @@ -3,6 +3,7 @@ use strict; use warnings; +use Test::Exception; use Test::More; use Test::Moose qw( with_immutable ); @@ -16,13 +17,19 @@ use Test::Requires { } with_immutable { - stderr_like { Baz->new( x => 42, 'y' ) } - qr{\QThe new() method for Baz expects a hash reference or a key/value list. You passed an odd number of arguments at t/010_basics/022_buildargs_warning.t line \E\d+}, - 'warning when passing an odd number of args to new()'; + lives_and { + stderr_like { Baz->new( x => 42, 'y' ) } + qr{\QThe new() method for Baz expects a hash reference or a key/value list. You passed an odd number of arguments at t/010_basics/022_buildargs_warning.t line \E\d+}, + 'warning when passing an odd number of args to new()'; - stderr_unlike { Baz->new( x => 42, 'y' ) } - qr{\QOdd number of elements in anonymous hash}, - 'we suppress the standard warning from Perl for an odd number of elements in a hash'; + stderr_unlike { Baz->new( x => 42, 'y' ) } + qr{\QOdd number of elements in anonymous hash}, + 'we suppress the standard warning from Perl for an odd number of elements in a hash'; + + stderr_is { Baz->new( { x => 42 } ) } + q{}, + 'we handle a single hashref to new without errors'; + }; } 'Baz';