Permalink
Browse files

Test for unwrapping using the handle itself.

  • Loading branch information...
1 parent 251efb0 commit 2a3fab46c25492efa5af472f9dbb7850e20d61f9 @jnthn jnthn committed Nov 26, 2011
Showing with 9 additions and 1 deletion.
  1. +9 −1 S06-advanced/wrap.t
View
@@ -11,7 +11,7 @@ use Test;
# mutating wraps -- those should be "deep", as in not touching coderefs
# but actually mutating how the coderef works.
-plan 64;
+plan 66;
my @log;
@@ -191,6 +191,14 @@ dies_ok { {nextsame}() }, '{nextsame}() dies properly';
is $wrapped, 'meet', 'wrapper sees lexical from time of wrap (meet)';
}
+{
+ sub foo() { 1 }
+ my $h = &foo.wrap(-> { 1 + callsame });
+ is foo(), 2, 'wrap worked (sanity)';
+ $h.restore();
+ is foo(), 1, 'could unwrap by calling .restore on the handle';
+}
+
done;
# vim: ft=perl6

0 comments on commit 2a3fab4

Please sign in to comment.