This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Encode to CPAN version 2.78
[perl5.git] / t / mro / overload_c3_utf8.t
1 #!./perl
2
3 use strict;
4 use warnings;
5 BEGIN {
6     unless (-d 'blib') {
7         chdir 't' if -d 't';
8         @INC = '../lib';
9     }
10 }
11
12 use utf8;
13 use open qw( :utf8 :std );
14
15 require 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ꪩࡃᛝTeŝṱ;
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ꪩࡃᛝTeŝṱ';
37     use mro 'c3';
38 }
39
40 my $x = 읺ҎꀀḮṆᵷꜰ롬ᵕveŔŁoad엗텟ᵵ->ネᚹ();
41 object_ok($x, '읺ҎꀀḮṆᵷꜰ롬ᵕveŔŁoad엗텟ᵵ');
42
43 my $y = Ov에rꪩࡃᛝTeŝṱ->ネᚹ();
44 object_ok($y, 'Ov에rꪩࡃᛝTeŝṱ');
45
46 is("$x", '읺ҎꀀḮṆᵷꜰ롬ᵕveŔŁoad엗텟ᵵ stringified', '... got the right value when stringifing');
47 is("$y", 'Ov에rꪩࡃᛝTeŝṱ stringified', '... got the right value when stringifing');
48
49 ok(($y eq 'Ov에rꪩࡃᛝTeŝṱ stringified'), '... eq was handled correctly');
50
51 my $result;
52 eval { 
53     $result = $x eq '읺ҎꀀḮṆᵷꜰ롬ᵕveŔŁoad엗텟ᵵ stringified' 
54 };
55 ok(!$@, '... this should not throw an exception');
56 ok($result, '... and we should get the true value');
57