X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F50-unwind-target.t;h=d5dcd96b5b3f25eb22e88e24af0c911846ff4b57;hb=e7846e7f6fded4c4a3139054c5206c1480711867;hp=430424091d7505145fb518c829d226b8c701300a;hpb=0a6221d3f467b5f819e3c119b4cda0218399cb51;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/50-unwind-target.t b/t/50-unwind-target.t index 4304240..d5dcd96 100644 --- a/t/50-unwind-target.t +++ b/t/50-unwind-target.t @@ -3,9 +3,9 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 6; -use Scope::Upper qw/unwind/; +use Scope::Upper qw; my @res; @@ -13,17 +13,19 @@ 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 { unwind 0; 8; }); -like $@, qr/^Can't\s+return\s+outside\s+a\s+subroutine/, 'unwind(100) croaks'; -is_deeply \@res, [ 7 ], 'unwind(100)'; +like $@, qr/^Can't\s+return\s+outside\s+a\s+subroutine/, 'unwind(0) croaks'; +is_deeply \@res, [ 7 ], 'unwind(0)';