Permalink
Browse files

Test for void context to be propagated into the block

  • Loading branch information...
1 parent b4b8010 commit e713b500a70e48a75d0e22de8a44698eedf7173f @rafl committed Feb 18, 2012
Showing with 27 additions and 0 deletions.
  1. +27 −0 t/context.t
View
@@ -0,0 +1,27 @@
+use strict;
+use warnings;
+use Test::More 0.89;
+use Test::Fatal;
+
+use List::Gather;
+
+sub assert_void_context {
+ die 'not in void context'
+ if defined wantarray;
+}
+
+is exception {
+ my @x = gather { assert_void_context };
+}, undef;
+
+is exception {
+ my $x = gather { assert_void_context };
+}, undef;
+
+is exception {
+ no warnings 'void';
+ gather { assert_void_context };
+ 42;
+}, undef;
+
+done_testing;

0 comments on commit e713b50

Please sign in to comment.