This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test preamble: unify chdir 't' if -d 't';
[perl5.git] / t / lib / overload_fallback.t
CommitLineData
c989e6a3
GD
1use warnings;
2use strict;
3use Test::Simple tests => 2;
4
5use overload '""' => sub { 'stringvalue' }, fallback => 1;
6
7BEGIN {
8my $x = bless {}, 'main';
9ok ($x eq 'stringvalue', 'fallback worked');
10}
11
12
13# NOTE: delete the next line and this test script will pass
14use overload '+' => sub { die "unused"; };
15
16my $x = bless {}, 'main';
17ok (eval {$x eq 'stringvalue'}, 'fallback worked again');
18