This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Added a test for bug #77084.
authorAbigail <abigail@abigail.be>
Thu, 19 Aug 2010 16:37:11 +0000 (18:37 +0200)
committerAbigail <abigail@abigail.be>
Thu, 19 Aug 2010 16:37:11 +0000 (18:37 +0200)
t/re/overload.t [new file with mode: 0644]

diff --git a/t/re/overload.t b/t/re/overload.t
new file mode 100644 (file)
index 0000000..46407ae
--- /dev/null
@@ -0,0 +1,39 @@
+#!./perl
+
+use strict;
+use warnings;
+no  warnings 'syntax';
+
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+}
+
+sub is;
+sub plan;
+
+require './test.pl';
+plan tests => 3;
+
+{
+    # Bug #77084 points out a corruption problem when scalar //g is used
+    # on overloaded objects.
+
+    my $TAG = "foo:bar";
+    use overload '""' => sub {$TAG};
+
+    my $o = bless [];
+    my ($one) = $o =~ /(.*)/g;
+    is $one, $TAG, "list context //g against overloaded object";
+
+    local our $TODO = "Bug #77084";
+
+    my $r = $o =~ /(.*)/g;
+    is $1, $TAG, "scalar context //g against overloaded object";
+
+    $o =~ /(.*)/g;
+    is $1, $TAG, "void context //g against overloaded object";
+}
+
+
+__END__