NAME

Test::Timeout - Limit the amount of time tests can take

SYNOPSIS

use Test::More tests => 2; # add an extra test to your plan
use Test::Timeout timeout => 2; # number of seconds

# this test will fail and the test suite will stop running after 2 seconds
sleep(10);
pass("Whee");

DESCRIPTION

Sometimes perl modules get "stuck". The tests should take this into account and test to make sure that it doesn't happen. Test::Timeout makes this trivial by limiting the amount of time the test can run.

FUNCTIONS

import

This takes a hash, with a required named "timeout" which is the number of seconds to limit the test to.

TODO

Need to implement syntax like Time::Out (that would just fail instead of exiting):
timeout 180 => sub {
  sleep(200);
}