This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [PATCH] NEXT.pm bug within overloaded stringification
[perl5.git] / lib / NEXT / t / stringify.t
1 use warnings;
2 use strict;
3 use Test::More tests => 2;
4
5 BEGIN {
6     if ($ENV{PERL_CORE}) {
7         chdir('t') if -d 't';
8         @INC = qw(../lib);
9     }
10 }
11
12 BEGIN { use_ok('NEXT') };
13
14
15 package Foo;
16
17 use overload '""' => 'stringify';
18
19 use constant BAR => (1..5);
20
21 sub new { bless {}, shift }
22
23 sub stringify {
24     my $self = shift;
25     my %result = $self->EVERY::LAST::BAR;
26     join '-' => @{ $result{'Foo::BAR'} };
27 }
28
29
30
31 package main;
32
33 my $foo = Foo->new;
34 is("$foo", '1-2-3-4-5', 'overloading stringification');
35