This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In taint.t, add violates_taint(), to replace a repeated is()/like() pair.
[perl5.git] / t / op / utf8cache.t
CommitLineData
fa421ef9
CS
1#!./perl
2# Test for malfunctions of utf8 cache
3
4BEGIN {
5 chdir 't' if -d 't';
6 @INC = '../lib';
7}
8
9unless (eval { require Devel::Peek }) {
10 print "# Without Devel::Peek, never mind\n";
11 print "1..0\n";
12 exit;
13}
14print "1..1\n";
15
16my $pid = open CHILD, '-|';
17die "kablam: $!\n" unless defined $pid;
18unless ($pid) {
19 open STDERR, ">&STDOUT";
20 $a = "hello \x{1234}";
21 for (1..2) {
22 bar(substr($a, $_, 1));
23 }
24 sub bar {
25 $_[0] = "\x{4321}";
26 Devel::Peek::Dump($_[0]);
27 }
28 exit;
29}
30
31{ local $/; $_ = <CHILD> }
32
33my $utf8magic = qr{ ^ \s+ MAGIC \s = .* \n
34 \s+ MG_VIRTUAL \s = .* \n
35 \s+ MG_TYPE \s = \s PERL_MAGIC_utf8 .* \n
36 \s+ MG_LEN \s = .* \n }xm;
37
38if (m{ $utf8magic $utf8magic }x) {
39 print "not ";
40}
41print "ok 1\n";