X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;ds=sidebyside;f=t%2F10-base.t;h=565f878c025366211be212cd0570c8c0d74c747f;hb=9fc90d81cde4cbe8bff27adf3cc3624c86988f1a;hp=0db53dcfcfaee81d5257e0d7f547d67e535e57d2;hpb=7eb360aa8aa4a3fbd88d6bf1dedd601e6dcef62e;p=perl%2Fmodules%2Fre-engine-Hooks.git diff --git a/t/10-base.t b/t/10-base.t index 0db53dc..565f878 100644 --- a/t/10-base.t +++ b/t/10-base.t @@ -5,9 +5,7 @@ use warnings; use blib 't/re-engine-Hooks-TestDist'; -use Test::More tests => 6; - -my $res; +use Test::More tests => 4 * 3; my $ops; BEGIN { $ops = [ ] } @@ -18,17 +16,15 @@ BEGIN { $ops = [ ] } BEGIN { @$ops = () } @$ops = (); - $res = "lettuce" =~ /t{2,3}/; + my $res = "lettuce" =~ /t{2,3}/; BEGIN { is "@$ops", 'c:EXACT c:CURLY c:END', 'match compilation'; } is "@$ops", 'e:CURLY e:END', 'match execution'; -} -ok $res, 'regexp match result'; - -my @captures; + ok $res, 'regexp match result'; +} { use re::engine::Hooks::TestDist 'foo'; @@ -36,13 +32,54 @@ my @captures; BEGIN { @$ops = () } @$ops = (); - @captures = "babaorum" =~ /([aeiou])/g; + my @captures = "babaorum" =~ /([aeiou])/g; BEGIN { is "@$ops", 'c:OPEN c:ANYOF c:CLOSE c:END', 'capture compilation'; } my $expect = join ' ', ('e:OPEN e:ANYOF e:CLOSE e:END') x 4; is "@$ops", $expect, 'capture execution'; + + is "@captures", 'a a o u', 'regexp capture result'; +} + +my $expected_comp_branch; +BEGIN { + $expected_comp_branch +} + +{ + use re::engine::Hooks::TestDist 'foo'; + + BEGIN { @$ops = () } + @$ops = (); + + my $res = "tomato" =~ /t(?:z|.)/g; + + BEGIN { + is "@$ops", 'c:EXACT c:EXACT c:BRANCH c:BRANCH c:REG_ANY c:TAIL c:END', + 'branch compilation'; + } + my $expect = join ' ', ('e:EXACT e:BRANCH') x2, 'e:REG_ANY e:END'; + is "@$ops", $expect, 'branch execution'; + + ok $res, 'branch execution result'; } -is "@captures", 'a a o u', 'regexp capture result'; +{ + use re::engine::Hooks::TestDist 'foo'; + + BEGIN { @$ops = () } + @$ops = (); + + my $res = "potato" =~ /t(?:z|o)/g; + + BEGIN { + is "@$ops", 'c:EXACT c:EXACT c:BRANCH c:BRANCH c:EXACT c:TAIL c:END c:TRIE', + 'trie compilation'; + } + my $expect = join ' ', ('e:EXACT e:TRIE') x2, 'e:END'; + is "@$ops", $expect, 'trie execution'; + + ok $res, 'trie execution result'; +}