summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-07-21 01:15:36 -0400
committerJesse Luehrs <doy@tozt.net>2013-07-21 01:15:36 -0400
commitca4b8625890142ce43b3b4eaa36f58c28263df56 (patch)
treef8fb6efdc5077166aeaf9554ad2271bae1d44a41
parent3d4fd403e7a62181ee0d40823c8991628481c6cd (diff)
downloadparse-keyword-ca4b8625890142ce43b3b4eaa36f58c28263df56.tar.gz
parse-keyword-ca4b8625890142ce43b3b4eaa36f58c28263df56.zip
test statement form
-rw-r--r--t/basic.t22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/basic.t b/t/basic.t
index 119e586..8171972 100644
--- a/t/basic.t
+++ b/t/basic.t
@@ -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;