File Coverage

blib/lib/Test/Data/Function.pm
Criterion Covered Total %
statement 16 18 88.8
branch 1 2 50.0
condition 2 2 100.0
subroutine 4 4 100.0
pod 1 1 100.0
total 24 27 88.8


line stmt bran cond sub pod time code
1             package Test::Data::Function;
2 3     3   1402 use strict;
  3         7  
  3         101  
3              
4 3     3   19 use Exporter qw(import);
  3         16  
  3         171  
5              
6             our @EXPORT = qw(prototype_ok);
7             our $VERSION = '1.242';
8              
9 3     3   18 use Test::Builder;
  3         8  
  3         496  
10             my $Test = Test::Builder->new();
11              
12             =encoding utf8
13              
14             =head1 NAME
15              
16             Test::Data::Function -- test functions for functions
17              
18             =head1 SYNOPSIS
19              
20             use Test::Data qw(Function);
21              
22             =head1 DESCRIPTION
23              
24             This module provides test functions for subroutine sorts of things.
25              
26             =head2 Functions
27              
28             =over 4
29              
30             =item prototype_ok( PROTOTYPE, SUB [, NAME ] )
31              
32             =cut
33              
34             sub prototype_ok(\&$;$) {
35 2     2 1 694 my $sub = shift;
36 2         7 my $prototype = shift;
37 2   100     34 my $name = shift || 'function prototype is correct';
38              
39 2         9 my $actual = prototype( $sub );
40 2         7 my $test = $actual eq $prototype;
41              
42 2 50       8 unless( $test ) {
43 0           $Test->diag( "Subroutine has prototype [$actual]; expected [$prototype]" );
44 0           $Test->ok(0, $name);
45             }
46             else {
47 2         14 $Test->ok( $test, $name );
48             }
49             }
50              
51              
52             =back
53              
54             =head1 SEE ALSO
55              
56             L,
57             L,
58             L,
59             L,
60             L
61              
62             =head1 SOURCE AVAILABILITY
63              
64             This source is in Github:
65              
66             https://github.com/briandfoy/test-data
67              
68             =head1 AUTHOR
69              
70             brian d foy, C<< >>
71              
72             =head1 COPYRIGHT AND LICENSE
73              
74             Copyright © 2002-2018, brian d foy . All rights reserved.
75              
76             This program is free software; you can redistribute it and/or modify
77             it under the terms of the Artistic License 2.0.
78              
79             =cut
80              
81             "red leather yellow leather";