File Coverage

blib/lib/Test/Routine/Common.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 0 3 0.0
total 29 32 90.6


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