summaryrefslogtreecommitdiff
path: root/cpan/NEXT/t/stringify.t
diff options
context:
space:
mode:
Diffstat (limited to 'cpan/NEXT/t/stringify.t')
-rw-r--r--cpan/NEXT/t/stringify.t35
1 files changed, 35 insertions, 0 deletions
diff --git a/cpan/NEXT/t/stringify.t b/cpan/NEXT/t/stringify.t
new file mode 100644
index 0000000000..8d06890ceb
--- /dev/null
+++ b/cpan/NEXT/t/stringify.t
@@ -0,0 +1,35 @@
+use warnings;
+use strict;
+use Test::More tests => 2;
+
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir('t') if -d 't';
+ @INC = qw(../lib);
+ }
+}
+
+BEGIN { use_ok('NEXT') };
+
+
+package Foo;
+
+use overload '""' => 'stringify';
+
+use constant BAR => (1..5);
+
+sub new { bless {}, shift }
+
+sub stringify {
+ my $self = shift;
+ my %result = $self->EVERY::LAST::BAR;
+ join '-' => @{ $result{'Foo::BAR'} };
+}
+
+
+
+package main;
+
+my $foo = Foo->new;
+is("$foo", '1-2-3-4-5', 'overloading stringification');
+