File Coverage

blib/lib/Test/Slow.pm
Criterion Covered Total %
statement 13 14 92.8
branch 5 6 83.3
condition 2 3 66.6
subroutine 4 5 80.0
pod n/a
total 24 28 85.7


line stmt bran cond sub pod time code
1             package Test::Slow;
2              
3             =encoding utf8
4              
5             =head1 NAME
6              
7             Test::Slow - Skip test(s) that are too slow to run frequently
8              
9             =head1 SYNOPSIS
10              
11             Some test are too slow to run frequently. This module makes it
12             easy to skip slow tests so that you can run the others more
13             frequently. To mark a test as slow simply C this module:
14              
15             use Test::Slow;
16             use Test::More;
17             ...
18             done_testing;
19              
20             To run just the quick tests, set the C environment
21             variable to a true value:
22              
23             $ QUICK_TEST=1 prove --lib t/*t
24              
25              
26             The other approach is to disable slow tests by default and run
27             them only when requested :
28              
29             use Test::Slow "skip";
30             use Test::More;
31             ...
32             done_testing;
33              
34             To run even the slow tests, set the C environment
35             variable to a true value :
36              
37             $ SLOW_TEST=1 prove --lib t/*t
38              
39              
40             =cut
41              
42 5     5   289806 use warnings;
  5         40  
  5         148  
43 5     5   21 use strict;
  5         8  
  5         82  
44 5     5   21 use Test::More;
  5     0   8  
  5         19  
45              
46             our $VERSION = '0.04';
47              
48 0         0 BEGIN {
49             sub import {
50 5     5   36 my ($package, $msg) = @_;
51              
52 5 100 66     26 if(defined $msg and $msg eq "skip") {
53 1 50       6 plan(skip_all => 'Slow test.') unless $ENV{SLOW_TEST};
54             } else {
55 4 100       2382 plan(skip_all => 'Slow test.') if $ENV{QUICK_TEST};
56             }
57             }
58             }
59              
60             =head1 COPYRIGHT & LICENSE
61              
62             Copyright 2010-2020 Tomáš Znamenáček, zoul@fleuron.cz
63              
64             Copyright 2020 Thibault Duponchelle, thibault.duponchelle@gmail.com
65              
66             This program is free software; you can redistribute it and/or modify it
67             under the terms of either: the GNU General Public License as published
68             by the Free Software Foundation; or the Artistic License.
69              
70             See http://dev.perl.org/licenses/ for more information.
71              
72             =cut
73              
74             'SDG';