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 25     25   188 use utf8;
  25         69  
  25         143  
4              
5 25     25   805 use Moo;
  25         78  
  25         161  
6 25     25   8441 use Types::Standard qw(ArrayRef);
  25         66  
  25         349  
7 25     25   16827 use namespace::autoclean;
  25         76  
  25         577  
8              
9             with 'Bat::Interpreter::Role::Executor';
10              
11             our $VERSION = '0.025'; # VERSION
12              
13             has 'commands_executed' => ( is => 'ro',
14             isa => ArrayRef,
15             default => sub { [] },
16             );
17              
18             sub add_command {
19 33     33 1 71 push @{ shift->commands_executed }, @_;
  33         206  
20             }
21              
22             sub execute_command {
23 33     33 1 402 my $self = shift();
24 33         78 my $command = shift();
25 33         146 $self->add_command($command);
26 33         97 return 0;
27             }
28              
29             sub execute_for_command {
30 1     1 1 9 my $self = shift();
31 1         2 my $command = shift();
32 1         8667 my $output = `$command`;
33 1         22 chomp $output;
34 1         60 return $output;
35             }
36              
37             1;
38              
39             __END__