stas 2004/05/24 11:38:17
Modified: t/response/TestAPR pool.pm Log: fix the undefined cleanup subs tests to trap the errors in real time Revision Changes Path 1.13 +11 -7 modperl-2.0/t/response/TestAPR/pool.pm Index: pool.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/pool.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -u -u -r1.12 -r1.13 --- pool.pm 14 May 2004 07:58:21 -0000 1.12 +++ pool.pm 24 May 2004 18:38:16 -0000 1.13 @@ -16,7 +16,7 @@ sub handler { my $r = shift; - plan $r, tests => 76; + plan $r, tests => 78; ### native pools ### @@ -372,20 +372,24 @@ $r->notes->clear; } - # bogus callbacks unfortunately will fail only when the pool is - # destroyed, and we have no way to propogate (and thus trap) those - # errors. They are logged though. So as usual, one has to always - # watch error_log (things like CGI::Carp's fatalsToBrowser) won't - # quite be able to catch those. + # undefined cleanup subs { my $p = APR::Pool->new; t_server_log_error_is_expected(); - $p->cleanup_register('some_bogus_non_existing', 1); + $p->cleanup_register('TestAPR::pool::some_non_existing_sub', 1); + eval { $p->destroy }; + ok t_cmp(qr/Undefined subroutine/, + $@, + "non existing function"); } { my $p = APR::Pool->new; t_server_log_error_is_expected(); $p->cleanup_register(\&non_existing1, 1); + eval { $p->destroy }; + ok t_cmp(qr/Undefined subroutine/, + $@, + "non existing function"); } ### $p->clear ###