summaryrefslogtreecommitdiffstats
path: root/t/unavailable.t
diff options
context:
space:
mode:
Diffstat (limited to 't/unavailable.t')
-rw-r--r--t/unavailable.t48
1 files changed, 48 insertions, 0 deletions
diff --git a/t/unavailable.t b/t/unavailable.t
new file mode 100644
index 0000000..06db914
--- /dev/null
+++ b/t/unavailable.t
@@ -0,0 +1,48 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN {
+ package My::Parser;
+ use Exporter 'import';
+ our @EXPORT = ('foo', 'bar');
+
+ use Parse::Keyword {
+ foo => \&parse_foo,
+ bar => \&parse_bar,
+ };
+
+ sub foo {}
+
+ sub parse_foo {
+ lex_read_space;
+ die unless lex_peek eq '{';
+ parse_block(1)->();
+ return (sub {}, 1);
+ }
+
+ sub bar { $::body = $_[0] }
+
+ sub parse_bar {
+ lex_read_space;
+ die unless lex_peek eq '{';
+ my $body = parse_block;
+ return (sub { $body }, 1);
+ }
+
+ $INC{'My/Parser.pm'} = __FILE__;
+}
+
+use My::Parser;
+
+my $bar;
+my $baz = 5;
+
+foo {
+ bar { $baz }
+}
+
+is($::body->(), 5);
+
+done_testing;