X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2Fmethods.t;fp=t%2Fmethods.t;h=0000000000000000000000000000000000000000;hb=36958ebe8b4c296f858f6b5df8f629cdb341812d;hp=e939407d3b3a4c4b61772ef2ebc774f8db6e8b72;hpb=bc365867d2883a69972ef82adf4b19d0680e43aa;p=perl%2Fmodules%2Fre-engine-Plugin.git diff --git a/t/methods.t b/t/methods.t deleted file mode 100644 index e939407..0000000 --- a/t/methods.t +++ /dev/null @@ -1,54 +0,0 @@ -=pod - -Tests methods on the re object - -=cut - -use strict; - -use feature ':5.10'; - -use Test::More tests => 9; - -use re::engine::Plugin ( - comp => sub { - my $re = shift; - - # Use a stash to pass a single scalar value to each executing - # routine, references work perfectly a reference to anything - # can be passed as well - $re->stash( { x => 5, y => sub { 6 } } ); - - # Return value not used for now.. - }, - exec => sub { - my ($re, $str) = @_; - - # pattern - cmp_ok($re->pattern, 'eq', ' foobar zoobar ' => '->pattern ok'); - - # modifiers - my %mod = $re->mod; - ok(exists $mod{i}, 'str flags /i'); - ok(exists $mod{x}, 'str flags /x'); - like(join('', keys %mod), qr/^[cgimosx]+$/, 'flags contain all-good characters'); - - # stash - cmp_ok($re->stash->{"x"}, '==', 5, "data correct in stash"); - cmp_ok(ref $re->stash->{"y"}, 'eq', 'CODE', "data correct in stash"); - cmp_ok(ref $re->stash->{"y"}, 'eq', 'CODE', "data correct in stash"); - cmp_ok($re->stash->{"y"}->(), '==', 6, "data correct in stash"); - - # Pattern contains "foo", "bar" and "zoo", return a true - return $re->pattern =~ /zoo/; - } -); - -my $re = qr< foobar zoobar >xi; - -if ("input" =~ $re ) { - pass 'pattern matched'; -} else { - fail "pattern didn't match"; -} -