7 use DBIx::Class::_Util 'quote_sub';
9 ### Test for strictures leakage
12 quote_sub 'DBICTest::QSUB::nostrict'
13 => '$x = $x . "buh"; $x += 42';
17 is $q->(), 42, 'Expected result after uninit and string/num conversion'
19 qr/Use of uninitialized value/i,
20 qr/isn't numeric in addition/,
21 ], 'Expected warnings, strict did not leak inside the qsub'
24 diag( B::Deparse->new->coderef2text( Sub::Quote::unquote_sub($q) ) )
28 my $no_nothing_q = sub {
31 quote_sub 'DBICTest::QSUB::nowarn', <<'EOC';
32 BEGIN { warn "-->${^WARNING_BITS}<--\n" };
33 my $n = "Test::Warn::warnings_exist";
34 warn "-->@{[ *{$n}{CODE} ]}<--\n";
38 my $we_cref = Test::Warn->can('warnings_exist');
40 warnings_exist { $no_nothing_q->()->() } [
41 qr/^\-\-\>\0+\<\-\-$/m,
42 qr/^\Q-->$we_cref<--\E$/m,
43 ], 'Expected warnings, strict did not leak inside the qsub'
46 diag( B::Deparse->new->coderef2text( Sub::Quote::unquote_sub($no_nothing_q) ) )