]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/on_destroy.t
www: drop --subject from "git send-email" instructions
[public-inbox.git] / t / on_destroy.t
index 8b85b48ecb7b361ff2b056d53f3e45a197f6c4ee..0de67d0bcde10c116e49270dd20a7dff3b1ea72e 100644 (file)
@@ -16,6 +16,15 @@ $od = PublicInbox::OnDestroy->new(sub { @x = @_ }, qw(x y));
 undef $od;
 is_deeply(\@x, [ 'x', 'y' ], '2 args passed');
 
+open my $tmp, '+>>', undef or BAIL_OUT $!;
+$tmp->autoflush(1);
+$od = PublicInbox::OnDestroy->new(1, sub { print $tmp "$$ DESTROY\n" });
+undef $od;
+is(-s $tmp, 0, '$tmp is empty on pid mismatch');
+$od = PublicInbox::OnDestroy->new($$, sub { $tmp = $$ });
+undef $od;
+is($tmp, $$, '$tmp set to $$ by callback');
+
 if (my $nr = $ENV{TEST_LEAK_NR}) {
        for (0..$nr) {
                $od = PublicInbox::OnDestroy->new(sub { @x = @_ }, qw(x y));