Mouse::Util::does_role() respects $thing->does() method
[gitmo/Mouse.git] / t / 900_mouse_bugs / 006_RT69939.t
CommitLineData
84787870 1#!perl -w
2
2b36fd6f 3use Test::More;
4
5BEGIN {
6 if($^O =~ /bsd/) {
7 plan skip_all => q{TODO: *bsd might fail on this tests (this test is an workaround to a core bug)};
8 }
9}
10
84787870 11package Foo;
12use Mouse;
13
14has bar => (
15 is => 'rw',
16
17 trigger => sub {
18 eval 'BEGIN{ die }';
19 },
20 default => sub {
21 eval 'BEGIN{ die }';
22 return 42;
23 },
24);
25
26sub BUILDARGS {
27 eval 'BEGIN{ die }';
28 return {};
29}
30
31sub BUILD {
32 eval 'BEGIN{ die }';
33}
34
35package main;
36
f0e1969b 37use Test::More tests => 3 * 3;
84787870 38
39$@ = '(ERRSV)';
40
f0e1969b 41note 'do {}';
42do {
43 my $foo = Foo->new;
44 isa_ok $foo, 'Foo';
45 is $foo->bar, 42;
46 $foo->bar(100);
47 is $foo->bar, 100;
48 note("\$@=$@");
49};
50
51note 'eval {}';
52eval {
53 my $foo = Foo->new;
54 isa_ok $foo, 'Foo';
55 is $foo->bar, 42;
56 $foo->bar(100);
57 is $foo->bar, 100;
58 note("\$@=$@");
59};
60
61note 'eval ""';
62eval q{
63 my $foo = Foo->new;
64 isa_ok $foo, 'Foo';
65 is $foo->bar, 42;
66 $foo->bar(100);
67 is $foo->bar, 100;
68 note("\$@=$@");
69};