Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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?


In reply to Deliberate failure in Test::More by macrobat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2022-01-27 11:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (70 votes). Check out past polls.

    Notices?