]> git.vpit.fr Git - perl/modules/re-engine-Hooks.git/blob - t/10-base.t
This is 0.01
[perl/modules/re-engine-Hooks.git] / t / 10-base.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 use blib 't/re-engine-Hooks-TestDist';
7
8 use Test::More tests => 6;
9
10 my $res;
11
12 my $ops;
13 BEGIN { $ops = [ ] }
14
15 {
16  use re::engine::Hooks::TestDist 'foo' => $ops;
17
18  BEGIN { @$ops = () }
19  @$ops = ();
20
21  $res = "lettuce" =~ /t{2,3}/;
22
23  BEGIN {
24   is "@$ops", 'c:EXACT c:CURLY c:END',  'match compilation';
25  }
26  is "@$ops", 'e:CURLY e:END', 'match execution';
27 }
28
29 ok $res, 'regexp match result';
30
31 my @captures;
32
33 {
34  use re::engine::Hooks::TestDist 'foo';
35
36  BEGIN { @$ops = () }
37  @$ops = ();
38
39  @captures = "babaorum" =~ /([aeiou])/g;
40
41  BEGIN {
42   is "@$ops", 'c:OPEN c:ANYOF c:CLOSE c:END', 'capture compilation';
43  }
44  my $expect = join ' ', ('e:OPEN e:ANYOF e:CLOSE e:END') x 4;
45  is "@$ops", $expect, 'capture execution';
46 }
47
48 is "@captures", 'a a o u', 'regexp capture result';