Upgrade to CPAN 1.87_63
[p5sagit/p5-mst-13.2.git] / ext / B / t / optree_misc.t
1 #!perl
2
3 BEGIN {
4     if ($ENV{PERL_CORE}){
5         chdir('t') if -d 't';
6         @INC = ('.', '../lib', '../ext/B/t');
7     } else {
8         unshift @INC, 't';
9         push @INC, "../../t";
10     }
11     require Config;
12     if (($Config::Config{'extensions'} !~ /\bB\b/) ){
13         print "1..0 # Skip -- Perl configured without B module\n";
14         exit 0;
15     }
16 }
17 use OptreeCheck;
18 use Config;
19 plan tests => 1;
20
21 SKIP: {
22 skip "no perlio in this build", 1 unless $Config::Config{useperlio};
23
24 my @open_todo;
25 sub open_todo {
26     if (((caller 0)[10]||{})->{open}) {
27         @open_todo = (skip => "\$^OPEN is set");
28     }
29 }
30 open_todo;
31
32 # The regression this is testing is that the first aelemfast, derived
33 # from a lexical array, is supposed to be a BASEOP "<0>", while the
34 # second, from a global, is an SVOP "<$>" or a PADOP "<#>" depending
35 # on threading. In buggy versions, both showed up as SVOPs/PADOPs. See
36 # B.xs:cc_opclass() for the relevant code.
37
38 checkOptree ( name      => 'OP_AELEMFAST opclass',
39               code      => sub { my @x; our @y; $x[0] + $y[0]},
40               @open_todo,
41               expect    => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
42 # a  <1> leavesub[1 ref] K/REFC,1 ->(end)
43 # -     <@> lineseq KP ->a
44 # 1        <;> nextstate(main 634 optree_misc.t:25) v ->2
45 # 2        <0> padav[@x:634,636] vM/LVINTRO ->3
46 # 3        <;> nextstate(main 635 optree_misc.t:25) v ->4
47 # 5        <1> rv2av[t4] vK/OURINTR,1 ->6
48 # 4           <#> gv[*y] s ->5
49 # 6        <;> nextstate(main 636 optree_misc.t:25) v:{ ->7
50 # 9        <2> add[t6] sK/2 ->a
51 # -           <1> ex-aelem sK/2 ->8
52 # 7              <0> aelemfast[@x:634,636] sR* ->8
53 # -              <0> ex-const s ->-
54 # -           <1> ex-aelem sK/2 ->9
55 # -              <1> ex-rv2av sKR/1 ->-
56 # 8                 <#> aelemfast[*y] s ->9
57 # -              <0> ex-const s ->-
58 EOT_EOT
59 # a  <1> leavesub[1 ref] K/REFC,1 ->(end)
60 # -     <@> lineseq KP ->a
61 # 1        <;> nextstate(main 634 optree_misc.t:27) v ->2
62 # 2        <0> padav[@x:634,636] vM/LVINTRO ->3
63 # 3        <;> nextstate(main 635 optree_misc.t:27) v ->4
64 # 5        <1> rv2av[t3] vK/OURINTR,1 ->6
65 # 4           <$> gv(*y) s ->5
66 # 6        <;> nextstate(main 636 optree_misc.t:27) v:{ ->7
67 # 9        <2> add[t4] sK/2 ->a
68 # -           <1> ex-aelem sK/2 ->8
69 # 7              <0> aelemfast[@x:634,636] sR* ->8
70 # -              <0> ex-const s ->-
71 # -           <1> ex-aelem sK/2 ->9
72 # -              <1> ex-rv2av sKR/1 ->-
73 # 8                 <$> aelemfast(*y) s ->9
74 # -              <0> ex-const s ->-
75 EONT_EONT
76
77
78 } #skip
79
80 __END__
81