no
indirect
'fatal'
;
subtest
'Long class name'
=>
sub
{
DBIx::Class::Relationship::Abbreviate->
import
(
qw/ result /
);
is(result(
'Baz'
),
'Very::Long::Prefix::For::Schema::Result::Baz'
,
'Very long package names work'
);
};
subtest
'Short class name'
=>
sub
{
DBIx::Class::Relationship::Abbreviate->
import
(
qw/ result /
);
is(result(
'Baz'
),
'Some::Schema::Result::Baz'
,
'Very long package names work'
);
};
subtest
'Invalid class name'
=>
sub
{
my
$ex
= exception { DBIx::Class::Relationship::Abbreviate->
import
(
qw/ result /
) };
like(
$ex
,
qr/Cannot find result namespace in 'Some::Other::Class::FooBar'/
);
};
done_testing();