Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Monday November 17, 2008
10:29 AM

Test::Most::Exception - Important, But You Won't Need It

[ #37896 ]

Recently I uploaded the new Test::Most. From the end user perspective, the only real change (aside from being a touch easier to install), is that if you ask it to die when a test fails, it no longer just dies. Instead, it throws a Test::Most::Exception. The vast majority of people will never, ever need this feature. However, our test suite gets a bit tricky at times and we do things like this:

foreach my $test (@tests) {
    my $tests_finished = eval { $test->run };
    if ( my $error = $@ ) {
        report_error( $test, $error );
    }
    else {
        ...
    }
}

Internally, the way we report failures depends very much upon whether or not the tests halted because Test::Most was told to halt on failures, or whether they really died. Now I can just do this in the &report_error sub:

if ( eval { $error->isa('Test::Most::Exception') } ) { ... }

And much grief is saved.

In other news, I've been asked to add timing data to Test::Aggregate and I've thought that prove's state mechanism should possibly be extended to capture aggregated state information. In other words, while I didn't really intend to, I'm writing yet another new test harness. You would think I've learned my lesson after writing the new Test::Harness (also by accident, I might add).

And yes, I've toyed with colored test output for it ...

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.