File: subclass.t

package info (click to toggle)
libmoosex-traits-pluggable-perl 0.10-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 204 kB
  • sloc: perl: 2,102; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 460 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use strict;
use warnings;
use Test::More tests => 3;
use Test::Exception;

{ package Foo;
  use Moose;
  with 'MooseX::Traits::Pluggable';

  package Bar;
  use Moose;
  extends 'Foo';

  package Trait;
  use Moose::Role;

  sub foo { return 42 };
}

my $instance;
lives_ok {
    $instance = Bar->new_with_traits( traits => ['Trait'] );
} 'creating instance works ok';

ok $instance->does('Trait'), 'instance does trait';
is $instance->foo, 42, 'trait works';