| 1 | 11 | ▶ | use v5.12.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | package Test::Routine::Common 0.032; | ||
| 3 | # ABSTRACT: a role composed by all Test::Routine roles | ||
| 4 | |||
| 5 | 11 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | #pod =head1 OVERVIEW | ||
| 8 | #pod | ||
| 9 | #pod Test::Routine::Common provides the C<run_test> method described in L<the docs | ||
| 10 | #pod on writing tests in Test::Routine|Test::Routine/Writing Tests>. | ||
| 11 | #pod | ||
| 12 | #pod =cut | ||
| 13 | |||
| 14 | 11 | ▶ | use Test::Abortable 0.002 (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 11 | ▶ | use Test2::API 1.302045 (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 11 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | |||
| 19 | 22 | ▶ | sub BUILD { |
|
Subroutine
BUILD: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 20 | } | ||
| 21 | |||
| 22 | 22 | ▶ | sub DEMOLISH { |
|
Subroutine
DEMOLISH: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 23 | } | ||
| 24 | |||
| 25 | 44 | ▶ | sub run_test { |
|
Subroutine
run_test: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 26 | 44 | my ($self, $test) = @_; | |
| 27 | |||
| 28 | 44 | my $ctx = Test2::API::context(); | |
| 29 | 44 | my ($file, $line) = @{ $test->_origin }{ qw(file line) }; | |
| 30 | 44 | $ctx->trace->set_detail("at $file line $line"); | |
| 31 | |||
| 32 | 44 | my $name = $test->name; | |
| 33 | |||
| 34 | # Capture and return whether the test as a whole succeeded or not | ||
| 35 | 44 | ▶ | my $rc = Test::Abortable::subtest($test->description, sub { $self->$name }); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 36 | |||
| 37 | 44 | $ctx->release; | |
| 38 | |||
| 39 | 44 | return $rc; | |
| 40 | } | ||
| 41 | |||
| 42 | 11 | 1; | |
| 43 | |||
| 44 | __END__ | ||