File Coverage

blib/lib/OOP/Perlish/Class/Accessor/UnitTests/Glob.pm
Criterion Covered Total %
statement 40 40 100.0
branch n/a
condition n/a
subroutine 13 13 100.0
pod 0 4 0.0
total 53 57 92.9


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