die if the source doesn't return a subroutine reference
[gitmo/Eval-Closure.git] / t / 01-basic.t
CommitLineData
efb592ef 1#!/usr/bin/env perl
2use strict;
3use warnings;
4use Test::More;
5
ce19c70b 6use Eval::Closure;
efb592ef 7
8my $foo = [];
9
10my $code = eval_closure(
11 source => 'sub { push @$bar, @_ }',
12 environment => {
13 '$bar' => \$foo,
14 },
15 name => 'test',
16);
17ok($code, "got something");
18
19$code->(1);
20
21is_deeply($foo, [1], "got the right thing");
22
23done_testing;