From: Vincent Pit Date: Fri, 7 Sep 2012 22:54:14 +0000 (+0200) Subject: Check that unwind(-1) dies and that unwind() doesn't X-Git-Tag: v0.20~27 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FScope-Upper.git;a=commitdiff_plain;h=a6226a61e22b1f2aad5df72aeb02ce755e2c192e Check that unwind(-1) dies and that unwind() doesn't --- diff --git a/t/50-unwind-target.t b/t/50-unwind-target.t index 9ef70ec..d5dcd96 100644 --- a/t/50-unwind-target.t +++ b/t/50-unwind-target.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 6; use Scope::Upper qw; @@ -13,12 +13,14 @@ my @res; unwind; 8; }); +is $@, '', 'unwind() does not croak'; is_deeply \@res, [ 7 ], 'unwind()'; @res = (7, eval { unwind -1; 8; }); +like $@, qr/^Can't\s+return\s+outside\s+a\s+subroutine/, 'unwind(-1) croaks'; is_deeply \@res, [ 7 ], 'unwind(-1)'; @res = (7, eval {