Test::Catch - Run C++ catch tests from perl test file
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 }, ... );
in your C test files
#include <catch.hpp> ...
Run tests from perl .t file:
use MyModule; XS::Loader::load_tests(); # XS::Install's feature - loads second SO which contains code of C tests (not installed) use Test::Catch; catch_run(); # or Test::Catch::run() catch_run("[tag]"); done_testing(); use Test::Catch '[tag]'; # makes done_testing automatically
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).
catch
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]");
If @args provided, runs tests the same way as run(@args) and calls done_testing() after that.
run(@args)
done_testing()
See run
run
Pronin Oleg <syber@crazypanda.ru>, Crazy Panda LTD
You may distribute this code under the same terms as Perl itself.
To install Test::Catch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Catch
CPAN shell
perl -MCPAN -e shell install Test::Catch
For more information on module installation, please visit the detailed CPAN module installation guide.