diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-04-05 11:50:10 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-04-05 11:50:10 +0000 |
commit | cc37eb0b599d134736fb6f123ae6520fdea588e3 (patch) | |
tree | 69d6ccdf9fdef698e12a89b337a79b5c7e8a47f7 /t/op/wantarray.t | |
parent | 34d103e3c1e665ce0d4b45c84d50a5c0f0500c78 (diff) | |
download | perl-cc37eb0b599d134736fb6f123ae6520fdea588e3.tar.gz |
[perl #28171] wantarray docs should mention effect of eval { wantarray }
as reported by Tim Bunce. Add a note to this effect in perlfunc,
and regression tests for it.
p4raw-id: //depot/perl@22651
Diffstat (limited to 't/op/wantarray.t')
-rwxr-xr-x | t/op/wantarray.t | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/t/op/wantarray.t b/t/op/wantarray.t index 28936f419c..350270d11c 100755 --- a/t/op/wantarray.t +++ b/t/op/wantarray.t @@ -1,6 +1,6 @@ #!./perl -print "1..9\n"; +print "1..12\n"; sub context { my ( $cona, $testnum ) = @_; my $conb = (defined wantarray) ? ( wantarray ? 'A' : 'S' ) : 'V'; @@ -31,4 +31,14 @@ $a = scalar context('S',5); print +($c == 2) ? "ok 9\n" : "not ok 9\t# <$c>\n"; } +my $qcontext = q{ + $q = (defined wantarray) ? ( wantarray ? 'A' : 'S' ) : 'V'; +}; +eval $qcontext; +print $q eq 'V' ? "ok 10\n" : "not ok 10\n"; +$a = eval $qcontext; +print $q eq 'S' ? "ok 11\n" : "not ok 11\n"; +@a = eval $qcontext; +print $q eq 'A' ? "ok 12\n" : "not ok 12\n"; + 1; |