File Coverage

blib/lib/Ukigumo/Helper.pm
Criterion Covered Total %
statement 15 22 68.1
branch 0 4 0.0
condition n/a
subroutine 5 8 62.5
pod 2 3 66.6
total 22 37 59.4


line stmt bran cond sub pod time code
1 1     1   3845 use strict;
  1         3  
  1         36  
2 1     1   5 use warnings;
  1         2  
  1         28  
3 1     1   1054 use utf8;
  1         10  
  1         5  
4              
5             package Ukigumo::Helper;
6 1     1   827 use parent qw(Exporter);
  1         318  
  1         5  
7 1     1   502 use Ukigumo::Constants;
  1         2  
  1         386  
8              
9             our @EXPORT = qw(status_str status_color normalize_path);
10              
11             sub status_str {
12 0     0 1   my $status = shift;
13             +{
14 0 0         STATUS_SUCCESS() => 'SUCCESS',
15             STATUS_FAIL() => 'FAIL',
16             STATUS_NA() => 'NA',
17             STATUS_SKIP() => 'SKIP',
18             STATUS_PENDING() => 'PENDING',
19             STATUS_TIMEOUT() => 'TIMEOUT',
20             }->{$status} || "Unknown: $status";
21             }
22              
23             sub status_color {
24 0     0 1   my $status = shift;
25             +{
26 0 0         STATUS_SUCCESS() => 'green',
27             STATUS_FAIL() => 'red',
28             STATUS_NA() => 'yellow',
29             STATUS_SKIP() => 'gray',
30             STATUS_PENDING() => 'yellow',
31             STATUS_TIMEOUT() => 'red',
32             }->{$status} || "cyan";
33             }
34              
35             sub normalize_path {
36 0     0 0   my $path = shift;
37 0           $path =~ s/[^a-zA-Z0-9-_]/_/g;
38 0           return $path;
39             }
40              
41             1;
42             __END__