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