line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
package OOP::Perlish::Class::Accessor::UnitTests::Code; |
3
|
1
|
|
|
1
|
|
6
|
use OOP::Perlish::Class::Accessor::UnitTests::Base; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
6
|
use base qw(OOP::Perlish::Class::Accessor::UnitTests::Base); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
96
|
|
5
|
1
|
|
|
1
|
|
6
|
use OOP::Perlish::Class::Accessor; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
6
|
1
|
|
|
1
|
|
14
|
use Test::More; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
7
|
1
|
|
|
1
|
|
373
|
use Data::Dumper; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
159
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub setup : Test(setup) |
10
|
|
|
|
|
|
|
{ |
11
|
4
|
|
|
4
|
0
|
2095
|
my ($self) = @_; |
12
|
4
|
|
|
|
|
41
|
$self->{accessor} = OOP::Perlish::Class::Accessor->new( type => 'CODE', name => 'test', self => bless({}, __PACKAGE__) ); |
13
|
1
|
|
|
1
|
|
9
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub set_value : Test |
16
|
|
|
|
|
|
|
{ |
17
|
1
|
|
|
1
|
0
|
142
|
my ($self) = @_; |
18
|
1
|
|
|
0
|
|
6
|
my $coderef = sub { return; }; |
|
0
|
|
|
|
|
0
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
5
|
$self->{accessor}->value( $coderef ); |
21
|
1
|
|
|
|
|
7
|
is( $self->{accessor}->value(), $coderef, 'can set coderef' ); |
22
|
1
|
|
|
1
|
|
351
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub negative_set_value : Test |
25
|
|
|
|
|
|
|
{ |
26
|
1
|
|
|
1
|
0
|
166
|
my ($self) = @_; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
3
|
my $coderef = 'foo'; |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
7
|
$self->{accessor}->value( $coderef ); |
31
|
1
|
|
|
|
|
7
|
ok( ! $self->{accessor}->value(), 'negative assert: cannot set non-coderef' ); |
32
|
1
|
|
|
1
|
|
264
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub returned_coderef_executable : Test |
35
|
|
|
|
|
|
|
{ |
36
|
1
|
|
|
1
|
0
|
141
|
my ($self) = @_; |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
1
|
|
5
|
my $coderef = sub { return 'Foo'; }; |
|
1
|
|
|
|
|
7
|
|
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
6
|
$self->{accessor}->value( $coderef ); |
41
|
1
|
|
|
|
|
6
|
is( $self->{accessor}->value()->(), 'Foo', 'can set coderef' ); |
42
|
1
|
|
|
1
|
|
250
|
} |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub unset_value : Test |
45
|
|
|
|
|
|
|
{ |
46
|
1
|
|
|
1
|
0
|
145
|
my ($self) = @_; |
47
|
1
|
|
|
|
|
7
|
my $undef = $self->{accessor}->value(); |
48
|
1
|
50
|
|
|
|
8
|
ok( ! $undef, 'when nothing has been defined, we get undef for scalar' ) || diag(Dumper($undef)); |
49
|
1
|
|
|
1
|
|
302
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
=head1 NAME |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 VERSION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 SYNOPSIS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 AUTHOR |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Jamie Beverly, C<< >> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 BUGS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, |
67
|
|
|
|
|
|
|
or through |
68
|
|
|
|
|
|
|
the web interface at |
69
|
|
|
|
|
|
|
L. I will be |
70
|
|
|
|
|
|
|
notified, and then you'll |
71
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 SUPPORT |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
perldoc OOP::Perlish::Class |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
You can also look for information at: |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=over 4 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
L |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
L |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * CPAN Ratings |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
L |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * Search CPAN |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
L |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=back |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Copyright 2009 Jamie Beverly |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
110
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
111
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |