NAME
Test::Builder2::Counter - Counts the number of tests run
SYNOPSIS
use Test::Builder2::Counter;
my $counter = Test::Builder2::Counter->singleton;
$counter->increment;
$counter->set($count);
$counter->get;
DESCRIPTION
This object simply contains the count of the number of tests run as a simple positive integer.
Most testing systems don't care how many tests run, but this is very important for TAP output.
The counter is normally used through Test::Builder2::History, but you can get it separately if you want to be really slim.
METHODS
Constructors
singleton
my $counter = Test::Builder2::Counter->singleton;
Gets the single shared counter.
create
my $counter = Test::Builder2::Counter->create;
Creates a brand new counter starting at 0.
The Count
increment
my $count = $counter->increment;
my $count = $counter->increment($amount);
Increments the counter by $amount or 1 if $amount is not given.
Returns the new $count.
Like ++$count
.
set
my $count_was = $counter->set($count);
Sets the counter to $count.
Return what the $count_was.
get
my $count = $counter->get;
Gets the $count.