This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta up to a98d1b3
[perl5.git] / ext / XS-APItest / t / peep.t
CommitLineData
65bfe90c
FR
1#!perl -w
2
3BEGIN {
4 push @INC, "::lib:$MacPerl::Architecture:" if $^O eq 'MacOS';
5 require Config; import Config;
6 if ($Config{'extensions'} !~ /\bXS\/APItest\b/) {
7 # Look, I'm using this fully-qualified variable more than once!
8 my $arch = $MacPerl::Architecture;
9 print "1..0 # Skip: XS::APItest was not built\n";
10 exit 0;
11 }
12}
13
14use strict;
15use warnings;
16
17BEGIN {
18 require '../../t/test.pl';
19 plan(6);
20 use_ok('XS::APItest')
21};
22
23my $record = XS::APItest::peep_record;
24
25XS::APItest::peep_enable;
26
27# our peep got called and remembered the string constant
28eval q[my $foo = q/affe/];
29is(scalar @{ $record }, 1);
30is($record->[0], 'affe');
31
32XS::APItest::peep_record_clear;
33
34# peep got called for each root op of the branch
35$::moo = $::moo = 0;
36eval q[my $foo = $::moo ? q/x/ : q/y/];
37is(scalar @{ $record }, 2);
38is($record->[0], 'x');
39is($record->[1], 'y');