X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=ext%2FB%2Ft%2Foptree_specials.t;h=5db9d020781f5f0b4815a11275fab4ad26bcce1e;hb=ce5d06123ae0253bf2e33033ffbfba16ce3bb79e;hp=2bead37d1bdc8f729cbbce4ccb58f95810431f31;hpb=b8443148095870afff102e04226f4cf527a66f93;p=p5sagit%2Fp5-mst-13.2.git diff --git a/ext/B/t/optree_specials.t b/ext/B/t/optree_specials.t index 2bead37..5db9d02 100644 --- a/ext/B/t/optree_specials.t +++ b/ext/B/t/optree_specials.t @@ -27,7 +27,7 @@ BEGIN { use OptreeCheck; # ALSO DOES @ARGV HANDLING !!!!!! use Config; -plan tests => 6; +plan tests => 8; require_ok("B::Concise"); @@ -38,7 +38,7 @@ my $out = runperl( #print "out:$out\n"; -my $src = q[our ($beg, $chk, $init, $end) = qq{'foo'}; BEGIN { $beg++ } CHECK { $chk++ } INIT { $init++ } END { $end++ }]; +my $src = q[our ($beg, $chk, $init, $end, $uc) = qq{'foo'}; BEGIN { $beg++ } CHECK { $chk++ } INIT { $init++ } END { $end++ } UNITCHECK {$uc++}]; my @warnings_todo; @@ -47,30 +47,30 @@ my @warnings_todo; . "propagated to 5.8.x") if $] < 5.009; - checkOptree ( name => 'BEGIN', bcopts => 'BEGIN', prog => $src, @warnings_todo, + @open_todo, expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); # BEGIN 1: # b <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->b -# 1 <;> nextstate(B::Concise -234 Concise.pm:328) v/2 ->2 +# 1 <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$ ->2 # 3 <1> require sK/1 ->4 # 2 <$> const[PV "warnings.pm"] s/BARE ->3 -# 4 <;> nextstate(B::Concise -234 Concise.pm:328) v/2 ->5 +# 4 <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$ ->5 # - <@> lineseq K ->- -# 5 <;> nextstate(B::Concise -234 Concise.pm:328) /2 ->6 +# 5 <;> nextstate(B::Concise -234 Concise.pm:328) :*,&,{,$ ->6 # a <1> entersub[t1] KS*/TARG,2 ->b # 6 <0> pushmark s ->7 # 7 <$> const[PV "warnings"] sM ->8 # 8 <$> const[PV "qw"] sM ->9 -# 9 <$> method_named[PVIV 1520340202] ->a +# 9 <$> method_named[PV "import"] ->a # BEGIN 2: # f <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->f -# c <;> nextstate(main 2 -e:1) v ->d +# c <;> nextstate(main 2 -e:1) v:{ ->d # e <1> postinc[t3] sK/1 ->f # - <1> ex-rv2sv sKRM/1 ->e # d <#> gvsv[*beg] s ->e @@ -78,21 +78,21 @@ EOT_EOT # BEGIN 1: # b <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->b -# 1 <;> nextstate(B::Concise -234 Concise.pm:328) v/2 ->2 +# 1 <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$ ->2 # 3 <1> require sK/1 ->4 # 2 <$> const(PV "warnings.pm") s/BARE ->3 -# 4 <;> nextstate(B::Concise -234 Concise.pm:328) v/2 ->5 +# 4 <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$ ->5 # - <@> lineseq K ->- -# 5 <;> nextstate(B::Concise -234 Concise.pm:328) /2 ->6 +# 5 <;> nextstate(B::Concise -234 Concise.pm:328) :*,&,{,$ ->6 # a <1> entersub[t1] KS*/TARG,2 ->b # 6 <0> pushmark s ->7 # 7 <$> const(PV "warnings") sM ->8 # 8 <$> const(PV "qw") sM ->9 -# 9 <$> method_named(PVIV 1520340202) ->a +# 9 <$> method_named(PV "import") ->a # BEGIN 2: # f <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->f -# c <;> nextstate(main 2 -e:1) v ->d +# c <;> nextstate(main 2 -e:1) v:{ ->d # e <1> postinc[t2] sK/1 ->f # - <1> ex-rv2sv sKRM/1 ->e # d <$> gvsv(*beg) s ->e @@ -102,11 +102,12 @@ EONT_EONT checkOptree ( name => 'END', bcopts => 'END', prog => $src, + @open_todo, expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); # END 1: # 4 <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->4 -# 1 <;> nextstate(main 5 -e:6) v ->2 +# 1 <;> nextstate(main 5 -e:6) v:{ ->2 # 3 <1> postinc[t3] sK/1 ->4 # - <1> ex-rv2sv sKRM/1 ->3 # 2 <#> gvsv[*end] s ->3 @@ -114,7 +115,7 @@ EOT_EOT # END 1: # 4 <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->4 -# 1 <;> nextstate(main 5 -e:6) v ->2 +# 1 <;> nextstate(main 5 -e:6) v:{ ->2 # 3 <1> postinc[t2] sK/1 ->4 # - <1> ex-rv2sv sKRM/1 ->3 # 2 <$> gvsv(*end) s ->3 @@ -124,11 +125,12 @@ EONT_EONT checkOptree ( name => 'CHECK', bcopts => 'CHECK', prog => $src, + @open_todo, expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); # CHECK 1: # 4 <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->4 -# 1 <;> nextstate(main 3 -e:4) v ->2 +# 1 <;> nextstate(main 3 -e:4) v:{ ->2 # 3 <1> postinc[t3] sK/1 ->4 # - <1> ex-rv2sv sKRM/1 ->3 # 2 <#> gvsv[*chk] s ->3 @@ -136,22 +138,45 @@ EOT_EOT # CHECK 1: # 4 <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->4 -# 1 <;> nextstate(main 3 -e:4) v ->2 +# 1 <;> nextstate(main 3 -e:4) v:{ ->2 # 3 <1> postinc[t2] sK/1 ->4 # - <1> ex-rv2sv sKRM/1 ->3 # 2 <$> gvsv(*chk) s ->3 EONT_EONT +checkOptree ( name => 'UNITCHECK', + bcopts => 'UNITCHECK', + prog => $src, + @open_todo, + expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); +# UNITCHECK 1: +# 4 <1> leavesub[1 ref] K/REFC,1 ->(end) +# - <@> lineseq KP ->4 +# 1 <;> nextstate(main 3 -e:4) v:{ ->2 +# 3 <1> postinc[t3] sK/1 ->4 +# - <1> ex-rv2sv sKRM/1 ->3 +# 2 <#> gvsv[*uc] s ->3 +EOT_EOT +# UNITCHECK 1: +# 4 <1> leavesub[1 ref] K/REFC,1 ->(end) +# - <@> lineseq KP ->4 +# 1 <;> nextstate(main 3 -e:4) v:{ ->2 +# 3 <1> postinc[t2] sK/1 ->4 +# - <1> ex-rv2sv sKRM/1 ->3 +# 2 <$> gvsv(*uc) s ->3 +EONT_EONT + checkOptree ( name => 'INIT', bcopts => 'INIT', #todo => 'get working', prog => $src, + @open_todo, expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); # INIT 1: # 4 <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->4 -# 1 <;> nextstate(main 4 -e:5) v ->2 +# 1 <;> nextstate(main 4 -e:5) v:{ ->2 # 3 <1> postinc[t3] sK/1 ->4 # - <1> ex-rv2sv sKRM/1 ->3 # 2 <#> gvsv[*init] s ->3 @@ -159,81 +184,129 @@ EOT_EOT # INIT 1: # 4 <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->4 -# 1 <;> nextstate(main 4 -e:5) v ->2 +# 1 <;> nextstate(main 4 -e:5) v:{ ->2 # 3 <1> postinc[t2] sK/1 ->4 # - <1> ex-rv2sv sKRM/1 ->3 # 2 <$> gvsv(*init) s ->3 EONT_EONT -checkOptree ( name => 'all of BEGIN END INIT CHECK -exec', - bcopts => [qw/ BEGIN END INIT CHECK -exec /], +checkOptree ( name => 'all of BEGIN END INIT CHECK UNITCHECK -exec', + bcopts => [qw/ BEGIN END INIT CHECK UNITCHECK -exec /], prog => $src, @warnings_todo, + @open_todo, expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); # BEGIN 1: -# 1 <;> nextstate(B::Concise -234 Concise.pm:328) v/2 +# 1 <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$ # 2 <$> const[PV "warnings.pm"] s/BARE # 3 <1> require sK/1 -# 4 <;> nextstate(B::Concise -234 Concise.pm:328) v/2 -# 5 <;> nextstate(B::Concise -234 Concise.pm:328) /2 +# 4 <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$ +# 5 <;> nextstate(B::Concise -234 Concise.pm:328) :*,&,{,$ # 6 <0> pushmark s # 7 <$> const[PV "warnings"] sM # 8 <$> const[PV "qw"] sM -# 9 <$> method_named[PVIV 1520340202] +# 9 <$> method_named[PV "unimport"] # a <1> entersub[t1] KS*/TARG,2 # b <1> leavesub[1 ref] K/REFC,1 # BEGIN 2: -# c <;> nextstate(main 2 -e:1) v +# c <;> nextstate(main 2 -e:1) v:{ # d <#> gvsv[*beg] s # e <1> postinc[t3] sK/1 # f <1> leavesub[1 ref] K/REFC,1 # END 1: -# g <;> nextstate(main 5 -e:1) v +# g <;> nextstate(main 5 -e:1) v:{ # h <#> gvsv[*end] s # i <1> postinc[t3] sK/1 # j <1> leavesub[1 ref] K/REFC,1 # INIT 1: -# k <;> nextstate(main 4 -e:1) v +# k <;> nextstate(main 4 -e:1) v:{ # l <#> gvsv[*init] s # m <1> postinc[t3] sK/1 # n <1> leavesub[1 ref] K/REFC,1 # CHECK 1: -# o <;> nextstate(main 3 -e:1) v +# o <;> nextstate(main 3 -e:1) v:{ # p <#> gvsv[*chk] s # q <1> postinc[t3] sK/1 # r <1> leavesub[1 ref] K/REFC,1 +# UNITCHECK 1: +# s <;> nextstate(main 6 -e:1) v:{ +# t <#> gvsv[*uc] s +# u <1> postinc[t3] sK/1 +# v <1> leavesub[1 ref] K/REFC,1 EOT_EOT # BEGIN 1: -# 1 <;> nextstate(B::Concise -234 Concise.pm:328) v/2 +# 1 <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$ # 2 <$> const(PV "warnings.pm") s/BARE # 3 <1> require sK/1 -# 4 <;> nextstate(B::Concise -234 Concise.pm:328) v/2 -# 5 <;> nextstate(B::Concise -234 Concise.pm:328) /2 +# 4 <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$ +# 5 <;> nextstate(B::Concise -234 Concise.pm:328) :*,&,{,$ # 6 <0> pushmark s # 7 <$> const(PV "warnings") sM # 8 <$> const(PV "qw") sM -# 9 <$> method_named(PVIV 1520340202) +# 9 <$> method_named(PV "unimport") # a <1> entersub[t1] KS*/TARG,2 # b <1> leavesub[1 ref] K/REFC,1 # BEGIN 2: -# c <;> nextstate(main 2 -e:1) v +# c <;> nextstate(main 2 -e:1) v:{ # d <$> gvsv(*beg) s # e <1> postinc[t2] sK/1 # f <1> leavesub[1 ref] K/REFC,1 # END 1: -# g <;> nextstate(main 5 -e:1) v +# g <;> nextstate(main 5 -e:1) v:{ # h <$> gvsv(*end) s # i <1> postinc[t2] sK/1 # j <1> leavesub[1 ref] K/REFC,1 # INIT 1: -# k <;> nextstate(main 4 -e:1) v +# k <;> nextstate(main 4 -e:1) v:{ # l <$> gvsv(*init) s # m <1> postinc[t2] sK/1 # n <1> leavesub[1 ref] K/REFC,1 # CHECK 1: -# o <;> nextstate(main 3 -e:1) v +# o <;> nextstate(main 3 -e:1) v:{ # p <$> gvsv(*chk) s # q <1> postinc[t2] sK/1 # r <1> leavesub[1 ref] K/REFC,1 +# UNITCHECK 1: +# s <;> nextstate(main 6 -e:1) v:{ +# t <$> gvsv(*uc) s +# u <1> postinc[t2] sK/1 +# v <1> leavesub[1 ref] K/REFC,1 +EONT_EONT + + +# perl "-I../lib" -MO=Concise,BEGIN,CHECK,INIT,END,-exec -e '$a=$b && print q/foo/' + + + +checkOptree ( name => 'regression test for patch 25352', + bcopts => [qw/ BEGIN END INIT CHECK -exec /], + prog => 'print q/foo/', + @warnings_todo, + expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT'); +# BEGIN 1: +# 1 <;> nextstate(B::Concise -234 Concise.pm:359) v:*,&,{,$ +# 2 <$> const[PV "warnings.pm"] s/BARE +# 3 <1> require sK/1 +# 4 <;> nextstate(B::Concise -234 Concise.pm:359) v:*,&,{,$ +# 5 <;> nextstate(B::Concise -234 Concise.pm:359) :*,&,{,$ +# 6 <0> pushmark s +# 7 <$> const[PV "warnings"] sM +# 8 <$> const[PV "qw"] sM +# 9 <$> method_named[PV "unimport"] +# a <1> entersub[t1] KS*/TARG,2 +# b <1> leavesub[1 ref] K/REFC,1 +EOT_EOT +# BEGIN 1: +# 1 <;> nextstate(B::Concise -234 Concise.pm:359) v:*,&,{,$ +# 2 <$> const(PV "warnings.pm") s/BARE +# 3 <1> require sK/1 +# 4 <;> nextstate(B::Concise -234 Concise.pm:359) v:*,&,{,$ +# 5 <;> nextstate(B::Concise -234 Concise.pm:359) :*,&,{,$ +# 6 <0> pushmark s +# 7 <$> const(PV "warnings") sM +# 8 <$> const(PV "qw") sM +# 9 <$> method_named(PV "unimport") +# a <1> entersub[t1] KS*/TARG,2 +# b <1> leavesub[1 ref] K/REFC,1 EONT_EONT