summaryrefslogtreecommitdiff
path: root/t/op/pos.t
diff options
context:
space:
mode:
Diffstat (limited to 't/op/pos.t')
-rwxr-xr-xt/op/pos.t16
1 files changed, 16 insertions, 0 deletions
diff --git a/t/op/pos.t b/t/op/pos.t
new file mode 100755
index 0000000000..46811b7bbc
--- /dev/null
+++ b/t/op/pos.t
@@ -0,0 +1,16 @@
+#!./perl
+
+print "1..3\n";
+
+$x='banana';
+$x=~/.a/g;
+if (pos($x)==2) {print "ok 1\n"} else {print "not ok 1\n";}
+
+$x=~/.z/gc;
+if (pos($x)==2) {print "ok 2\n"} else {print "not ok 2\n";}
+
+sub f { my $p=$_[0]; return $p }
+
+$x=~/.a/g;
+if (f(pos($x))==4) {print "ok 3\n"} else {print "not ok 3\n";}
+