Test-Unit

 view release on metacpan or  search on metacpan

lib/Test/Unit/Assertion/CodeRef.pm  view on Meta::CPAN


use Carp;
use Test::Unit::Debug qw(debug);

my $deparser;

sub new {
    my $class = shift;
    my $code = shift;
    croak "$class\::new needs a CODEREF" unless ref($code) eq 'CODE';
    bless \$code => $class;
}

sub do_assertion {
    my $self = shift;
    my $possible_object = $_[0];
    debug("Called do_assertion(" . ($possible_object || 'undef') . ")\n");
    if (ref($possible_object) and
        ref($possible_object) ne 'Regexp' and
        eval { $possible_object->isa('UNIVERSAL') })
    {

lib/Test/Unit/Assertion/Exception.pm  view on Meta::CPAN

use Carp;
use Error qw/:try/;
use Test::Unit::Debug qw(debug);

my $deparser;

sub new {
    my $class = shift;
    my $exception_class = shift;
    croak "$class\::new needs an exception class" unless $exception_class;
    bless \$exception_class => $class;
}

sub do_assertion {
    my $self = shift;
    my $coderef = shift;
    my $exception_class = $$self;

    my $exception;
    try {
        &$coderef();



( run in 0.549 second using v1.01-cache-2.11-cpan-65fba6d93b7 )