NAME

Test::Catch - Run C++ catch tests from perl test file

SYNOPSIS

in Makefile.PL

use XS::Install;
WriteMakefile(
    ...
    BIN_DEPS => 'Test::Catch',
    test => {
        SRC => 't', # make all C files compile in 't' folder into separate SO file when 'make test'
                    # it's an XS::Install feature
        NAME => 'MyTestMod', # name of second (test) module
    },
    ...
);

in your C test files

#include <catch2/catch.hpp>
...

Run tests from perl .t file:

use MyModule;
use Test::Catch; # should be loaded before you load your test SO

XS::Loader::load_noboot('MyTestMod'); # or load() if you have and XS in test SO also

catch_run(); # or Test::Catch::run()
catch_run("[tag]");
done_testing();

use Test::Catch '[tag]'; # makes done_testing automatically

DESCRIPTION

This module provides catch's run function which runs CPP catch tests, so that you don't need to have catch run main in every module tests. Also this module makes tests output compatible with perl format and can work with perl tests in the same process (tests count and subtests nesting are shared).

FUNCTIONS

run([@args])

Runs catch tests. If @args are provided the result is if it was provided in command-line for native catch test binary.

Separate arguments work as '&&'. If you want to run, for example test 'name' and all tests with tag 'tag' and all tests with both tag 'tag2' and 'tag3', use

catch_run("name,[tag],[tag2][tag3]");

import(@args)

If @args provided, runs tests the same way as run(@args) and calls done_testing() after that.

EXPORTED FUNCTIONS

catch_run([@tags])

See run

AUTHOR

Pronin Oleg <syber@crazypanda.ru>, Crazy Panda LTD

LICENSE

You may distribute this code under the same terms as Perl itself.