++ed by:
NGLENN TOMITA

2 PAUSE users

MATSUNO★…Tokuhiro
and 4 contributors

NAME

Test::Base::Less - Limited version of Test::Base.

SYNOPSIS

    use Test::Base::Less;

    filters {
        input => [qw/eval/],
    };

    for my $block (blocks) {
        is($block->input, $block->expected);
    }
    done_testing;

    __DATA__

    ===
    --- input: 4*2
    --- expected: 8

DESCRIPTION

This is a less clever version of Test::Base.

FUNCTIONS

This module exports all Test::More's exportable functions, and following functions:

filters(+{ } : HashRef);
    filters {
        input => [qw/eval/],
    };

Set a filter for the section name.

blocks()

Get a list of Text::TestBase::Block as filtered.

register_filter($name: Str, $code: CodeRef)

Register a filter for $name using $code.

DEFAULT FILTERS

This module provides only few filters. If you want to add more filters, pull-reqs welcome. (I only merge a patch using no depended modules)

eval

eval() the code.

chomp

chomp() the arguments.

uc

uc() the arguments.

trim

Remove extra blank lines from the beginning and end of the data. This allows you to visually separate your test data with blank lines.

lines

Break the data into an anonymous array of lines. Each line (except possibly the last one if the chomp filter came first) will have a newline at the end.

REGISTER YOUR OWN FILTER

You can register your own filter by following form:

    use Digest::MD5 qw/md5_hex/;
    Test::Base::Less::register_filter(md5_hex => \&md5_hex);

USE CODEREF AS FILTER

You can use a CodeRef as filter.

    use Digest::MD5 qw/md5_hex/;
    filters {
        input => [\&md5_hex],
    };

SEE ALSO

Most of code is taken from Test::Base. Thanks Ingy.