Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Perl
branch: master

Checking in changes prior to tagging of version 0.5.

Changelog diff is:

diff --git a/Changes b/Changes
index 44ef4dc..72309fc 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,8 @@ Revision history for Perl extension Test-Base-SubTest

 {{$NEXT}}

+0.5 2014-01-24T12:32:41Z
+
     - fix POD

 0.4 2014-01-16T13:53:24Z
latest commit 1e313c2e26
@Cside authored
Failed to load latest commit information.
eg version++
lib fix POD
t variable indentation
.gitignore initial commit
.travis.yml initial commit
Build.PL initial commit
Changes Checking in changes prior to tagging of version 0.5.
LICENSE initial commit
META.json fix POD
README.md fix POD
cpanfile initial commit
minil.toml initial commit

README.md

NAME

Test::Base::SubTest - Enables Test::Base to use subtest

SYNOPSIS

use Test::Base::SubTest;

filters { input => [qw/eval/] };
run {
    my $block = shift;
    is $block->input, $block->expected, $block->name;
};
done_testing;

__DATA__

### subtest 1
    === test 1-1
    --- input:    4*2
    --- expected: 8

    === test 1-2
    --- input :   3*3
    --- expected: 9

### subtest 2
    === test 2-1
    --- input:    4*3
    --- expected: 12

DESCRIPTION

Test::Base::SubTest is a extension of Test::Base::Less.

"### TEST NAME" is a delimiter of a subtest. Indentaion is necessary.

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.

  • run(\&subroutine)

    run {
        my $block = shift;
        is $block->input, $block->expected, $block->name;
    };
    

    Calls the sub for each block. It passes the current block object to the subroutine.

  • run_is([data_name1, data_name2])

    run_is input => 'expected';
    
  • run_is_deeply([data_name1, data_name2])
  • 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.

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::Less. Thank you very match, tokuhirom.

AUTHOR

Hiroki Honda cside.story@gmail.com

LICENSE

Copyright (C) Hiroki Honda

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Something went wrong with that request. Please try again.