]> git.vpit.fr Git - perl/modules/re-engine-Plugin.git/blobdiff - t/50-num_buff/LENGTH.t
Order the test subdirectories
[perl/modules/re-engine-Plugin.git] / t / 50-num_buff / LENGTH.t
diff --git a/t/50-num_buff/LENGTH.t b/t/50-num_buff/LENGTH.t
new file mode 100644 (file)
index 0000000..957b39e
--- /dev/null
@@ -0,0 +1,35 @@
+use strict;
+use Test::More $] < 5.011 ? (tests => 7) : (skip_all => 'Not working in blead');
+
+use re::engine::Plugin (
+    exec => sub {
+        my $re = shift;
+
+        $re->stash( [
+            10, 10,
+            20, 20,
+            30, 30,
+            40,
+        ]);
+
+        $re->num_captures(
+            LENGTH => sub {
+                my ($re, $paren) = @_;
+
+                shift @{ $re->stash };
+            },
+        );
+
+        1;
+    },
+);
+
+"a" =~ /a/;
+
+is(length $`, 10);
+is(length ${^PREMATCH}, 10);
+is(length $', 20);
+is(length ${^POSTMATCH}, 20);
+is(length $&, 30);
+is(length ${^MATCH}, 30);
+is(length $1, 40);