The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Run::Core - Base class to run standard TAP scripts.

VERSION

Version 0.0303

BUILD

For Moose.

$self->helpers_base_namespace()

See Test::Run::Base::PlugHelpers.

Object Parameters

These parameters are accessors. They can be set at object creation by passing their name along with a value on the constructor (along with the compulsory 'test_files' argument):

    my $tester = Test::Run::Obj->new(
        {
            'test_files' => \@mytests,
            'Verbose' => 1,
        }
    );

Alternatively, before runtests() is called, they can be set by passing a value to their accessor:

    $tester->Verbose(1);
$self->Verbose()

The object variable $self->Verbose() can be used to let runtests() display the standard output of the script without altering the behavior otherwise. The runprove utility's -v flag will set this.

$self->Leaked_Dir()

When set to the name of a directory, $tester will check after each test whether new files appeared in that directory, and report them as

  LEAKED FILES: scr.tmp 0 my.db

If relative, directory name is with respect to the current directory at the moment $tester->runtests() was called. Putting the absolute path into Leaked_Dir will give more predictable results.

$self->Debug()

If $self->Debug() is true, Test::Run will print debugging information about itself as it runs the tests. This is different from $self->Verbose(), which prints the output from the test being run.

$self->Columns()

This value will be used for the width of the terminal. If it is not set then it will default to 80.

$self->Timer()

If set to true, and Time::HiRes is available, print elapsed seconds after each test file.

$self->NoTty()

When set to a true value, forces it to behave as though STDOUT were not a console. You may need to set this if you don't want harness to output more frequent progress messages using carriage returns. Some consoles may not handle carriage returns properly (which results in a somewhat messy output).

$self->Test_Interprter()

Usually your tests will be run by $^X, the currently-executing Perl. However, you may want to have it run by a different executable, such as a threading perl, or a different version.

$self->Switches() and $self->Switches_Env()

These two values will be prepended to the switches used to invoke perl on each test. For example, setting one of them to -W will run all tests with all warnings enabled.

The difference between them is that Switches_Env() is expected to be filled in by the environment and Switches() from other sources (like the programmer).

METHODS

Test::Run currently has only one interface method.

$tester->runtests()

    my $all_ok = $tester->runtests()

Runs the tests, see if they are OK. Returns true if they are OK, or throw an exception otherwise.

$self->_report_leaked_files({leaked_files => [@files]})

[This is a method that needs to be over-rided.]

Should report (or ignore) the files that were leaked in the directories that were specifies as leaking directories.

$self->_report_failed_with_results_seen({%args})

[This is a method that needs to be over-rided.]

Should report (or ignore) the failed tests in the test file.

Arguments are:

  • test_struct

    The test struct as returned by straps.

  • filename

    The filename

  • estatus

    Exit status.

  • wstatus

    Wait status.

  • results

    The results of the test.

$self->_recheck_dir_files()

Called to recheck that the dir files is OK.