File Coverage

blib/lib/Fennec/EndRunner.pm
Criterion Covered Total %
statement 19 20 95.0
branch 11 16 68.7
condition 2 3 66.6
subroutine 5 5 100.0
pod 0 2 0.0
total 37 46 80.4


line stmt bran cond sub pod time code
1             package Fennec::EndRunner;
2 89     89   453 use strict;
  89         154  
  89         2081  
3 89     89   337 use warnings;
  89         201  
  89         14739  
4              
5             my $RUNNER;
6             my $PID;
7              
8             sub set_runner {
9 166 50   166 0 790 $RUNNER = pop if @_;
10 166         296 return $RUNNER;
11             }
12              
13             sub set_pid {
14 89 50   89 0 398 $PID = pop if @_;
15 89         155 return $PID;
16             }
17              
18             END {
19 89 100 66 89   38767 return unless $PID && $PID == $$;
20 29 50       156 return if $?;
21 29 100       620 return unless $RUNNER;
22 11 100       44 return if $RUNNER->_skip_all;
23 10 50       40 return if $^C; # Do not print this message if perl is called with -c
24              
25 10         410 print STDERR <<" EOT";
26              
27             ###############################################################################
28             # **** It does not look like done_testing() was ever called! **** #
29             # #
30             # As of Fennec 2 automatically-running standalone fennect tests are #
31             # deprecated. This descision was made because all run after run-time #
32             # methods are hacky and/or qwerky. #
33             # #
34             # Since there are so many legacy Fennec tests that relied on this behavior #
35             # it has been carried forward in this deprecated form. An END block has #
36             # been used to display this message, and will next run your tests. #
37             # #
38             # For most legacy tests this should work fine, however it may cause issues #
39             # with any tests that relied on other END blocks, or various hacky things. #
40             # #
41             # DO NOT RELY ON THIS BEHAVIOR - It may go away in the near future. #
42             ###############################################################################
43              
44             EOT
45              
46 10         70 $RUNNER->run();
47              
48 1         12 my $failed = $RUNNER->collector->test_failed;
49 1 50       150 return unless $failed;
50 0         0 $? = $failed;
51             }
52              
53             1;
54              
55             __END__