Commit | Line | Data |
---|---|---|
a304773f | 1 | #!/usr/bin/env perl |
2 | use strict; | |
3 | use warnings; | |
4 | use Test::More; | |
5 | ||
6 | use Eval::Closure; | |
7 | ||
8 | { | |
9 | my $code = eval_closure( | |
10 | source => | |
11 | 'sub {' | |
12 | . '"foo"' | |
13 | . '}', | |
14 | ); | |
15 | ok($code, "got code"); | |
16 | is($code->(), "foo", "got the right code"); | |
17 | } | |
18 | ||
19 | { | |
20 | my $code = eval_closure( | |
21 | source => [ | |
22 | 'sub {', | |
23 | '"foo"', | |
24 | '}', | |
25 | ], | |
26 | ); | |
27 | ok($code, "got code"); | |
28 | is($code->(), "foo", "got the right code"); | |
29 | } | |
30 | ||
31 | done_testing; |