Debian Codegraph @

ext/XS-APItest/t/eval-filter.t

raw
1 #!perl -w
2 use strict;
3
4 use Test::More tests => 5;
5 use XS::APItest;
6
7 {
8 use feature "unicode_eval";
9 my $unfiltered_foo = "foo";
10 BEGIN {
11 eval "BEGIN { filter() }";
12 like $@, qr/^Source filters apply only to byte streams at /,
13 'filters die under unicode_eval';
14 }
15 is "foo", $unfiltered_foo, 'filters leak not out of unicode evals';
16
17 use feature "evalbytes";
18 our $thingy;
19 BEGIN { evalbytes "BEGIN { filter() }\n\$thingy = 'foo'" }
20 is $thingy, "fee",
21 "source filters apply to evalbytten strings";
22 is "foo", $unfiltered_foo, 'filters leak not out of byte evals';
23 }
24
25 BEGIN { eval "BEGIN{ filter() }" }
26
27 is "foo", "fee", "evals share filters with the currently compiling scope";
28 # See [perl #87064].