File Coverage

blib/lib/ok.pm
Criterion Covered Total %
statement 10 12 83.3
branch 3 6 50.0
condition n/a
subroutine 3 3 100.0
pod n/a
total 16 21 76.1


line stmt bran cond sub pod time code
1             package ok;
2             our $VERSION = '1.302182';
3              
4 15     15   8371 use strict;
  15         46  
  15         557  
5 15     15   9115 use Test::More ();
  15         47  
  15         2017  
6              
7             sub import {
8 17     17   177 shift;
9              
10 17 50       72 if (@_) {
11 17 100       65 goto &Test::More::pass if $_[0] eq 'ok';
12 16         103 goto &Test::More::use_ok;
13             }
14              
15             # No argument list - croak as if we are prototyped like use_ok()
16 0           my (undef, $file, $line) = caller();
17 0 0         ($file =~ /^\(eval/) or die "Not enough arguments for 'use ok' at $file line $line\n";
18             }
19              
20              
21             __END__
22              
23             =encoding UTF-8
24              
25             =head1 NAME
26              
27             ok - Alternative to Test::More::use_ok
28              
29             =head1 SYNOPSIS
30              
31             use ok 'Some::Module';
32              
33             =head1 DESCRIPTION
34              
35             With this module, simply change all C<use_ok> in test scripts to C<use ok>,
36             and they will be executed at C<BEGIN> time.
37              
38             Please see L<Test::use::ok> for the full description.
39              
40             =head1 CC0 1.0 Universal
41              
42             To the extent possible under law, 唐鳳 has waived all copyright and related
43             or neighboring rights to L<Test-use-ok>.
44              
45             This work is published from Taiwan.
46              
47             L<http://creativecommons.org/publicdomain/zero/1.0>
48              
49             =cut