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/thread-self/root/usr/share/doc/perl-Moose/t/attributes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/proc/thread-self/root/usr/share/doc/perl-Moose/t/attributes/attribute_names.t
use strict;
use warnings;
use Test::More;
use Test::Fatal;

my $exception_regex = qr/You must provide a name for the attribute/;
{
    package My::Role;
    use Moose::Role;

    ::like( ::exception {
        has;
    }, $exception_regex, 'has; fails' );

    ::like( ::exception {
        has undef;
    }, $exception_regex, 'has undef; fails' );

    ::is( ::exception {
        has "" => (
            is => 'bare',
        );
    }, undef, 'has ""; works now' );

    ::is( ::exception {
        has 0 => (
            is => 'bare',
        );
    }, undef, 'has 0; works now' );
}

{
    package My::Class;
    use Moose;

    ::like( ::exception {
        has;
    }, $exception_regex, 'has; fails' );

    ::like( ::exception {
        has undef;
    }, $exception_regex, 'has undef; fails' );

    ::is( ::exception {
        has "" => (
            is => 'bare',
        );
    }, undef, 'has ""; works now' );

    ::is( ::exception {
        has 0 => (
            is => 'bare',
        );
    }, undef, 'has 0; works now' );
}

done_testing;

Hry