summaryrefslogtreecommitdiff
path: root/t/recipes/extending_debugging_baseclassrole.t
blob: a05181f98b9e2565e1232a08670788f6be3b1a68 (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/perl -w

use strict;
use Test::More 'no_plan';
use Test::Fatal;
$| = 1;



# =begin testing SETUP
use Test::Requires 'Test::Output';



# =begin testing SETUP
{

  package MooseX::Debugging;

  use Moose::Exporter;

  Moose::Exporter->setup_import_methods(
      base_class_roles => ['MooseX::Debugging::Role::Object'],
  );

  package MooseX::Debugging::Role::Object;

  use Moose::Role;

  sub BUILD {}
  after BUILD => sub {
      my $self = shift;

      warn "Made a new " . ( ref $self ) . " object\n";
  };
}



# =begin testing
{
{
    package Debugged;

    use Moose;
    MooseX::Debugging->import;
}

stderr_is(
    sub { Debugged->new },
    "Made a new Debugged object\n",
    'got expected output from debugging role'
);
}




1;