Object-LocalVars

 view release on metacpan or  search on metacpan

t/15-no-helper-inheritance.t  view on Meta::CPAN

use Test::Exception;
use t::Common;
# work around win32 console buffering
Test::More->builder->failure_output(*STDOUT) 
    if ($^O eq 'MSWin32' && $ENV{HARNESS_VERBOSE});

plan tests => 4;

my $class = "t::Object::Morbid::Sub";

my $ok = require_ok($class);

SKIP: {
    skip "because we didn't load $class object", 3
        unless $ok;
    my $o;
    lives_ok { $o = $class->new() } 
        "PREBUILD and BUILD methods should not be inherited";
    dies_ok  { $o->BUILD( inherit_test_flag => 1 ) }
        "Inherited BUILD should die";
    skip "because we didn't create a $class object", 1

t/Common.pm  view on Meta::CPAN


use Test::More;
use Test::Exception;

sub load_fail_msg { return "because $_[0] isn't loaded" }
sub method_fail_msg { return "because $_[0] can't $_[1]" }

sub TC { return 1 + TN() }
sub test_constructor {
    my ($class, @args) = @_;
    my $pass = require_ok( $class );
    my $o;
    SKIP: {
        skip load_fail_msg($class), TC() - 1 unless $pass;
        $o = test_new($class,@args);
    }
    return $o;
}

sub TN { return 2 }
sub test_new {



( run in 0.401 second using v1.01-cache-2.11-cpan-05444aca049 )