Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /usr/share/doc/perl-Moose/t/cmop/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/perl-Moose/t/cmop/universal_methods.t
use strict;
use warnings;

use Test::More;
use Class::MOP;

my $meta_class = Class::MOP::Class->create_anon_class;

my %methods      = map { $_->name => 1 } $meta_class->get_all_methods();
my %method_names = map { $_       => 1 } $meta_class->get_all_method_names();

my @universal_methods = qw/isa can VERSION/;
push @universal_methods, 'DOES' if "$]" >= 5.010;

for my $method (@universal_methods) {
    ok(
        $meta_class->find_method_by_name($method),
        "find_method_by_name finds UNIVERSAL method $method"
    );
    ok(
        $meta_class->find_next_method_by_name($method),
        "find_next_method_by_name finds UNIVERSAL method $method"
    );
    ok(
        scalar $meta_class->find_all_methods_by_name($method),
        "find_all_methods_by_name finds UNIVERSAL method $method"
    );
    ok(
        $methods{$method},
        "get_all_methods includes $method from UNIVERSAL"
    );
    ok(
        $method_names{$method},
        "get_all_method_names includes $method from UNIVERSAL"
    );
}

done_testing;

Hry