This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make source filters work in evalbytes
[perl5.git] / ext / XS-APItest / t / eval-filter.t
... / ...
CommitLineData
1#!perl -w
2use strict;
3
4use Test::More tests => 5;
5use 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
25BEGIN { eval "BEGIN{ filter() }" }
26
27is "foo", "fee", "evals share filters with the currently compiling scope";
28# See [perl #87064].