| 1 |
-- test END block handling |
| 2 |
|
| 3 |
-- Not included in the normal testing |
| 4 |
-- because it's beyond the scope of the test harness. |
| 5 |
-- Available here for manual developer testing. |
| 6 |
|
| 7 |
DO $do$ |
| 8 |
my $testlog = "/tmp/pgplperl_test.log"; |
| 9 |
|
| 10 |
warn "Run test, then examine contents of $testlog (which must already exist)\n"; |
| 11 |
return unless -f $testlog; |
| 12 |
|
| 13 |
use IO::Handle; # for autoflush |
| 14 |
open my $fh, '>', $testlog |
| 15 |
or die "Can't write to $testlog: $!"; |
| 16 |
$fh->autoflush(1); |
| 17 |
|
| 18 |
print $fh "# you should see just 3 'Warn: ...' lines: PRE, END and SPI ...\n"; |
| 19 |
$SIG{__WARN__} = sub { print $fh "Warn: @_" }; |
| 20 |
$SIG{__DIE__} = sub { print $fh "Die: @_" unless $^S; die @_ }; |
| 21 |
|
| 22 |
END { |
| 23 |
warn "END\n"; |
| 24 |
eval { spi_exec_query("select 1") }; |
| 25 |
warn $@; |
| 26 |
} |
| 27 |
warn "PRE\n"; |
| 28 |
|
| 29 |
$do$ language plperlu; |