NAME

MY::Tests - run Class::Tiny::ConstrainedAccessor tests on a given class

SYNOPSIS

These are common test routines that can be used with various type systems. The class under test must have the following attributes:

regular             Unrestricted member, default undef
medint              Constrained to numbers 10..19, no default
med_with_default    Constrained as medint; default 12
lazy_default        Constrained as medint; default 19

FUNCTIONS

test_accessors

Test accessor calls on a newly-constructed object. Call as Tests::test_accessors $instance_of_class_to_test.

test_construction

Tests constructing an object using given parameters. Usage:

Tests::test_construction 'ClassUnderTest', sub { ClassUnderTest->new(@_) };

The parameters are (required) the name of a class, and (optional) a coderef that returns a new instance created with the given parameters (default new() in the specified class). The coderef is for flexibility.