Permalink
Browse files

Make sure MXRP and Moose::Exporter play nicely together

  • Loading branch information...
1 parent 85a6ba1 commit b88228f22d636ab1ad587fe351d48c20e559d21e @sartak committed Aug 24, 2012
Showing with 57 additions and 0 deletions.
  1. +57 −0 t/022-export-p-trait.t
View
@@ -0,0 +1,57 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+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;
+
+ Moose::Exporter->setup_import_methods(
+ class_metaroles => {
+ attribute => [ 'MyTrait::Label' => { default => 'no label' } ],
+ },
+ );
+}
+
+do {
+ package MyClass::LabeledURL;
+ use Moose;
+ use t::MooseX::LabeledAttributes;
+
+ has name => (
+ is => 'ro',
+ );
+
+ has url => (
+ is => 'ro',
+ label => 'overridden',
+ );
+};
+
+my $meta = MyClass::LabeledURL->meta;
+is($meta->get_attribute('name')->label, 'no label');
+is($meta->get_attribute('url')->label, 'overridden');
+
+done_testing;

0 comments on commit b88228f

Please sign in to comment.