This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Unescaped left braces in regular expressions will be fatal in 5.30.
[perl5.git] / t / uni / heavy.t
CommitLineData
0fd86aa7
TC
1#!./perl -w
2# tests that utf8_heavy.pl doesn't use anything that prevents it loading
3BEGIN {
4 chdir 't' if -d 't';
0fd86aa7 5 require './test.pl';
624c42e2 6 set_up_inc('../lib');
0fd86aa7
TC
7}
8
9plan tests => 1;
10
11# see [perl #126593]
12fresh_perl_is(<<'EOP', "", { stderr => 1 }, "doesn't break with \${^ENCODING}");
13no warnings qw(deprecated);
14package Foo;
15sub cat_decode {
16 # stolen from Encode.pm
17 my ( undef, undef, undef, $pos, $trm ) = @_;
18 my ( $rdst, $rsrc, $rpos ) = \@_[ 1, 2, 3 ];
19 use bytes;
20 if ( ( my $npos = index( $$rsrc, $trm, $pos ) ) >= 0 ) {
21 $$rdst .=
22 substr( $$rsrc, $pos, $npos - $pos + length($trm) );
23 $$rpos = $npos + length($trm);
24 return 1;
25 }
26 $$rdst .= substr( $$rsrc, $pos );
27 $$rpos = length($$rsrc);
28 return q();
29}
30
31sub decode {
32 my (undef, $tmp) = @_;
33 utf8::decode($tmp);
34 $tmp;
35}
36
37BEGIN { ${^ENCODING} = bless [], q(Foo) };
38
39(my $tmp = q(abc)) =~ tr/abc/123/;
40EOP