Regenerate test files
[gitmo/Mouse.git] / t / 050_metaclasses / 020_metaclass_parameterized_traits.t
CommitLineData
41888e7d 1#!/usr/bin/env perl
fde8e43f 2# This is automatically generated by author/import-moose-test.pl.
3# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4use t::lib::MooseCompat;
41888e7d 5use strict;
6use warnings;
fde8e43f 7use Test::More;
41888e7d 8
9{
10 package My::Trait;
11 use Mouse::Role;
12
13 sub reversed_name {
14 my $self = shift;
15 scalar reverse $self->name;
16 }
17}
18
19{
20 package My::Class;
21 use Mouse -traits => [
22 'My::Trait' => {
23 -alias => {
24 reversed_name => 'enam',
25 },
26 },
27 ];
28}
29
30{
31 package My::Other::Class;
32 use Mouse -traits => [
33 'My::Trait' => {
34 -alias => {
35 reversed_name => 'reversed',
36 },
37 -excludes => 'reversed_name',
38 },
39 ];
40}
41
42my $meta = My::Class->meta;
43is($meta->enam, 'ssalC::yM', 'parameterized trait applied');
44ok(!$meta->can('reversed'), "the method was not installed under the other class' alias");
45
46my $other_meta = My::Other::Class->meta;
47is($other_meta->reversed, 'ssalC::rehtO::yM', 'parameterized trait applied');
48ok(!$other_meta->can('enam'), "the method was not installed under the other class' alias");
49ok(!$other_meta->can('reversed_name'), "the method was not installed under the original name when that was excluded");
50
fde8e43f 51done_testing;