10 exception { eval_closure() },
11 qr/'source'.*required/,
12 "error when source isn't declared"
16 exception { eval_closure(source => {}) },
17 qr/'source'.*string or array/,
18 "error when source isn't string or array"
22 exception { eval_closure(source => 1) },
23 qr/'source'.*return.*sub/,
24 "error when source doesn't return a sub"
31 environment => { 'foo' => \1 },
34 qr/should start with \@, \%,/,
35 "error from malformed env"
42 environment => { '$foo' => 1 },
45 qr/must be.*reference/,
46 "error from non-ref value"
50 exception { eval_closure(source => '$1++') },
51 qr/Modification of a read-only value/,
52 "gives us compile errors properly"
56 exception { eval_closure(source => 'sub { $x }') },
57 qr/sub \s* { \s* \$x \s* }/x,
58 "without terse_error, includes the source code"
62 exception { eval_closure(source => 'sub { $x }', terse_error => 1) },
63 qr/sub \s* { \s* \$x \s* }/x,
64 "with terse_error, does not include the source code"