Test::Role - test that a class or object performs a role
use Test::Role; use Foo; does_ok(Foo, 'bar'); my $foo = Foo->new; does_ok($foo, 'bar');
Test::Role provides a test for classes and object that implement roles using the Class::Roles module.
Test::Role exports a single function does_ok. does_ok takes two required arguments: a class or object and a role which that class or object must perform. A third optional argument may be used to provide a more specific name of what is being testing (for example 'Test customer'). in the absence of this argument, 'the object' will be used instead.
Test::Role is implemented using Test::Builder, so it's tests integrate seamlessly with other test modules such as Test::More and Test::Exception.
Update once Class::Roles (by chromatic) and Class::Role (another 'trait' implementation by Luke Palmer) are merged in the near future.
Michael Schwern for Test::Builder::isa_ok on which this is based.
chromatic for Class::Roles, this module's raison d'etre.
Test::Builder
Class::Roles
James FitzGibbon <jfitz@CPAN.org>
Copyright (c) 2003, James FitzGibbon. All Rights Reserved.
This module is free software. You may use it under the same terms as perl itself.
To install Test::Role, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Role
CPAN shell
perl -MCPAN -e shell install Test::Role
For more information on module installation, please visit the detailed CPAN module installation guide.