summaryrefslogtreecommitdiffstats
path: root/t/01-basic.t
blob: 82224d9c82fde1141aa3b6a67ba4667ea6bcf959 (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;

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;