This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Added a test for bug #77084.
[perl5.git] / t / re / overload.t
CommitLineData
a9f6cb1f
A
1#!./perl
2
3use strict;
4use warnings;
5no warnings 'syntax';
6
7BEGIN {
8 chdir 't' if -d 't';
9 @INC = '../lib';
10}
11
12sub is;
13sub plan;
14
15require './test.pl';
16plan tests => 3;
17
18{
19 # Bug #77084 points out a corruption problem when scalar //g is used
20 # on overloaded objects.
21
22 my $TAG = "foo:bar";
23 use overload '""' => sub {$TAG};
24
25 my $o = bless [];
26 my ($one) = $o =~ /(.*)/g;
27 is $one, $TAG, "list context //g against overloaded object";
28
29 local our $TODO = "Bug #77084";
30
31 my $r = $o =~ /(.*)/g;
32 is $1, $TAG, "scalar context //g against overloaded object";
33
34 $o =~ /(.*)/g;
35 is $1, $TAG, "void context //g against overloaded object";
36}
37
38
39__END__