diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-07-21 01:15:36 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-07-21 01:15:36 -0400 |
commit | ca4b8625890142ce43b3b4eaa36f58c28263df56 (patch) | |
tree | f8fb6efdc5077166aeaf9554ad2271bae1d44a41 | |
parent | 3d4fd403e7a62181ee0d40823c8991628481c6cd (diff) | |
download | parse-keyword-ca4b8625890142ce43b3b4eaa36f58c28263df56.tar.gz parse-keyword-ca4b8625890142ce43b3b4eaa36f58c28263df56.zip |
test statement form
-rw-r--r-- | t/basic.t | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -16,4 +16,26 @@ use Test::More; ::is_deeply([bar], [1, 2, 3]); } +{ + package Bar; + + use Parse::Keyword { baz => \&baz_parser }; + + my $code; + + sub baz { $code = $_[0] } + sub baz_parser { + lex_read_space; + my $block = parse_block; + return (sub { $block }, 1); + } + + baz { + my $foo = 1; + return $foo + 2; + } + ::is(ref($code), 'CODE'); + ::is($code->(), 3); +} + done_testing; |