X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F56-unwind-context.t;h=2779c9d50d2a4c69f066e06a8f52422eeb85473e;hb=b143b5ed4d9b116054d12ea0696167b6a199b500;hp=29733645b8ed552982237e1cc4b0b615362bcfd7;hpb=1c85fcc6c9aa086139a97dc87ca1cab68f4120c3;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/56-unwind-context.t b/t/56-unwind-context.t index 2973364..2779c9d 100644 --- a/t/56-unwind-context.t +++ b/t/56-unwind-context.t @@ -5,7 +5,7 @@ use warnings; use Test::More tests => 33; -use Scope::Upper qw/unwind SUB/; +use Scope::Upper qw; my ($res, @res); @@ -13,7 +13,7 @@ my ($res, @res); sub { $res = 1; - unwind(qw/a b c/ => SUB); + unwind(qw => SUB); $res = 0; }->(0); ok $res, 'unwind in void context at sub to void'; @@ -21,7 +21,7 @@ ok $res, 'unwind in void context at sub to void'; sub { $res = 1; eval { - unwind(qw/d e f/ => SUB); + unwind(qw => SUB); }; $res = 0; }->(0); @@ -30,7 +30,7 @@ ok $res, 'unwind in void context at sub across eval to void'; sub { $res = 1; for (1 .. 5) { - unwind qw/g h i/ => SUB; + unwind qw => SUB; } $res = 0; }->(0); @@ -39,14 +39,14 @@ ok $res, 'unwind in void context at sub across loop to void'; # --- Void to scalar ---------------------------------------------------------- $res = sub { - unwind(qw/a b c/ => SUB); + unwind(qw => SUB); return 'XXX'; }->(0); is $res, 'c', 'unwind in void context at sub to scalar'; $res = sub { eval { - unwind qw/d e f/ => SUB; + unwind qw => SUB; }; return 'XXX'; }->(0); @@ -54,13 +54,13 @@ is $res, 'f', 'unwind in void context at sub across eval to scalar'; $res = sub { for (1 .. 5) { - unwind qw/g h i/ => SUB; + unwind qw => SUB; } }->(0); is $res, 'i', 'unwind in void context at sub across loop to scalar'; $res = sub { - for (6, unwind qw/j k l/ => SUB) { + for (6, unwind qw => SUB) { $res = 'NO'; } return 'XXX'; @@ -70,31 +70,31 @@ is $res, 'l', 'unwind in void context at sub across loop iterator to scalar'; # --- Void to list ------------------------------------------------------------ @res = sub { - unwind qw/a b c/ => SUB; + unwind qw => SUB; return 'XXX'; }->(0); -is_deeply \@res, [ qw/a b c/ ], 'unwind in void context at sub to list'; +is_deeply \@res, [ qw ], 'unwind in void context at sub to list'; @res = sub { eval { - unwind qw/d e f/ => SUB; + unwind qw => SUB; }; return 'XXX'; }->(0); -is_deeply \@res, [ qw/d e f/ ], 'unwind in void context at sub across eval to list'; +is_deeply \@res, [ qw ], 'unwind in void context at sub across eval to list'; @res = sub { for (1 .. 5) { - unwind qw/g h i/ => SUB; + unwind qw => SUB; } }->(0); -is_deeply \@res, [ qw/g h i/ ], 'unwind in void context at sub across loop to list'; +is_deeply \@res, [ qw ], 'unwind in void context at sub across loop to list'; # --- Scalar to void ---------------------------------------------------------- sub { $res = 1; - my $temp = unwind(qw/a b c/ => SUB); + my $temp = unwind(qw => SUB); $res = 0; }->(0); ok $res, 'unwind in scalar context at sub to void'; @@ -102,7 +102,7 @@ ok $res, 'unwind in scalar context at sub to void'; sub { $res = 1; my $temp = eval { - unwind(qw/d e f/ => SUB); + unwind(qw => SUB); }; $res = 0; }->(0); @@ -111,7 +111,7 @@ ok $res, 'unwind in scalar context at sub across eval to void'; sub { $res = 1; for (1 .. 5) { - my $temp = (unwind qw/g h i/ => SUB); + my $temp = (unwind qw => SUB); } $res = 0; }->(0); @@ -119,7 +119,7 @@ ok $res, 'unwind in scalar context at sub across loop to void'; sub { $res = 1; - if (unwind qw/m n o/ => SUB) { + if (unwind qw => SUB) { $res = undef; } $res = 0; @@ -129,19 +129,19 @@ ok $res, 'unwind in scalar context at sub across test to void'; # --- Scalar to scalar -------------------------------------------------------- $res = sub { - 1, unwind(qw/a b c/ => SUB); + 1, unwind(qw => SUB); }->(0); is $res, 'c', 'unwind in scalar context at sub to scalar'; $res = sub { eval { - 8, unwind qw/d e f/ => SUB; + 8, unwind qw => SUB; }; }->(0); is $res, 'f', 'unwind in scalar context at sub across eval to scalar'; $res = sub { - if (unwind qw/m n o/ => SUB) { + if (unwind qw => SUB) { return 'XXX'; } }->(0); @@ -150,17 +150,17 @@ is $res, 'o', 'unwind in scalar context at sub across test to scalar'; # --- Scalar to list ---------------------------------------------------------- @res = sub { - if (unwind qw/m n o/ => SUB) { + if (unwind qw => SUB) { return 'XXX'; } }->(0); -is_deeply \@res, [ qw/m n o/ ], 'unwind in scalar context at sub across test to list'; +is_deeply \@res, [ qw ], 'unwind in scalar context at sub across test to list'; # --- List to void ------------------------------------------------------------ sub { $res = 1; - my @temp = unwind(qw/a b c/ => SUB); + my @temp = unwind(qw => SUB); $res = 0; }->(0); ok $res, 'unwind in list context at sub to void'; @@ -168,7 +168,7 @@ ok $res, 'unwind in list context at sub to void'; sub { $res = 1; my @temp = eval { - unwind(qw/d e f/ => SUB); + unwind(qw => SUB); }; $res = 0; }->(0); @@ -177,7 +177,7 @@ ok $res, 'unwind in list context at sub across eval to void'; sub { $res = 1; for (1 .. 5) { - my @temp = (unwind qw/g h i/ => SUB); + my @temp = (unwind qw => SUB); } $res = 0; }->(0); @@ -185,7 +185,7 @@ ok $res, 'unwind in list context at sub across loop to void'; sub { $res = 1; - for (6, unwind qw/j k l/ => SUB) { + for (6, unwind qw => SUB) { $res = undef; } $res = 0; @@ -195,14 +195,14 @@ ok $res, 'unwind in list context at sub across test to void'; # --- List to scalar ---------------------------------------------------------- $res = sub { - my @temp = (1, unwind(qw/a b c/ => SUB)); + my @temp = (1, unwind(qw => SUB)); return 'XXX'; }->(0); is $res, 'c', 'unwind in list context at sub to scalar'; $res = sub { my @temp = eval { - 8, unwind qw/d e f/ => SUB; + 8, unwind qw => SUB; }; return 'XXX'; }->(0); @@ -210,14 +210,14 @@ is $res, 'f', 'unwind in list context at sub across eval to scalar'; $res = sub { for (1 .. 5) { - my @temp = (7, unwind qw/g h i/ => SUB); + my @temp = (7, unwind qw => SUB); } return 'XXX'; }->(0); is $res, 'i', 'unwind in list context at sub across loop to scalar'; $res = sub { - for (6, unwind qw/j k l/ => SUB) { + for (6, unwind qw => SUB) { return 'XXX'; } }->(0); @@ -226,27 +226,27 @@ is $res, 'l', 'unwind in list context at sub across loop iterator to scalar'; # --- List to list ------------------------------------------------------------ @res = sub { - 2, unwind qw/a b c/ => SUB; + 2, unwind qw => SUB; }->(0); -is_deeply \@res, [ qw/a b c/ ], 'unwind in list context at sub to list'; +is_deeply \@res, [ qw ], 'unwind in list context at sub to list'; @res = sub { eval { - 8, unwind qw/d e f/ => SUB; + 8, unwind qw => SUB; }; }->(0); -is_deeply \@res, [ qw/d e f/ ], 'unwind in list context at sub across eval to list'; +is_deeply \@res, [ qw ], 'unwind in list context at sub across eval to list'; @res = sub { - for (6, unwind qw/j k l/ => SUB) { + for (6, unwind qw => SUB) { return 'XXX'; } }->(0); -is_deeply \@res, [ qw/j k l/ ], 'unwind in list context at sub across loop iterator to list'; +is_deeply \@res, [ qw ], 'unwind in list context at sub across loop iterator to list'; # --- Prototypes -------------------------------------------------------------- -sub pie { 7, unwind qw/pie good/, $_[0] => SUB } +sub pie { 7, unwind qw, $_[0] => SUB } sub wlist (@) { return @_ } @@ -254,7 +254,7 @@ $res = wlist pie 1; is $res, 3, 'unwind to list prototype to scalar'; @res = wlist pie 2; -is_deeply \@res, [ qw/pie good 2/ ], 'unwind to list prototype to list'; +is_deeply \@res, [ qw ], 'unwind to list prototype to list'; sub wscalar ($$) { return @_ }