This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Convert t/op/utf8cache.t to test.pl, strict and warnings.
[perl5.git] / t / op / utf8cache.t
CommitLineData
c45bec60 1#!./perl -w
fa421ef9
CS
2# Test for malfunctions of utf8 cache
3
4BEGIN {
5 chdir 't' if -d 't';
6 @INC = '../lib';
c45bec60
NC
7 require './test.pl';
8 skip_all_without_dynamic_extension('Devel::Peek');
fa421ef9
CS
9}
10
c45bec60
NC
11use strict;
12
13plan(tests => 1);
fa421ef9
CS
14
15my $pid = open CHILD, '-|';
16die "kablam: $!\n" unless defined $pid;
17unless ($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
32my $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
c45bec60 37unlike($_, qr{ $utf8magic $utf8magic }x);