Test-Simple
view release on metacpan or search on metacpan
t/Legacy/overload.t view on Meta::CPAN
num => shift,
stringify => 0,
numify => 0,
}, $class;
}
package main;
local $SIG{__DIE__} = sub {
my($call_file, $call_line) = (caller)[1,2];
fail("SIGDIE accidentally called");
diag("From $call_file at $call_line");
};
my $obj = Overloaded->new('foo', 42);
isa_ok $obj, 'Overloaded';
cmp_ok $obj, 'eq', 'foo', 'cmp_ok() eq';
is $obj->{stringify}, 0, ' does not stringify';
is $obj, 'foo', 'is() with string overloading';
t/Test2/modules/API/Context.t view on Meta::CPAN
);
ok($ctx != $snap, "snapshot is a new instance");
};
my $end_ctx;
{ # Simulate an END block...
local *END = sub { local *__ANON__ = 'END'; context() };
my $ctx = END();
$frame = [ __PACKAGE__, __FILE__, __LINE__ - 1, 'main::END' ];
# "__LINE__ - 1" on the preceding line forces the value to be an IV
# (even though __LINE__ on its own is a PV), just as (caller)[2] is.
$end_ctx = $ctx->snapshot;
$ctx->release;
}
delete $end_ctx->trace->frame->[4];
is_deeply( $end_ctx->trace->frame, $frame, 'context is ok in an end block');
# Test event generation
{
package My::Formatter;
( run in 0.430 second using v1.01-cache-2.11-cpan-a3c8064c92c )