blob: 08928c44c99a1ec978d265b5e5dd2df3254d2fda (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!perl
use strict;
use warnings;
use Test::More tests => 9;
use XS::APItest;
my $record = XS::APItest::peep_record;
my $rrecord = XS::APItest::rpeep_record;
# our peep got called and remembered the string constant
XS::APItest::peep_enable;
eval q[my $foo = q/affe/];
XS::APItest::peep_disable;
is(scalar @{ $record }, 1);
is(scalar @{ $rrecord }, 1);
is($record->[0], 'affe');
is($rrecord->[0], 'affe');
# peep got called for each root op of the branch
$::moo = $::moo = 0;
XS::APItest::peep_enable;
eval q[my $foo = $::moo ? q/x/ : q/y/];
XS::APItest::peep_disable;
is(scalar @{ $record }, 1);
is(scalar @{ $rrecord }, 2);
is($record->[0], 'y');
is($rrecord->[0], 'x');
is($rrecord->[1], 'y');
|