The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Instruction - A test framework

VERSION

Version 0.01

SYNOPSIS

        use Test::Instruction qw/all/;

        use Module::To::Test;

        instruction(
                test => 'true',
                func => \&Module::To::Test::true_function
        );

        instruction(
                test => 'false',
                func => \&Module::To::Test::false_function
        );

        my $obj = Module::To::Test->new();

        instruction(
                test => 'hash',
                instance => $obj,
                meth => 'method_that_returns_a_hash',
                expected => { a => 1, b => 2, c => 3 }
        );

        finish(3);

EXPORT

instruction

    instruction(
        test      => 'ok',
        instance  => Module::To::Test->new(),
        func      => 'okay',
        args      => {
            data  => '...'
        },
    );
 

test

you can currently run the following tests.

over

ok - ok - a true value
ref - is_deeply - expected [] or {}
scalar - is - expected '',
hash - is_deeply - expected {},
array - is_deeply - expected [],
obj - isa_ok - expected '',
like - like - '',
true - is - 1,
false - is - 0,
undef - is - undef
ref_key_scalar - is - '' (requires key)
ref_key_ref - is_deeply - [] or {} (requires key)
ref_key_like - like - ''
ref_index_scalar - is - '' (requires index)
ref_index_ref - is_deeply - [] or {} (required index)
ref_index_like - like - ''
ref_index_obj - isa_ok - ''
list_key_scalar - is - '' (requires key)
list_key_ref - is_deeply - [] or {} (requires key)
list_key_like - like - ''
list_index_scalar - is - '' (requires index)
list_index_ref - is_deeply - [] or {} (required index)
list_index_obj - isa_ok - ''
list_index_like - like - ''
count - is - ''
count_ref - is - ''
skip - ok(1)

catch

when you want to catch exceptions....

    catch => 1,
 

defaults the instruction{test} to like.

instance

    my $instance = My::Test::Module->new();
    instance => $instance,
 

meth

call a method from the instance

    instance => $instance,
    meth     => 'render'
 

func

    func => \&My::Test::Module::render,
 

args

    {} or []
 

args_list

    args      => [qw/one, two/],
    args_list => 1,
 

index

index - required when testing - ref_index_* and list_index_*

key

key - required when testing - ref_key_* and list_key_*

finish

AUTHOR

LNATION, <email at lnation.org>

BUGS

Please report any bugs or feature requests to bug-test-instruction at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Instruction. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

        perldoc Test::Instruction

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2022 by LNATION.

This is free software, licensed under:

        The Artistic License 2.0 (GPL Compatible)

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 399:

'=item' outside of any '=over'

Around line 498:

=cut found outside a pod block. Skipping to next block.