Class/Accessor/UnitTests/ArrayRef.pm

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