File Coverage

blib/lib/WWW/Shopify/Liquid/Operator/Array.pm
Criterion Covered Total %
statement 18 22 81.8
branch 0 4 0.0
condition 0 9 0.0
subroutine 8 9 88.8
pod 0 4 0.0
total 26 48 54.1


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2 21     21   11169 use strict;
  21         38  
  21         841  
3 21     21   123 use warnings;
  21         31  
  21         783  
4              
5             package WWW::Shopify::Liquid::Operator::Array;
6 21     21   104 use base 'WWW::Shopify::Liquid::Operator';
  21         29  
  21         1663  
7 21     21   113 use List::Util qw(first);
  21         29  
  21         1581  
8 21     21   119 use Scalar::Util qw(looks_like_number);
  21         38  
  21         4042  
9 291     291 0 715 sub symbol { return '..'; }
10 644     644 0 999 sub priority { return 7; }
11             sub operate {
12 0     0 0 0 my ($self, $hash, $type, $op1, $op2) = @_;
13 0 0 0     0 die new WWW::Shopify::Liquid::Exception::Renderer::Arguments($self, "Both operands must be integers.") unless $op1 && $op2 && looks_like_number($op1) && looks_like_number($op2);
      0        
      0        
14 0 0       0 die new WWW::Shopify::Liquid::Exception::Renderer::Arguments($self, "Array generation operands are too large.") if ($op2 - $op1) > 1000;
15 0         0 return [$op1..$op2];
16             }
17 1     1 0 11 sub requires_grouping { return 1; }
18              
19             1;