File: overloading_combine_to_instance.t

package info (click to toggle)
libmoose-perl 2.4000-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,408 kB
  • sloc: perl: 21,275; ansic: 291; makefile: 10
file content (39 lines) | stat: -rw-r--r-- 881 bytes parent folder | download | duplicates (5)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
use strict;
use warnings;

use Test::More 0.88;
use if $ENV{AUTHOR_TESTING}, 'Test::Warnings';
use overload ();

use lib 't/lib';

use OverloadingTests;
use Overloading::RoleWithOverloads;
use Overloading::RoleWithoutOverloads;

{
    package MyClass;
    use Moose;
}

my $object = MyClass->new;

Moose::Meta::Role->combine(
    [ 'Overloading::RoleWithOverloads'    => undef ],
    [ 'Overloading::RoleWithoutOverloads' => undef ],
)->apply($object);

OverloadingTests::test_overloading_for_package($_)
    for 'Overloading::RoleWithOverloads', ref $object;

OverloadingTests::test_no_overloading_for_package(
    'Overloading::RoleWithoutOverloads');

$object->message('foo');

OverloadingTests::test_overloading_for_object(
    $object,
    'object with Overloading::RoleWithOverloads and Overloading::RoleWithoutOverloads combined and applied to instance'
);

done_testing();