40 + 16 # Data::Dumper, Digest::MD5
+ 517 + 239 # B::Deparse, B
+ 595 + 190 # POSIX, IO::Socket
- + 3 * ($] > 5.009)
- + 16 * ($] >= 5.009003)
- - 22); # fudge
+ + 346 * ($] > 5.009)
+ + 17 * ($] >= 5.009003)
+ - 366); # fudge
require_ok("B::Concise");
formfeed end_av dowarn diehook defstash curstash
cstring comppadlist check_av cchar cast_I32 bootstrap
begin_av amagic_generation sub_generation address
- unitcheck_av
- )],
+ ), $] > 5.009 ? ('unitcheck_av') : ()],
},
B::Deparse => { dflt => 'perl', # 235 functions
register_domain recv protocol peername
new listen import getsockopt croak
connected connect configure confess close
- carp bind atmark accept blocking
- /],
+ carp bind atmark accept
+ /, $] > 5.009 ? ('blocking') : () ],
XS => [qw/ unpack_sockaddr_un unpack_sockaddr_in
sockatmark sockaddr_family pack_sockaddr_un
=cut
-checkOptree(note => q{},
- bcopts => q{-exec},
- code => q{use sort 'stable'; @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old; },
- expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
+my ($expect, $expect_nt) = (<<'EOT_EOT', <<'EONT_EONT');
# 1 <;> nextstate(main 656 (eval 40):1) v:%,{
# 2 <0> pushmark s
# 3 <0> pushmark s
# a <2> aassign[t6] KS/COMMON
# b <1> leavesub[1 ref] K/REFC,1
EONT_EONT
-
+
+if($] < 5.009) {
+ # 5.8.x doesn't show the /STABLE flag, so massage the golden results.
+ s!/STABLE!!s foreach ($expect, $expect_nt);
+}
+
+checkOptree(note => q{},
+ bcopts => q{-exec},
+ code => q{use sort 'stable'; @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old; },
+ expect => $expect, expect_nt => $expect_nt);
=for gentest
sub pi () { 3.14159 };
my $want = { # expected types, how value renders in-line, todos (maybe)
- myfl => [ 'NV', myfl ],
- myint => [ 'IV', myint ],
mystr => [ 'PV', '"'.mystr.'"' ],
myhref => [ 'RV', '\\\\HASH'],
- myundef => [ 'NULL', ],
pi => [ 'NV', pi ],
- myaref => [ 'RV', '\\\\' ],
myglob => [ 'RV', '\\\\' ],
- myrex => [ 'RV', '\\\\' ],
mysub => [ 'RV', '\\\\' ],
myunsub => [ 'RV', '\\\\' ],
# these are not inlined, at least not per BC::Concise
#myyes => [ 'RV', ],
#myno => [ 'RV', ],
+ $] > 5.009 ? (
+ myaref => [ 'RV', '\\\\' ],
+ myfl => [ 'NV', myfl ],
+ myint => [ 'IV', myint ],
+ myrex => [ 'RV', '\\\\' ],
+ myundef => [ 'NULL', ],
+ ) : (
+ myaref => [ 'PVIV', '' ],
+ myfl => [ 'PVNV', myfl ],
+ myint => [ 'PVIV', myint ],
+ myrex => [ 'PVNV', '' ],
+ myundef => [ 'PVIV', ],
+ )
};
use constant WEEKDAYS
checkOptree ( name => 'myyes() as coderef',
prog => 'sub a() { 1==1 }; print a',
noanchors => 1,
+ strip_open_hints => 1,
expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
# 6 <@> leave[1 ref] vKP/REFC ->(end)
# 1 <0> enter ->2
-# 2 <;> nextstate(main 2 -e:1) v:{ ->3
+# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
# 4 <$> const[SPECIAL sv_yes] s ->5
EOT_EOT
# 6 <@> leave[1 ref] vKP/REFC ->(end)
# 1 <0> enter ->2
-# 2 <;> nextstate(main 2 -e:1) v:{ ->3
+# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
# 4 <$> const(SPECIAL sv_yes) s ->5
checkOptree ( name => 'myno() as coderef',
prog => 'sub a() { 1!=1 }; print a',
noanchors => 1,
+ strip_open_hints => 1,
expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
# 6 <@> leave[1 ref] vKP/REFC ->(end)
# 1 <0> enter ->2
-# 2 <;> nextstate(main 2 -e:1) v:{ ->3
+# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
# 4 <$> const[SPECIAL sv_no] s ->5
EOT_EOT
# 6 <@> leave[1 ref] vKP/REFC ->(end)
# 1 <0> enter ->2
-# 2 <;> nextstate(main 2 -e:1) v:{ ->3
+# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
# 4 <$> const(SPECIAL sv_no) s ->5
EONT_EONT
-checkOptree ( name => 'constant sub returning list',
- code => \&WEEKDAYS,
- noanchors => 1,
- expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
+my ($expect, $expect_nt) = (<<'EOT_EOT', <<'EONT_EONT');
# 3 <1> leavesub[2 refs] K/REFC,1 ->(end)
# - <@> lineseq K ->3
# 1 <;> nextstate(constant 61 constant.pm:118) v:*,& ->2
# 2 <0> padav[@list:FAKE:m:71] ->3
EONT_EONT
+if($] < 5.009) {
+ # 5.8.x doesn't add the m flag to padav
+ s/FAKE:m:\d+/FAKE/ foreach ($expect, $expect_nt);
+}
+
+checkOptree ( name => 'constant sub returning list',
+ code => \&WEEKDAYS,
+ noanchors => 1,
+ expect => $expect, expect_nt => $expect_nt);
+
sub printem {
printf "myint %d mystr %s myfl %f pi %f\n"
, myint, mystr, myfl, pi;
}
-checkOptree ( name => 'call many in a print statement',
- code => \&printem,
- strip_open_hints => 1,
- expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
+my ($expect, $expect_nt) = (<<'EOT_EOT', <<'EONT_EONT');
# 9 <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->9
# 1 <;> nextstate(main 635 optree_constants.t:163) v:>,<,% ->2
# 7 <$> const(NV 3.14159) s ->8
EONT_EONT
+if($] < 5.009) {
+ # 5.8.x's use constant has larger types
+ foreach ($expect, $expect_nt) {
+ s/IV 42/PV$&/;
+ s/NV 1.41/PV$&/;
+ }
+}
+
+checkOptree ( name => 'call many in a print statement',
+ code => \&printem,
+ strip_open_hints => 1,
+ expect => $expect, expect_nt => $expect_nt);
} #skip