Test-More-Fork-0.007

NAME

Test::More::Fork - Test forking capabilities hacked on to Test::More

DESCRIPTION

Test::More::Fork allows you to run tests seperately. This is useful for returning to a known or pristine state between tests. Test::Seperate seperates tests into different forked processes. You can do whatever you want in a test set without fear that something you do will effect a test in another set.

This is a better option than local when dealing with complex meta-structures and testing class-construction in disperate conditions.

SYNOPSYS

# Should be used in place of Test::More, will import all of the functions
# from Test::More, and accept all the same arguments.
use Test::More::Fork tests => 5;
ok( 1, "Runs in the main process" );
# ok 1 - Runs in the main process
fork_tests {
ok( 1, "Runs in a forked process"
} "Forked tests were run", 1;
# ok 2 - Runs in a forked process
# ok 3 - Forked tests were run
# ok 4 - verify test count
#message and coutn are optional:
fork_tests { ok( 1, "another test" )};
# ok 5 - another test
#create your own test that is safe to run in a forked process:
fork_sub 'new_sub' => sub { ... };

EXPORTED FUNCTIONS

See the docs for Test::More, all functions exported by Test::More are exported by Test::More::Fork as well.

fork_sub $name => sub { ... }

Create a new sub defined in both the current package and Test::More::Fork. This sub will be safe to run in a forked test.

fork_tests( sub { ... }, $message, $count )

Forks, then runs the provided sub in a child process.

$message and $count are optional, and each add an extra test to the count.

SEE ALSO

AUTHORS

COPYRIGHT

Copyright (C) 2009 Chad Granum

Test-Seperate is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Test-Seperate is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.