-use Test::More tests => 29;
+use Test::More tests => 36;
+use Test::Exception;
use strict;
use warnings;
use lib 't/lib';
my $super = SuperInheritedGroups->new;
my $base = BaseInheritedGroups->new;
+my @ret = SuperInheritedGroups->basefield;
+
+ok(@ret == 1, 'Return value before set');
+ok(!defined(SuperInheritedGroups->basefield), 'Undef return before set');
+
# set base. base, super, object = base
is(BaseInheritedGroups->basefield('All Your Base'), 'All Your Base');
is(SuperInheritedGroups->basefield, 'All Your Base');
# croak on get/set on non hash-based object
my $dying = NotHashBased->new;
-eval {
+throws_ok {
$dying->killme;
-};
-ok($@ =~ /Cannot get.*is not hash-based/);
+} qr/Cannot get.*is not hash-based/;
-eval {
+throws_ok {
$dying->killme('foo');
-};
-ok($@ =~ /Cannot set.*is not hash-based/);
+} qr/Cannot set.*is not hash-based/;
+
+# make sure we're get defined items, even 0, ''
+BaseInheritedGroups->basefield('base');
+SuperInheritedGroups->basefield(0);
+is(SuperInheritedGroups->basefield, 0);
+
+BaseInheritedGroups->basefield('base');
+SuperInheritedGroups->basefield('');
+is(SuperInheritedGroups->basefield, '');
+
+BaseInheritedGroups->basefield('base');
+SuperInheritedGroups->basefield(undef);
+is(SuperInheritedGroups->basefield, 'base');
+
+is(BaseInheritedGroups->undefined, undef);
+
+# make sure run-time @ISA changes trigger an inheritance chain recalculation
+SuperInheritedGroups->basefield(undef);
+BaseInheritedGroups->basefield('your base');
+
+# dirty hack, emulate Class::C3::Componentised
+require ExtraInheritedGroups;
+unshift @SuperInheritedGroups::ISA, qw/ExtraInheritedGroups/;
+
+# this comes from ExtraInheritedGroups
+is(SuperInheritedGroups->basefield, 'your extra base!');