=cut
use strict;
-
-use Data::Dumper;
-
-use Test::More tests => 7;
-
+use Test::More tests => 8;
use re::engine::Plugin ();
like "a", qr/^a$/, "import didn't run, perl's regex engine in effect";
BEGIN {
re::engine::Plugin->import(
- comp => sub {}, # TODO: remove when this can be omitted
exec => sub { $_[0]->pattern eq $_[1] }
);
}
{
BEGIN {
re::engine::Plugin->import(
- comp => sub {}, # TODO: remove when this can be omitted
exec => sub { $_[0]->pattern ne $_[1] }
);
}
{
BEGIN {
re::engine::Plugin->import(
- comp => sub {}, # TODO: remove when this can be omitted
exec => sub { $_[0]->pattern eq '^[abc]$' }
);
}
ok "^hello" =~ /^hello/ => "regex modified to match a literal pattern";
+# Another import at the same scope
+BEGIN {
+ re::engine::Plugin->import(
+ exec => sub { $_[0]->pattern ne $_[1] }
+ );
+}
-
-
-
-
-
-
-
-
-
-
-
+ok "^hello" !~ /^hello/ => "regex modified not to match a literal pattern";