From: Father Chrysostomos Date: Tue, 31 May 2011 02:00:51 +0000 (-0700) Subject: [perl #72706] Test recursive substr lvalue X-Git-Tag: accepted/trunk/20130322.191538~3998 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f6a9f8a45e0553298d2b10c734f5826f1ba7730f;p=platform%2Fupstream%2Fperl.git [perl #72706] Test recursive substr lvalue --- diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t index 28d6763..c87b484 100644 --- a/t/op/sub_lval.t +++ b/t/op/sub_lval.t @@ -3,7 +3,7 @@ BEGIN { @INC = '../lib'; require './test.pl'; } -plan tests=>91; +plan tests=>97; sub a : lvalue { my $a = 34; ${\(bless \$a)} } # Return a temporary sub b : lvalue { ${\shift} } @@ -582,6 +582,24 @@ is ($Tie_Array::val[0], "value"); }; &$r(0) = 7; is $to_modify, 7, 'recursive lvalue sub'; + + # Recursive with substr [perl #72706] + my $val = ''; + my $pie; + $pie = sub :lvalue { + my $depth = shift; + return &$pie($depth) if $depth--; + substr $val, 0; + }; + for my $depth (0, 1, 2) { + my $value = "Good $depth"; + eval { + &$pie($depth) = $value; + }; + is($@, '', "recursive lvalue substr return depth $depth"); + is($val, $value, + "value assigned to recursive lvalue substr (depth $depth)"); + } } { # bug #23790