diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-07-10 18:17:03 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-07-10 18:21:52 -0400 |
commit | a55b2a20f72b216066b59557846f9fec06dbf984 (patch) | |
tree | 8828f3b156ce6669eb9ebf608701b4b9f4253b11 /t | |
parent | fb4fd3f3c24529bc2a63b0e67822a19450ec8dc6 (diff) | |
download | eval-closure-a55b2a20f72b216066b59557846f9fec06dbf984.tar.gz eval-closure-a55b2a20f72b216066b59557846f9fec06dbf984.zip |
support lexical subs with the '&' sigil
Diffstat (limited to 't')
-rw-r--r-- | t/errors.t | 2 | ||||
-rw-r--r-- | t/lexical-subs.t | 22 |
2 files changed, 23 insertions, 1 deletions
@@ -31,7 +31,7 @@ like( environment => { 'foo' => \1 }, ) }, - qr/should start with \@, \%, or \$/, + qr/should start with \@, \%,/, "error from malformed env" ); diff --git a/t/lexical-subs.t b/t/lexical-subs.t new file mode 100644 index 0000000..dbcd178 --- /dev/null +++ b/t/lexical-subs.t @@ -0,0 +1,22 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +use Test::Requires '5.018'; +use 5.018; + +use Eval::Closure; + +my $sub = eval_closure( + source => 'sub { foo() }', + environment => { + '&foo' => sub { state $i++ }, + } +); + +is($sub->(), 0); +is($sub->(), 1); +is($sub->(), 2); + +done_testing; |