]> git.vpit.fr Git - perl/modules/re-engine-Plugin.git/blob - t/named_buff/STORE.t
Importing re-engine-Plugin-0.04_01.tar.gz
[perl/modules/re-engine-Plugin.git] / t / named_buff / STORE.t
1 use strict;
2 use Test::More tests => 12;
3
4 use re::engine::Plugin (
5     exec => sub {
6         my $re = shift;
7
8         $re->stash( [
9             {
10                 key => 'one',
11                 value => 'a',
12                 flags => 0,
13             },
14             {
15                 key => 'two',
16                 value => 'b',
17                 flags => 0,
18             },
19             {
20                 key => 'three',
21                 value => 'c',
22                 flags => 1,
23             },
24             {
25                 key => 'four',
26                 value => 'd',
27                 flags => 1,
28             },
29         ] );
30
31         $re->named_captures(
32             STORE => sub {
33                 my ($re, $key, $value, $flags) = @_;
34                 my $hv = shift @{ $re->stash };
35
36                 is($key, $hv->{key}, "key eq $key");
37                 is($value, $hv->{value}, "value eq $value");
38                 is($flags, $hv->{flags}, "flags == $flags");
39             },
40         );
41
42         1;
43     },
44 );
45
46 "a" =~ /a/;
47 $+{one}   = "a";
48 $+{two}   = "b";
49 $-{three} = "c";
50 $-{four}  = "d";
51
52