File Coverage

blib/lib/Test/Mini.pm
Criterion Covered Total %
statement 19 19 100.0
branch 2 4 50.0
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 28 30 93.3


line stmt bran cond sub pod time code
1             # Lightweight xUnit Testing for Perl.
2             #
3             # Test::Mini is a light, spry testing framework built to bring the familiarity
4             # of an xUnit testing framework to Perl as a first-class citizen. Based
5             # initially on Ryan Davis' minitest, it provides a not only a simple way to
6             # write and run tests, but the necessary infrastructure for more expressive
7             # test fromeworks to be written.
8             #
9             # Since example code speaks louder than words:
10             #
11             # package t::Test
12             # use base 'Test::Mini::TestCase';
13             # use strict;
14             # use warnings;
15             #
16             # # This will run before each test
17             # sub setup { ... }
18             #
19             # # This will run after each test
20             # sub teardown { ... }
21             #
22             # sub test_something {
23             # my $self = shift;
24             # $self->assert(1); # Assertions come from Test::Mini::Assertions
25             # }
26             #
27             # # Assertions can also be imported...
28             # use Test::Mini::Assertions;
29             #
30             # sub helper { return 1 }
31             #
32             # sub test_something_else {
33             # assert(helper());
34             # }
35             #
36             # Like any traditional xUnit framework, any method whose name begins with
37             # 'test' will be automatically run. If you've declared 'setup' or 'teardown'
38             # methods, they will be run before or after each test.
39             #
40             # @see http://blog.zenspider.com/minitest
41             # @see Test::Mini::Runner
42             # @author Pieter van de Bruggen
43             package Test::Mini;
44 4     4   87042 use strict;
  4         6  
  4         134  
45 4     4   20 use warnings;
  4         6  
  4         102  
46 4     4   109 use 5.008;
  4         16  
  4         162  
47              
48 4     4   4048 use version 0.77; our $VERSION = qv("v1.1.3");
  4         12423  
  4         28  
49              
50             # @scope class
51             # @return [Class] The test runner class to use.
52 4     4 1 13 sub runner_class { 'Test::Mini::Runner' }
53              
54             END {
55 3     3   368 $| = 1;
56 3 50       20 return if $?;
57              
58 3 50       26 unless ($ENV{TEST_MINI_NO_AUTORUN}) {
59 3         31 my $class = __PACKAGE__->runner_class;
60 3         350 eval "require $class;";
61              
62 3         36 $? = $class->new()->run();
63             }
64             }
65              
66             1;