Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

by Aristotle (Chancellor)
on Jan 18, 2003 at 20:40 UTC ( #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
Node Status?
node history
Node Type: note [id://228055]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-08-22 02:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (145 votes), past polls