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
1 #!perl -w
2
3 BEGIN {
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
14 use strict;
15 use warnings;
16
17 BEGIN {
18     require '../../t/test.pl';
19     plan(6);
20     use_ok('XS::APItest')
21 };
22
23 my $record = XS::APItest::peep_record;
24
25 XS::APItest::peep_enable;
26
27 # our peep got called and remembered the string constant
28 eval q[my $foo = q/affe/];
29 is(scalar @{ $record }, 1);
30 is($record->[0], 'affe');
31
32 XS::APItest::peep_record_clear;
33
34 # peep got called for each root op of the branch
35 $::moo = $::moo = 0;
36 eval q[my $foo = $::moo ? q/x/ : q/y/];
37 is(scalar @{ $record }, 2);
38 is($record->[0], 'x');
39 is($record->[1], 'y');