]> git.vpit.fr Git - perl/modules/Scope-Context.git/blobdiff - t/12-actions.t
Implement ->yield
[perl/modules/Scope-Context.git] / t / 12-actions.t
index a8c4b145b9513e2b1731c8fef546363caedefd13..7aaec9406cf62af725fb900acf698acc7c8586d4 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 4 * 3 + 2;
+use Test::More tests => 4 * 3 + 3;
 
 use Scope::Context;
 
@@ -86,6 +86,19 @@ use Scope::Context;
  is_deeply \@res, [ 1, 2, 3 ], 'unwind: done';
 }
 
+{
+ my @res = do {
+  sub {
+   my $up = Scope::Context->up;
+   $up->yield(4, 5, 6);
+   fail 'yield: not reached 1';
+  }->();
+  fail 'yield: not reached 2';
+  return qw<x y z t>;
+ };
+ is_deeply \@res, [ 4, 5, 6 ], 'yield: done';
+}
+
 {
  sub outer {
   inner(@_);