Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Test::Exception extension with (evil?) overloading

by Aristotle (Chancellor)
on Jan 18, 2003 at 20:40 UTC ( [id://228055]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub lives_and_tests_ok (&&;$) {
        my ($case, $test, $name) = @_;
    ...
        my $result = eval { $case->() };
        $@ ? fail($name) : $test->($result, $name);
    }
    
  2. or download this
    lives_and_tests_ok (
        sub { $o->answer },
        sub { is shift, 42, shift },
        "answer is 42"
    );
    
  3. or download this
    sub lives_and_tests_ok (&&;$) {
        my ($case, $test, $name) = @_;
    ...
        local ($b, $a) = ($name, eval { $case->() });
        $@ ? fail($name) : $test->($result, $name);
    }
    
  4. or download this
    lives_and_tests_ok (
        sub { $o->answer },
        sub { is $a, 42, $b },
        "answer is 42"
    );
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://228055]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-03-29 14:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found