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

NAME

   tv - Run 'make TEST_VERBOSE=1' on one or more test files

SYNOPSIS

   $ tv t/foo.t         # make test TEST_VERBOSE=1 TEST_FILES=t/foo.t
   $ tv -d t/foo.t      # similar, but turn on the debugger
   $ tv Foo.pm          # Run all t/*.t test scripts for Foo.pm
   $ tv t/foo.t t/bar.t # make TEST_VERBOSE=1 "TEST_FILES=t/foo.t t/bar.t"
   $ tv t/*             # Run all test scripts in t
   $ tv lib             # Test all modules in lib
   $ tv --ext-utils     # Don't use make, use ExtUtils::Command::MM directly

DESCRIPTION

Given one or more test scripts, Perl source code files, directories containing them, or Perl package names, tv tries to select and run the appropriate test scripts using "make test TEST_VERBOSE=1 TEST_FILES=..." where the "..." are the selected test scripts.

This is especially useful in an editor when mapped to a key that saves and runs tv on the current file or just as shorthand for a frequent but laborious make incantation.

Test scripts

Test scripts are filenames that end in ".t".

Passing tv the names of test scripts selects them and runs them:

    tv t/foo.t
    

and

    tv t/*.t

select and run t/foo.t and t/*.t, repsectively.

For parameters that do not end in ".t", tv scans the source code for them and for all test scripts in t/*.t to select the test scripts that apply. There are two other parameter types: source files and Perl package (class) names.

Source Files

If a source file name (or directory hierarchy of them) is given, then those files and all test scripts are scanned, and any test scripts pertaining to the named source files and any packages it defines are selected. This allows

    tv Foo.pm
    tv lib/Bar/Bash.pm
    cd lib/Bar; tv Bash.pm

to DWIM (see the upcoming description of how tv finds the main project directory to see how that last one DWIMs).

Source files are also run through podchecker

Directories

If a directory name is passed, it is scanned for .t, .pm, .pod, and .pl files and these are treated as though they were mentioned on the command line. This can go goofy if you run it on a test directory that contains .pm file that are used in the test suite--a private copy of Test::Differences, perhaps--that you don't want to test. This is a bug that should be fixed.

Packages

If a package name is given, then all source files and test scripts mentioned are scanned as well as all source files in the main project directory and its lib/ and t/ subdirectories are scanned, then any test scripts pertaining to the named packages are selected. This allows

    tv Foo

to work.

Untestable items

It is a fatal error if a named item cannot be tested. In this case, nothing is tested and tv prints a messages to STDERR and exits with a non-zero exit code.

Finding the main project directory

The main project directory is found by looking for "./t", "../t", "../../t" and so on until a directory containing a "t" directory is found.

Code Scanner Details

In source files, things that look like package statements and some special POD are used to infer what test scripts to run. In test scripts, some other special POD and things that look like use or require statements are used to infer what files and packages are being tested. This is only performed if something other than a test script (or directory hierarchy containing test scripts and no source files) are given.

The special POD to be used in source files is:

    =for test_script foo.t bar.t

and for test scripts is

    =for file Foo.pm lib/Bar.pm

and

    =for package Foo

The =for paragraphs may span more than one line and define whitespace separated lists of items. The filenames in the =for file directive must be relative to the main project directory and not contain ".." names.

The scanning for use, require, and package statements is quite naive, but usually sufficient. Things like POD documentation and multiline strings can fool the scanners, but this is not usually a problem.

OPTIONS

-d, --debug

Run test script(s) in NonStop debugging mode using perl -d. The inline breakpoint $DB::single=1; for the debugger is very useful with this option, as in the interrupt (often ^C) key. See perldebug.

NOTE: this runs the test scripts directly using perl -d, since ExtUtils::Command::MM does not offer the ability. Overrides --ext-utils. Best used with a single test script.

--dd, --debug-stop

Like -d but in "normal" debug mode so the debugger stops at the first line of the test script.

Most useful when running a single script.

-h, -?, --help

Print out full help text (this page).

-n, --dry-run, --just-print, --recon

Print out the make command but don't run it.

--ext-utils

Invokes

    perl '-MExtUtils::Command::MM' -e 'test_harness(1,\'lib\')' @scripts
    

instead of the default "make test" incantation. Useful if you don't have a Makefile.PL. Ignored if -d is used.

--no-pod, --no-podchecker

Do not run podchecker on any source files found.

-v, --verbose

Print out the command to be run.

--debug-tv

Turn on tv's internal debugging output (does not affect the test scripts, see the -d option).

See Test::Verbose for more details.

COPYRIGHT

    Copyright 2002, R. Barrie Slaymaker, Jr.  All Rights Reserved.

LICENSE

You may use this under the terms of any of the BSD, Artistic, or GPL licenses.

AUTHOR

    Barrie Slaymaker <barries@slaysys.com>

1 POD Error

The following errors were encountered while parsing the POD:

Around line 61:

Unterminated L<...> sequence