@@ -13,7 +13,7 @@ use warnings;
1313use strict;
1414use Config;
1515# plan tests => 134;
16- plan tests => 123 ;
16+ plan tests => 113 ;
1717our $TODO ;
1818
1919my $deprecated = 0;
@@ -540,73 +540,7 @@ a32039();
540540 is($r , " ok\n " , ' redo and goto' );
541541}
542542
543- # goto &foo not allowed in evals
544-
545- sub null { 1 };
546- eval ' goto &null' ;
547- like($@ , qr / Can't goto subroutine from an eval-string/ , ' eval string' );
548- eval { goto &null };
549- like($@ , qr / Can't goto subroutine from an eval-block/ , ' eval block' );
550-
551- # goto &foo leaves @_ alone when called from a sub
552- sub returnarg { $_ [0] };
553- is sub {
554- local *_ = [" ick and queasy" ];
555- goto &returnarg;
556- }-> (" quick and easy" ), " ick and queasy" ,
557- ' goto &foo with *_{ARRAY} replaced' ;
558- my @__ = byte_utf8a_to_utf8n(" \xc4\x80 " );
559- sub { local *_ = \@__; goto &utf8::decode }-> (" no thinking aloud" );
560- is " @__" , chr 256, ' goto &xsub with replaced *_{ARRAY}' ;
561-
562- # And goto &foo should leave reified @_ alone
563- sub { *__ = \@_ ; goto &null } -> (" rough and tubbery" );
564- is ${*__}[0], ' rough and tubbery' , ' goto &foo leaves reified @_ alone' ;
565-
566- # goto &xsub when @_ has nonexistent elements
567- {
568- no warnings " uninitialized" ;
569- local @_ = ();
570- $#_ ++;
571- & {sub { goto &utf8::encode }};
572- is @_ , 1, ' num of elems in @_ after goto &xsub with nonexistent $_[0]' ;
573- is $_ [0], " " , ' content of nonexistent $_[0] is modified by goto &xsub' ;
574- }
575-
576- # goto &xsub when @_ itself does not exist
577- undef *_;
578- eval { & { sub { goto &utf8::encode } } };
579- # The main thing we are testing is that it did not crash. But make sure
580- # *_{ARRAY} was untouched, too.
581- is *_{ARRAY }, undef , ' goto &xsub when @_ does not exist' ;
582-
583- # goto &perlsub when @_ itself does not exist [perl #119949]
584- # This was only crashing when the replaced sub call had an argument list.
585- # (I.e., &{ sub { goto ... } } did not crash.)
586- sub {
587- undef *_;
588- goto sub {
589- is *_{ARRAY }, undef , ' goto &perlsub when @_ does not exist' ;
590- }
591- }-> ();
592- sub {
593- local *_;
594- goto sub {
595- is *_{ARRAY }, undef , ' goto &sub when @_ does not exist (local *_)' ;
596- }
597- }-> ();
598-
599-
600- # # [perl #36521] goto &foo in warn handler could defeat recursion avoider
601- #
602- # {
603- # my $r = runperl(
604- # stderr => 1,
605- # prog => 'my $d; my $w = sub { return if $d++; warn q(bar)}; local $SIG{__WARN__} = sub { goto &$w; }; warn q(foo);'
606- # );
607- # like($r, qr/bar/, "goto &foo in warn");
608- # }
609- #
543+
610544TODO: {
611545 local $TODO = " [perl #43403] goto() from an if to an else doesn't undo local () changes" ;
612546 our $global = " unmodified" ;
0 commit comments