From 730fb7e791962b4f698b07b82ae1213ced61a5e1 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Wed, 22 Jun 2011 23:04:02 -0700 Subject: [PATCH] Fix up some tests in sub_lval.t One test was disabled long ago Returning undef in list context was allowed by change 10777 (f206cdd) in 2001. There was already a test for disallowing it. That test was disabled by change 10779 (4c8a4e58), rather than correct to test the new behaviour. This commit changes it to test that undef return is allowed in list context, also adding a test for explicit return. --- t/op/sub_lval.t | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t index a4d518f..06ac461 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=>165; +plan tests=>167; sub a : lvalue { my $a = 34; ${\(bless \$a)} } # Return a temporary sub b : lvalue { ${\shift} } @@ -278,10 +278,15 @@ eval <<'EOE' or $_ = $@; 1; EOE -# Fixed by change @10777 -#print "# '$_'.\nnot " -# unless /Can\'t return an uninitialized value from lvalue subroutine/; -# print "ok 34 # Skip: removed test\n"; +ok(!defined, 'implicitly returning undef in list context'); + +$_ = undef; +eval <<'EOE' or $_ = $@; + (rlv1u) = (2,3); + 1; +EOE + +ok(!defined, 'explicitly returning undef in list context'); $x = '1234567'; -- 2.7.4