Commit | Line | Data |
874177a3 |
1 | use Test::More tests => 8; |
18026fd5 |
2 | use Test::Exception; |
331e820d |
3 | use strict; |
4 | use warnings; |
5 | use lib 't/lib'; |
18026fd5 |
6 | use AccessorGroupsComp; |
331e820d |
7 | |
18026fd5 |
8 | is(AccessorGroupsComp->result_class, undef); |
331e820d |
9 | |
874177a3 |
10 | ## croak on set where class can't be loaded and it's a physical class |
18026fd5 |
11 | my $dying = AccessorGroupsComp->new; |
12 | throws_ok { |
ba8c183b |
13 | $dying->result_class('NotReallyAClass'); |
18026fd5 |
14 | } qr/Could not load result_class 'NotReallyAClass'/; |
331e820d |
15 | is($dying->result_class, undef); |
16 | |
874177a3 |
17 | |
18 | ## don't croak when the class isn't available but not loaded for people |
19 | ## who create class/packages on the fly |
20 | $dying->result_class('JunkiesNeverInstalled'); |
21 | is($dying->result_class, 'JunkiesNeverInstalled'); |
22 | |
6d0e8ff2 |
23 | ok(! $INC{'BaseInheritedGroups.pm'}); |
18026fd5 |
24 | AccessorGroupsComp->result_class('BaseInheritedGroups'); |
6d0e8ff2 |
25 | ok($INC{'BaseInheritedGroups.pm'}); |
18026fd5 |
26 | is(AccessorGroupsComp->result_class, 'BaseInheritedGroups'); |
331e820d |
27 | |
28 | ## unset it |
18026fd5 |
29 | AccessorGroupsComp->result_class(undef); |
30 | is(AccessorGroupsComp->result_class, undef); |