This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
do-file should not force a bareword
[perl5.git] / t / op / utf8cache.t
1 #!./perl -w
2 # Test for malfunctions of utf8 cache
3
4 BEGIN {
5     chdir 't' if -d 't';
6     @INC = '../lib';
7     require './test.pl';
8     skip_all_without_dynamic_extension('Devel::Peek');
9 }
10
11 use strict;
12
13 plan(tests => 1);
14
15 my $pid = open CHILD, '-|';
16 die "kablam: $!\n" unless defined $pid;
17 unless ($pid) {
18     open STDERR, ">&STDOUT";
19     $a = "hello \x{1234}";
20     for (1..2) {
21         bar(substr($a, $_, 1));
22     }
23     sub bar {
24         $_[0] = "\x{4321}";
25         Devel::Peek::Dump($_[0]);
26     }
27     exit;
28 }
29
30 { local $/; $_ = <CHILD> }
31
32 my $utf8magic = qr{ ^ \s+ MAGIC \s = .* \n
33                       \s+ MG_VIRTUAL \s = .* \n
34                       \s+ MG_TYPE \s = \s PERL_MAGIC_utf8 .* \n
35                       \s+ MG_LEN \s = .* \n }xm;
36
37 unlike($_, qr{ $utf8magic $utf8magic }x);