summaryrefslogtreecommitdiff
path: root/ext/XS-APItest/t/check_warnings.t
blob: 2de083d8ee23c6078a4117329fc6f8d1fcf46dfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!perl

# This test checks to make sure that a BEGIN block created from an XS call
# does not implicitly change the current warning scope, causing a CHECK
# or INIT block created after the corresponding phase to warn when it
# shouldn’t.

use Test::More tests => 1;

$SIG{__WARN__} = sub { $w .= shift };

use warnings;
eval q|
  BEGIN{
    no warnings;
    package XS::APItest; require XSLoader; XSLoader::load()
  }
|;

is $w, undef, 'No warnings about CHECK and INIT in warningless scope';