NAME

Assert::Refute::T::Tester - test the test conditions themselves

DESCRIPTION

This module is inspired by Test::Tester. While contract_is is a good way to quickly determine whether a test condition holds any water, a more detailed inspection is desirable.

[EXPERIMENTAL] This module is under active development and its interface may change in the future.

SYNOPSIS

use Test::More;
use Assert::Refute::T::Tester;

use My::Refute::Module qw(check_this check_that);

my $report = try_refute {
    check_this(...); # pass
    check_that(...); # fail
};

test_test
    $report->get_result_details(0),
    { diag => [] },
    "No premature output";

test_test
    $report->get_result_details(1),
    { ok => 1 },
    "Passing test";

test_test
    $report->get_result_details(2),
    { ok => 0, diag => [ qr/foo/, qr/bar/ ] },
    "Failing test";

EXPORT

The following functions are exported by default:

test_test

test_test \%result_details, \%spec, "Message";

Result details come from "get_result_details($id)" in Assert::Refute::Report.

The exact format MAY change in the future, but this test should keep working.

%spec may include:

  • ok - whether the test passed or not.

  • name - test name (without the number) Can be exact string or regular expression.

  • diag - an array of exact strings or regular expressions. Each line of output will be matched against exactly one expectation.

    Output produced by note() is ignored.

LICENSE AND COPYRIGHT

This module is part of Assert::Refute suite.

Copyright 2017-2018 Konstantin S. Uvarin. <khedin at cpan.org>

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0