diff options
Diffstat (limited to 't/01-basic.t')
-rw-r--r-- | t/01-basic.t | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/t/01-basic.t b/t/01-basic.t new file mode 100644 index 0000000..42e309a --- /dev/null +++ b/t/01-basic.t @@ -0,0 +1,23 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +use Eval::Closure 'eval_closure'; + +my $foo = []; + +my $code = eval_closure( + source => 'sub { push @$bar, @_ }', + environment => { + '$bar' => \$foo, + }, + name => 'test', +); +ok($code, "got something"); + +$code->(1); + +is_deeply($foo, [1], "got the right thing"); + +done_testing; |