File: next_method_utf8.t

package info (click to toggle)
perl 5.20.2-3%2Bdeb8u11
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 102,964 kB
  • sloc: perl: 555,553; ansic: 214,041; sh: 38,121; pascal: 8,783; cpp: 3,895; makefile: 2,393; xml: 2,325; yacc: 1,741
file content (67 lines) | stat: -rw-r--r-- 1,629 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/perl

use strict;
use warnings;
use utf8;
use open qw( :utf8 :std );

require q(./test.pl); plan(tests => 5);

=pod

This tests the classic diamond inheritance pattern.

   <A>
  /   \
<B>   <C>
  \   /
   <D>

=cut

{
    package Diӑmond_A;
    use mro 'c3'; 
    sub 헬ฬ { 'Diӑmond_A::헬ฬ' }
    sub fಓ { 'Diӑmond_A::fಓ' }       
}
{
    package Diӑmond_B;
    use base 'Diӑmond_A';
    use mro 'c3';     
    sub fಓ { 'Diӑmond_B::fಓ => ' . (shift)->next::method() }       
}
{
    package Diӑmond_C;
    use mro 'c3';    
    use base 'Diӑmond_A';     

    sub 헬ฬ { 'Diӑmond_C::헬ฬ => ' . (shift)->next::method() }
    sub fಓ { 'Diӑmond_C::fಓ => ' . (shift)->next::method() }   
}
{
    package Diӑmond_D;
    use base ('Diӑmond_B', 'Diӑmond_C');
    use mro 'c3'; 
    
    sub fಓ { 'Diӑmond_D::fಓ => ' . (shift)->next::method() }   
}

ok(eq_array(
    mro::get_linear_isa('Diӑmond_D'),
    [ qw(Diӑmond_D Diӑmond_B Diӑmond_C Diӑmond_A) ]
), '... got the right MRO for Diӑmond_D');

is(Diӑmond_D->헬ฬ, 'Diӑmond_C::헬ฬ => Diӑmond_A::헬ฬ', '... method resolved itself as expected');

is(Diӑmond_D->can('헬ฬ')->('Diӑmond_D'), 
   'Diӑmond_C::헬ฬ => Diӑmond_A::헬ฬ', 
   '... can(method) resolved itself as expected');
   
is(UNIVERSAL::can("Diӑmond_D", '헬ฬ')->('Diӑmond_D'), 
   'Diӑmond_C::헬ฬ => Diӑmond_A::헬ฬ', 
   '... can(method) resolved itself as expected');

is(Diӑmond_D->fಓ, 
    'Diӑmond_D::fಓ => Diӑmond_B::fಓ => Diӑmond_C::fಓ => Diӑmond_A::fಓ', 
    '... method fಓ resolved itself as expected');