Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

80 lines (61 sloc) 1.488 kb
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More skip_all => "Not implemented yet";
BEGIN {
package MyTrait::Label;
use MooseX::Role::Parameterized;
parameter default => (
is => 'rw',
isa => 'Str',
);
role {
my $p = shift;
has label => (
is => 'rw',
isa => 'Str',
default => $p->default,
);
};
};
BEGIN {
package t::MooseX::LabeledAttributes;
use Moose::Exporter;
$INC{'t/MooseX/LabeledAttributes.pm'} = 1;
# what is the secret sauce?
}
do {
package MyClass::LabeledURL;
use Moose;
use t::MooseX::LabeledAttributes default => 'no label';
has name => (
is => 'ro',
);
has url => (
is => 'ro',
label => 'overridden',
);
no Moose;
no t::MooseX::LabeledAttributes;
};
do {
package MyClass::LabeledPost;
use Moose;
use t::MooseX::LabeledAttributes default => 'TODO!';
has name => (
is => 'ro',
);
has body => (
is => 'ro',
label => 'nevermind...',
);
no Moose;
no t::MooseX::LabeledAttributes;
};
my $url_meta = MyClass::LabeledURL->meta;
is($meta->get_attribute('name')->label, 'no label');
is($meta->get_attribute('url')->label, 'overridden');
my $post_meta = MyClass::LabeledPost->meta;
is($meta->get_attribute('name')->label, 'TODO!');
is($meta->get_attribute('body')->label, 'nevermind...');
done_testing;
Jump to Line
Something went wrong with that request. Please try again.