| 1 | package Test::UniqueTestNames::Tracker; | ||||||||||||
| 2 | |||||||||||||
| 3 | 12 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 12 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 12 | ▶ | use Test::UniqueTestNames::Test; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 12 | my %tests; | |||||||||||
| 9 | |||||||||||||
| 10 | 94 | ▶ | sub add_test { | ||||||||||
|
Subroutine
add_test: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||
| 11 | 94 | my ( $class, $name, $line_number ) = @_; | |||||||||||
| 12 | |||||||||||||
| 13 | 94 | ▶ | die "add_test must have a line number" unless defined $line_number; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 14 | 93 | ▶ | $name ||= '<no test name>'; | ||||||||||
|
Condition100%2/2
$name ||= "<no test name>"
MC/DC100%1/1
$name ||= "<no test name>"
$name
Truth table100%2/2
A
A= $name
| |||||||||||||
| 15 | |||||||||||||
| 16 | 93 | ▶ | unless ( exists $tests{ $name } ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 17 | 72 | $tests{ $name } = Test::UniqueTestNames::Test->new( $name, $line_number ); | |||||||||||
| 18 | } | ||||||||||||
| 19 | else { | ||||||||||||
| 20 | 21 | $tests{ $name }->add_line_number( $line_number ); | |||||||||||
| 21 | } | ||||||||||||
| 22 | } | ||||||||||||
| 23 | |||||||||||||
| 24 | 3 | ▶ | sub all_tests { | ||||||||||
|
Subroutine
all_tests: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 25 | 3 | return [ values %tests ]; | |||||||||||
| 26 | } | ||||||||||||
| 27 | |||||||||||||
| 28 | 33 | ▶ | sub failing_tests { | ||||||||||
|
Subroutine
failing_tests: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||
| 29 | 33 | my ( $class ) = @_; | |||||||||||
| 30 | |||||||||||||
| 31 | 33 | my @failing_tests; | |||||||||||
| 32 | |||||||||||||
| 33 | 33 | for( sort { $a->lowest_line_number <=> $b->lowest_line_number } values %tests ) { | |||||||||||
| 34 | 102 | ▶ | push @failing_tests, $_ if $_->fails; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 35 | } | ||||||||||||
| 36 | |||||||||||||
| 37 | 33 | return \@failing_tests; | |||||||||||
| 38 | } | ||||||||||||
| 39 | |||||||||||||
| 40 | 2 | ▶ | sub unnamed_ok { | ||||||||||
|
Subroutine
unnamed_ok: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 41 | 2 | my ( $class, $value ) = @_; | |||||||||||
| 42 | 2 | Test::UniqueTestNames::Test->unnamed_ok( $value ); | |||||||||||
| 43 | } | ||||||||||||
| 44 | |||||||||||||
| 45 | 12 | 1; | |||||||||||