xref: /openbsd-src/gnu/usr.bin/perl/ext/XS-APItest/t/check_warnings.t (revision 898184e3e61f9129feb5978fad5a8c6865f00b92)
1*898184e3Ssthen#!perl
2*898184e3Ssthen
3*898184e3Ssthen# This test checks to make sure that a BEGIN block created from an XS call
4*898184e3Ssthen# does not implicitly change the current warning scope, causing a CHECK
5*898184e3Ssthen# or INIT block created after the corresponding phase to warn when it
6*898184e3Ssthen# shouldn’t.
7*898184e3Ssthen
8*898184e3Ssthenuse Test::More tests => 1;
9*898184e3Ssthen
10*898184e3Ssthen$SIG{__WARN__} = sub { $w .= shift };
11*898184e3Ssthen
12*898184e3Ssthenuse warnings;
13*898184e3Sstheneval q|
14*898184e3Ssthen  BEGIN{
15*898184e3Ssthen    no warnings;
16*898184e3Ssthen    package XS::APItest; require XSLoader; XSLoader::load()
17*898184e3Ssthen  }
18*898184e3Ssthen|;
19*898184e3Ssthen
20*898184e3Ssthenis $w, undef, 'No warnings about CHECK and INIT in warningless scope';
21