Class/Accessor/UnitTests/ScalarRef.pm

filter: Statementstmt 100% 34 / 34 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 3 totaltotal 90.2% 46 / 51 CC 3 SCAR 2.9
CC
3
Cov
95%
get_value
2.0
cannot_mutate_reference
2.0
BEGIN
1.0
CRAP 1.3
« Class/UnitTests/Meta.pm ↑ Summary Class/Accessor/UnitTests/Constructor.pm »
1 {
2 package OOP::Perlish::Class::Accessor::UnitTests::ScalarRef;
3 1 ▶ use OOP::Perlish::Class::Accessor::UnitTests::Scalar;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶ use base qw(OOP::Perlish::Class::Accessor::UnitTests::Scalar);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶ use OOP::Perlish::Class::Accessor;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶ use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶ use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 8 ▶ sub setup : Test(setup)
Subroutine setup: called CC=1 SCAR=0.0
Pod undocumented
10 {
11 8 my ($self) = @_;
12 8 $self->{accessor} = OOP::Perlish::Class::Accessor->new( type => 'SCALARREF', name => 'test', self => bless({}, __PACKAGE__) );
13 1 ▶ }
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 sub get_value
16 9 ▶ {
Subroutine get_value: called CC=2 SCAR=7.1
Pod undocumented
17 9 my ($self) = @_;
18 9 ▶ return ${ $self->{accessor}->value() } if(ref($self->{accessor}->value()) eq 'SCALAR');
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->{"accessor"}->value eq "SCALAR" 9 0 9
19 }
20  
21 1 ▶ sub cannot_mutate_reference : Test(1)
Subroutine cannot_mutate_reference: called CC=2 SCAR=7.0
Pod undocumented
22 {
23 1 my ($self) = @_;
24  
25 1 $self->{accessor}->value('quux');
26 1 ${ $self->{accessor}->value() } = 'bar';
27 1 ▶ is( ${ $self->{accessor}->value() }, 'quux', 'cannot mutate instance reference' ) || diag(Dumper($self->{accessor}->value()));
Branch: 1 branch
BranchTrueFalseTotal
&is(${$self->{"accessor"}->value;}, "quux", "cannot mutate instance reference") or diag(Dumper($self->{"accessor"}->value)) 1 0 1
28 1 ▶ }
Subroutine BEGIN: called CC=1 SCAR=0.0
29 }
30 1 1;
31 =head1 NAME
32  
33 =head1 VERSION
34  
35 =head1 SYNOPSIS
36  
37 =head1 METHODS
38  
39 =head1 AUTHOR
40  
41 Jamie Beverly, C<< <jbeverly at cpan.org> >>
42  
43 =head1 BUGS
44  
45 Please report any bugs or feature requests to C<bug-foo-bar at rt.cpan.org>,
46 or through
47 the web interface at
48 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=OOP-Perlish-Class>. I will be
49 notified, and then you'll
50 automatically be notified of progress on your bug as I make changes.
51  
52 =head1 SUPPORT
53  
54 You can find documentation for this module with the perldoc command.
55  
56 perldoc OOP::Perlish::Class
57  
58  
59 You can also look for information at:
60  
61 =over 4
62  
63 =item * RT: CPAN's request tracker
64  
65 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=OOP-Perlish-Class>
66  
67 =item * AnnoCPAN: Annotated CPAN documentation
68  
69 L<http://annocpan.org/dist/OOP-Perlish-Class>
70  
71 =item * CPAN Ratings
72  
73 L<http://cpanratings.perl.org/d/OOP-Perlish-Class>
74  
75 =item * Search CPAN
76  
77 L<http://search.cpan.org/dist/OOP-Perlish-Class/>
78  
79 =back
80  
81  
82 =head1 ACKNOWLEDGEMENTS
83  
84 =head1 COPYRIGHT & LICENSE
85  
86 Copyright 2009 Jamie Beverly
87  
88 This program is free software; you can redistribute it and/or modify it
89 under the terms of either: the GNU General Public License as published
90 by the Free Software Foundation; or the Artistic License.
91  
92 See http://dev.perl.org/licenses/ for more information.
93  
94 =cut
« Class/UnitTests/Meta.pm ↑ Summary Class/Accessor/UnitTests/Constructor.pm »