Tests
[gitmo/Mouse.git] / t / 001_mouse / 301-bugs-non-mouse.t
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 use Test::More;
6 use Test::Exception;
7 my $warn = '';
8 BEGIN { $SIG{__WARN__} = sub { $warn .= "@_" } }
9 {
10     package Foo;
11     use Mouse;
12
13     has foo => ( is => "rw" );
14
15     package Bar;
16     sub oink { "oink" }
17
18     package Gorch;
19     use Mouse;
20
21     extends qw(Bar Foo);
22
23     ::lives_ok{
24         has '+foo' => ( default => "the default" );
25     } 'inherit attr when @ISA contains a non Mouse class before a Mouse class with the base attr';
26 }
27
28 {
29     my $g = Gorch->new;
30
31     is( $g->foo, "the default", "inherited attribute" );
32     is( $g->oink, "oink",       "inherited method from a non-Mouse class");
33 }
34
35 is $warn, '', 'produces no warnings';
36 done_testing;
37