line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
1594
|
use 5.008; |
|
3
|
|
|
|
|
10
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Test::Data::Function; |
4
|
3
|
|
|
3
|
|
13
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
62
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
13
|
use Exporter qw(import); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
185
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT = qw(prototype_ok); |
9
|
|
|
|
|
|
|
our $VERSION = '1.244'; |
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
18
|
use Test::Builder; |
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
438
|
|
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
|
517
|
my $sub = shift; |
38
|
2
|
|
|
|
|
3
|
my $prototype = shift; |
39
|
2
|
|
100
|
|
|
8
|
my $name = shift || 'function prototype is correct'; |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
|
|
5
|
my $actual = prototype( $sub ); |
42
|
2
|
|
|
|
|
3
|
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
|
|
|
|
|
9
|
$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-2022, 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"; |