5 require_ok 'PublicInbox::OnDestroy';
7 my $od = PublicInbox::OnDestroy->new(sub { push @x, 'hi' });
8 is_deeply(\@x, [], 'not called, yet');
10 is_deeply(\@x, [ 'hi' ], 'no args works');
11 $od = PublicInbox::OnDestroy->new(sub { $x[0] = $_[0] }, 'bye');
12 is_deeply(\@x, [ 'hi' ], 'nothing changed while alive');
14 is_deeply(\@x, [ 'bye' ], 'arg passed');
15 $od = PublicInbox::OnDestroy->new(sub { @x = @_ }, qw(x y));
17 is_deeply(\@x, [ 'x', 'y' ], '2 args passed');
19 if (my $nr = $ENV{TEST_LEAK_NR}) {
21 $od = PublicInbox::OnDestroy->new(sub { @x = @_ }, qw(x y));