File Coverage

blib/lib/Bat/Interpreter/Delegate/Executor/PartialDryRunner.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 3 3 100.0
total 33 33 100.0


line stmt bran cond sub pod time code
1             package Bat::Interpreter::Delegate::Executor::PartialDryRunner;
2              
3 23     23   153 use utf8;
  23         50  
  23         121  
4              
5 23     23   684 use Moo;
  23         49  
  23         128  
6 23     23   6827 use Types::Standard qw(ArrayRef);
  23         55  
  23         248  
7 23     23   13520 use namespace::autoclean;
  23         56  
  23         467  
8              
9             with 'Bat::Interpreter::Role::Executor';
10              
11             our $VERSION = '0.023'; # VERSION
12              
13             has 'commands_executed' => ( is => 'ro',
14             isa => ArrayRef,
15             default => sub { [] },
16             );
17              
18             sub add_command {
19 29     29 1 59 push @{ shift->commands_executed }, @_;
  29         157  
20             }
21              
22             sub execute_command {
23 29     29 1 310 my $self = shift();
24 29         67 my $command = shift();
25 29         121 $self->add_command($command);
26 29         72 return 0;
27             }
28              
29             sub execute_for_command {
30 1     1 1 9 my $self = shift();
31 1         3 my $command = shift();
32 1         8783 my $output = `$command`;
33 1         26 chomp $output;
34 1         72 return $output;
35             }
36              
37             1;
38              
39             __END__