File Coverage

blib/lib/Data/Rx/CoreType/one.pm
Criterion Covered Total %
statement 15 15 100.0
branch 4 4 100.0
condition 5 6 83.3
subroutine 5 5 100.0
pod 0 2 0.0
total 29 32 90.6


line stmt bran cond sub pod time code
1 1     1   3 use strict;
  1         2  
  1         73  
2 1     1   4 use warnings;
  1         1  
  1         32  
3             package Data::Rx::CoreType::one;
4             # ABSTRACT: the Rx //one type
5             $Data::Rx::CoreType::one::VERSION = '0.200007';
6 1     1   3 use parent 'Data::Rx::CoreType';
  1         0  
  1         4  
7              
8             sub assert_valid {
9 54     54 0 6923 my ($self, $value) = @_;
10              
11 54 100       106 if (! defined $value) {
12 1         6 $self->fail({
13             error => [ qw(type) ],
14             message => "found value is undef",
15             value => $value,
16             });
17             }
18              
19             return 1 unless ref $value and ! (
20             eval { $value->isa('JSON::XS::Boolean') }
21             or
22             eval { $value->isa('JSON::PP::Boolean') }
23             or
24 53 100 66     115 eval { $value->isa('boolean') }
      100        
25             );
26              
27 26         141 $self->fail({
28             error => [ qw(type) ],
29             message => "found value is a reference/container type",
30             value => $value,
31             });
32             }
33              
34 54     54 0 112 sub subname { 'one' }
35              
36             1;
37              
38             __END__