From b180d098f917be6835e10bcb6fe72f3907306570 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 22 Jul 2013 20:52:17 -0400 Subject: note that lexical subs don't work (fixes #2) --- t/lexical.t | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 t/lexical.t (limited to 't') diff --git a/t/lexical.t b/t/lexical.t new file mode 100644 index 0000000..15ba1d2 --- /dev/null +++ b/t/lexical.t @@ -0,0 +1,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; -- cgit v1.2.3-54-g00ecf