overload_c3_utf8.t revision 1.1.1.1
1#!./perl 2 3use strict; 4use warnings; 5BEGIN { 6 unless (-d 'blib') { 7 chdir 't' if -d 't'; 8 @INC = '../lib'; 9 } 10} 11 12use utf8; 13use open qw( :utf8 :std ); 14 15require q(./test.pl); plan(tests => 7); 16 17{ 18 package ���e�����; 19 use strict; 20 use warnings; 21 use mro 'c3'; 22 23 package Ov���r������������e�����; 24 use strict; 25 use warnings; 26 use mro 'c3'; 27 use base '���e�����'; 28 use overload '""' => sub { ref(shift) . " stringified" }, 29 fallback => 1; 30 31 sub ������ { bless {} => shift } 32 33 package ��������������������������ve����oad���������; 34 use strict; 35 use warnings; 36 use base 'Ov���r������������e�����'; 37 use mro 'c3'; 38} 39 40my $x = ��������������������������ve����oad���������->������(); 41object_ok($x, '��������������������������ve����oad���������'); 42 43my $y = Ov���r������������e�����->������(); 44object_ok($y, 'Ov���r������������e�����'); 45 46is("$x", '��������������������������ve����oad��������� stringified', '... got the right value when stringifing'); 47is("$y", 'Ov���r������������e����� stringified', '... got the right value when stringifing'); 48 49ok(($y eq 'Ov���r������������e����� stringified'), '... eq was handled correctly'); 50 51my $result; 52eval { 53 $result = $x eq '��������������������������ve����oad��������� stringified' 54}; 55ok(!$@, '... this should not throw an exception'); 56ok($result, '... and we should get the true value'); 57 58