summaryrefslogtreecommitdiffstats
path: root/t/01-basic.t
blob: 42e309a8dd1ebdf7846166658532119a9fc5d857 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;