public
Created

  • Download Gist
gistfile1.PL
Perl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
use strict;
use warnings;
use Test::More;
use Test::Memory::Cycle;
use AnyEvent;
use AnyEvent::Handle;
 
my $t; $t = AE::timer 0,0, sub{ $t };
memory_cycle_ok( $t, 'no leaks in timer' );
 
my $hdl; $hdl = AnyEvent::Handle->new(
fh => \*STDIN,
on_error => sub { $hdl },
);
memory_cycle_ok( $hdl, 'no leaks in handle' );
 
done_testing;
 
__END__
 
% prove -v cycle.t
cycle.t ..
ok 1 - no leaks in timer
not ok 2 - no leaks in handle
 
# Failed test 'no leaks in handle'
# at cycle.t line 15.
# Cycle #1
# AnyEvent::Handle A->{on_error} => &B
# closure &B, $hdl => AnyEvent::Handle A
1..2
# Looks like you failed 1 test of 2.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
 
Test Summary Report
-------------------
cycle.t (Wstat: 256 Tests: 2 Failed: 1)
Failed test: 2
Non-zero exit status: 1
Files=1, Tests=2, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.05 cusr 0.01 csys = 0.10 CPU)
Result: FAIL

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.