blob: 15ba1d2f5b4df827bf0f936abfbacc5306e743d5 (
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
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
BEGIN {
if (!eval { require Exporter::Lexical }) {
plan skip_all => "This test requires Exporter::Lexical";
}
}
BEGIN { plan skip_all => "This doesn't work yet." }
BEGIN {
package My::Parser;
use Exporter::Lexical -exports => ['foo'];
use Parse::Keyword { foo => \&parse_foo };
sub foo { $_[0]->() }
sub parse_foo {
lex_read_space;
my $code = parse_block;
return sub { $code };
}
$INC{'My/Parser.pm'} = __FILE__;
}
{
use My::Parser;
is(foo { my $x = 1; $x + 3 }, 4);
}
eval "foo { 1 }";
like $@, qr/slkfdj/;
done_testing;
|