File Coverage

blib/lib/Test/Routine/Common.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 0 3 0.0
total 32 35 91.4


line stmt bran cond sub pod time code
1 10     10   173 use v5.12.0;
  10         39  
2             package Test::Routine::Common 0.030;
3             # ABSTRACT: a role composed by all Test::Routine roles
4              
5 10     10   68 use Moose::Role;
  10         21  
  10         69  
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 10     10   62878 use Test::Abortable 0.002 ();
  10         446432  
  10         321  
15 10     10   76 use Test2::API 1.302045 ();
  10         122  
  10         212  
16              
17 10     10   4597 use namespace::autoclean;
  10         68545  
  10         40  
18              
19       21 0   sub BUILD {
20             }
21              
22       21 0   sub DEMOLISH {
23             }
24              
25             sub run_test {
26 42     42 0 221 my ($self, $test) = @_;
27              
28 42         106 my $ctx = Test2::API::context();
29 42         2886 my ($file, $line) = @{ $test->_origin }{ qw(file line) };
  42         1480  
30 42         162 $ctx->trace->set_detail("at $file line $line");
31              
32 42         468 my $name = $test->name;
33 42     42   1184 Test::Abortable::subtest($test->description, sub { $self->$name });
  42         29959  
34              
35 42         98159 $ctx->release;
36             }
37              
38             1;
39              
40             __END__
41              
42             =pod
43              
44             =encoding UTF-8
45              
46             =head1 NAME
47              
48             Test::Routine::Common - a role composed by all Test::Routine roles
49              
50             =head1 VERSION
51              
52             version 0.030
53              
54             =head1 OVERVIEW
55              
56             Test::Routine::Common provides the C<run_test> method described in L<the docs
57             on writing tests in Test::Routine|Test::Routine/Writing Tests>.
58              
59             =head1 PERL VERSION
60              
61             This module should work on any version of perl still receiving updates from
62             the Perl 5 Porters. This means it should work on any version of perl released
63             in the last two to three years. (That is, if the most recently released
64             version is v5.40, then this module should work on both v5.40 and v5.38.)
65              
66             Although it may work on older versions of perl, no guarantee is made that the
67             minimum required version will not be increased. The version may be increased
68             for any reason, and there is no promise that patches will be accepted to lower
69             the minimum required perl.
70              
71             =head1 AUTHOR
72              
73             Ricardo Signes <cpan@semiotic.systems>
74              
75             =head1 COPYRIGHT AND LICENSE
76              
77             This software is copyright (c) 2010 by Ricardo Signes.
78              
79             This is free software; you can redistribute it and/or modify it under
80             the same terms as the Perl 5 programming language system itself.
81              
82             =cut