Test::Proto::Object - Test Prototype for objects.
Test::Proto::Object->new->ok($object); # ok Test::Proto::Object->new->ok('1'); # not ok Test::Proto::Object ->new->try_can( 'toString', [], ['<div/>'], 'Element div toString returns <div/>' )->ok($object);
This is a test prototype which requires that the value it is given is defined and is a scalar. It provides methods for interacting with strings.
See Test::Proto::Base for documentation on common methods.
$prototype->can('toString', 'has a toString method')->ok($object);
This method adds a test equivalent to Perl's builtin can, i.e. tests if an object has a method with the given name. It does not actually execute this method.
can
$prototype->try_can('toString', [], ['<div/>'], 'Element div toString returns <div/>')->ok($object); # is_deeply($object->toString (), ['<div/>'], 'Element div toString returns <div/>');
This method allows you to make method calls to your object and test the result. Arguments are: 1) the method name; 2) an arrayref containing the arguments you want to pass to the method call; 3) an arrayref containing the results; 4) Optionally, the reason for the test.
NB: Results are evaluated in list context and what is available for testing is always an arrayref.
For author, version, bug reports, support, etc, please see Test::Proto.
To install Test::Proto, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Proto
CPAN shell
perl -MCPAN -e shell install Test::Proto
For more information on module installation, please visit the detailed CPAN module installation guide.