]> git.vpit.fr Git - perl/modules/re-engine-Plugin.git/blobdiff - t/50-num_buff/FETCH.t
Order the test subdirectories
[perl/modules/re-engine-Plugin.git] / t / 50-num_buff / FETCH.t
diff --git a/t/50-num_buff/FETCH.t b/t/50-num_buff/FETCH.t
new file mode 100644 (file)
index 0000000..39d3f6c
--- /dev/null
@@ -0,0 +1,35 @@
+use strict;
+use Test::More tests => 7;
+
+use re::engine::Plugin (
+    exec => sub {
+        my $re = shift;
+
+        $re->num_captures(
+            FETCH => sub {
+                my ($re, $paren) = @_;
+
+                my %ret = (
+                    -2 => 10,
+                    -1 => 20,
+                     0 => 30,
+                     1 => 40,
+                );
+
+                $ret{$paren};
+            }
+        );
+
+        1;
+    },
+);
+
+"a" =~ /a/;
+
+is($`, 10, '$`');
+is(${^PREMATCH}, 10, '${^PREMATCH}');
+is($', 20, q($'));
+is(${^POSTMATCH}, 20, '${^POSTMATCH}');
+is($&, 30, '$&');
+is(${^MATCH}, 30, '${^MATCH}');
+is($1, 40, '$1');