Perl::Critic::Policy::TestingAndDebugging::RequireTestLabels(3pm)

Perl::Critic::Policy::TestingAndDebugging::RequireTestLabels3pm

Tests should all have labels.

Affiliation

This Policy is part of the core Perl::Critic distribution.

Overview

Most Perl modules with regression tests use Test::More as infrastructure for writing and running those tests. It has an easy, procedural syntax for writing comparisons of results to expectations.

Most of the Test::More functions allow the programmer to add an optional label that describes what each test is trying to judge. When a test goes wrong, these labels are very useful for quickly determining where the problem originated.

This policy enforces that all Test::More functions have labels where applicable. This only applies to code that has a "use Test::More" or "require Test::More" declaration (see below to add more test modules to the list).

Configuration

A list of additional modules to require label parameters be passed to their methods can be specified with the "modules" option. The list must consist of whitespace-delimited, fully-qualified module names. For example:

    [TestingAndDebugging::RequireTestLabels]
    modules = My::Test::SubClass  Some::Other::Module

The module list always implicitly includes Test::More.

Releases

10 releases since Debian 5.0 (Lenny); the text changed 9 times.

  1. 5.0
  2. 6.0
  3. 7
  4. 8
  5. 9
  6. 10
  7. 11
  8. 12
  9. 13
  10. Arch

Author

Chris Dolan <[email protected]>

From perl-perl-critic 1.156-3 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.