http://qs321.pair.com?node_id=843383

macrobat has asked for the wisdom of the Perl Monks concerning the following question:

Hello, all,

I'm using Test::More and Moose.

My minimal Moose class looks a little like this:

package Foo; use Moose; has 'first_name' => ( is => 'rw', isa => 'Str', required => 1); has 'last_name' => ( is => 'rw', isa => 'Str', required => 1); no Moose; 1;

My new.t file has the following:

use Foo; use Test::More tests => 2; ok( my $foo = Foo->new( first_name => 'Joe', last_name => 'Average', ) ); ok( my $incomplete = Foo->new( first_name => 'Joe', ) );

Now, I know the second test will fail; it's what I'm testing for. What I don't know is, how do I tell Test::More that failure is what I'm hoping for? I've tried wrapping it in an eval and testing $@, but it still reports as a failure.

Am I missing something glaringly obvious here?