]> git.vpit.fr Git - perl/modules/re-engine-Hooks.git/blob - t/20-multi.t
Update VPIT::TestHelpers to 15e8aee3
[perl/modules/re-engine-Hooks.git] / t / 20-multi.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 => 4 * 2;
9
10 my ($foo_ops, $bar_ops, $expect);
11 BEGIN {
12  $foo_ops = [ ];
13  $bar_ops = [ ];
14  $expect  = 'c:EXACT c:CURLY c:END';
15 }
16
17 {
18  use re::engine::Hooks::TestDist 'foo' => $foo_ops;
19  use re::engine::Hooks::TestDist 'bar' => $bar_ops;
20
21  BEGIN {
22   @$foo_ops = ();
23   @$bar_ops = ();
24  }
25
26  "carrot" =~ /r{2,3}/;
27
28  BEGIN {
29   is "@$foo_ops", $expect, 'match compilation by foo and bar : the foo case';
30   is "@$bar_ops", $expect, 'match compilation by foo and bar : the bar case';
31  }
32 }
33
34 {
35  use re::engine::Hooks::TestDist 'foo';
36
37  BEGIN {
38   @$foo_ops = ();
39   @$bar_ops = ();
40  }
41
42  "cabbage" =~ /b{2,3}/;
43
44  BEGIN {
45   is "@$foo_ops", $expect, 'match compilation by foo only : the foo case';
46   is "@$bar_ops", '',      'match compilation by foo only : the bar case';
47  }
48 }
49
50 {
51  use re::engine::Hooks::TestDist 'bar';
52
53  BEGIN {
54   @$foo_ops = ();
55   @$bar_ops = ();
56  }
57
58  "pepperoni" =~ /p{2,3}/;
59
60  BEGIN {
61   is "@$foo_ops", '',      'match compilation by foo only : the foo case';
62   is "@$bar_ops", $expect, 'match compilation by foo only : the bar case';
63  }
64
65  {
66   use re::engine::Hooks::TestDist 'foo';
67
68   BEGIN {
69    @$foo_ops = ();
70    @$bar_ops = ();
71   }
72
73   'eggplant' =~ /g{2,3}/;
74
75   BEGIN {
76    is "@$foo_ops", $expect, 'match compilation by bar and foo : the foo case';
77    is "@$bar_ops", $expect, 'match compilation by bar and foo : the bar case';
78   }
79  }
80 }