summaryrefslogtreecommitdiff
path: root/t/op/blocks.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-01-22 15:59:16 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-01-22 15:59:16 -0800
commit9a8aa25b28a859846cf1458bfe11f17ad258e982 (patch)
treebd95f66dc420eea58847a0f6845752ecca72c1c7 /t/op/blocks.t
parent3840c57b8cefe640d72c4ad40d0b13c41cf80f6d (diff)
downloadperl-9a8aa25b28a859846cf1458bfe11f17ad258e982.tar.gz
[perl #108794] Call special blocks in void context
Now BEGIN blocks, etc., are called in void context, so the result of evaluating the last statement is not wastefully copied.
Diffstat (limited to 't/op/blocks.t')
-rw-r--r--t/op/blocks.t20
1 files changed, 19 insertions, 1 deletions
diff --git a/t/op/blocks.t b/t/op/blocks.t
index 8460371fd8..e6c53d7bb9 100644
--- a/t/op/blocks.t
+++ b/t/op/blocks.t
@@ -6,7 +6,7 @@ BEGIN {
require './test.pl';
}
-plan tests => 5;
+plan tests => 6;
my @expect = qw(
b1
@@ -113,3 +113,21 @@ SCRIPT70614
# [perl #78634] Make sure block names can be used as constants.
use constant INIT => 5;
::is INIT, 5, 'constant named after a special block';
+
+# [perl #108794] context
+fresh_perl_is(<<'SCRIPT3', <<expEct,{stderr => 1 },'context');
+sub context {
+ print qw[void scalar list][wantarray + defined wantarray], "\n"
+}
+BEGIN {context}
+UNITCHECK {context}
+CHECK {context}
+INIT {context}
+END {context}
+SCRIPT3
+void
+void
+void
+void
+void
+expEct