| 1 | package Test::Class::Moose::Role::CLI; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | # ABSTRACT: Role for command line argument handling and extra CLI features | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 1 | ▶ | use 5.010000; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 1 | our $VERSION = '1.00'; | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 1 | ▶ | use Moose::Role 2.0000; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | 1 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 1 | ▶ | use File::Find qw( find ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | 1 | ▶ | use JSON::MaybeXS qw( encode_json ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 1 | ▶ | use Module::Runtime qw( use_package_optimistically ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | 1 | ▶ | use Module::Util qw( fs_path_to_module ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 20 | 1 | ▶ | use MooseX::Getopt 0.71; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | 1 | ▶ | use Test::Class::Moose::Runner; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | has classes => ( | ||||||||||||||||||||
| 24 | is => 'ro', | ||||||||||||||||||||
| 25 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||
| 26 | 9 | ▶ | default => sub { [] }, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 27 | 1 | ); | |||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | has methods => ( | ||||||||||||||||||||
| 30 | traits => ['Array'], | ||||||||||||||||||||
| 31 | is => 'ro', | ||||||||||||||||||||
| 32 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||
| 33 | 14 | ▶ | default => sub { [] }, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 34 | 1 | handles => { | |||||||||||||||||||
| 35 | _has_methods => 'count', | ||||||||||||||||||||
| 36 | }, | ||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | has exclude_methods => ( | ||||||||||||||||||||
| 40 | traits => ['Array'], | ||||||||||||||||||||
| 41 | is => 'ro', | ||||||||||||||||||||
| 42 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||
| 43 | 14 | ▶ | default => sub { [] }, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 44 | 1 | handles => { | |||||||||||||||||||
| 45 | _has_exclude_methods => 'count', | ||||||||||||||||||||
| 46 | }, | ||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | has tags => ( | ||||||||||||||||||||
| 50 | traits => ['Array'], | ||||||||||||||||||||
| 51 | is => 'ro', | ||||||||||||||||||||
| 52 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||
| 53 | 14 | ▶ | default => sub { [] }, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 54 | 1 | handles => { | |||||||||||||||||||
| 55 | _has_tags => 'count', | ||||||||||||||||||||
| 56 | }, | ||||||||||||||||||||
| 57 | ); | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | has test_lib_dirs => ( | ||||||||||||||||||||
| 60 | traits => ['Array'], | ||||||||||||||||||||
| 61 | is => 'ro', | ||||||||||||||||||||
| 62 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||
| 63 | 13 | ▶ | default => sub { ['t/lib'] }, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 64 | 1 | handles => { | |||||||||||||||||||
| 65 | _all_test_lib_dirs => 'elements', | ||||||||||||||||||||
| 66 | _has_test_lib_dirs => 'count', | ||||||||||||||||||||
| 67 | }, | ||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | has exclude_tags => ( | ||||||||||||||||||||
| 71 | traits => ['Array'], | ||||||||||||||||||||
| 72 | is => 'ro', | ||||||||||||||||||||
| 73 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||
| 74 | 15 | ▶ | default => sub { [] }, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 75 | 1 | handles => { | |||||||||||||||||||
| 76 | _has_exclude_tags => 'count', | ||||||||||||||||||||
| 77 | }, | ||||||||||||||||||||
| 78 | ); | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | 1 | has parallel_progress => ( | |||||||||||||||||||
| 81 | is => 'ro', | ||||||||||||||||||||
| 82 | isa => 'Bool', | ||||||||||||||||||||
| 83 | predicate => '_has_parallel_progress', | ||||||||||||||||||||
| 84 | ); | ||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | 1 | has color => ( | |||||||||||||||||||
| 87 | is => 'ro', | ||||||||||||||||||||
| 88 | isa => 'Bool', | ||||||||||||||||||||
| 89 | predicate => '_has_color', | ||||||||||||||||||||
| 90 | ); | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | 1 | has jobs => ( | |||||||||||||||||||
| 93 | is => 'ro', | ||||||||||||||||||||
| 94 | isa => 'Int', | ||||||||||||||||||||
| 95 | predicate => '_has_jobs', | ||||||||||||||||||||
| 96 | ); | ||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | 1 | has randomize_methods => ( | |||||||||||||||||||
| 99 | is => 'ro', | ||||||||||||||||||||
| 100 | isa => 'Bool', | ||||||||||||||||||||
| 101 | predicate => '_has_randomize_methods', | ||||||||||||||||||||
| 102 | ); | ||||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | 1 | has randomize_classes => ( | |||||||||||||||||||
| 105 | is => 'ro', | ||||||||||||||||||||
| 106 | isa => 'Bool', | ||||||||||||||||||||
| 107 | predicate => '_has_randomize_classes', | ||||||||||||||||||||
| 108 | ); | ||||||||||||||||||||
| 109 | |||||||||||||||||||||
| 110 | 1 | has set_process_name => ( | |||||||||||||||||||
| 111 | is => 'ro', | ||||||||||||||||||||
| 112 | isa => 'Bool', | ||||||||||||||||||||
| 113 | predicate => '_has_set_process_name', | ||||||||||||||||||||
| 114 | ); | ||||||||||||||||||||
| 115 | |||||||||||||||||||||
| 116 | 1 | has statistics => ( | |||||||||||||||||||
| 117 | is => 'ro', | ||||||||||||||||||||
| 118 | isa => 'Bool', | ||||||||||||||||||||
| 119 | predicate => '_has_statistics', | ||||||||||||||||||||
| 120 | ); | ||||||||||||||||||||
| 121 | |||||||||||||||||||||
| 122 | 1 | has show_timing => ( | |||||||||||||||||||
| 123 | is => 'ro', | ||||||||||||||||||||
| 124 | isa => 'Bool', | ||||||||||||||||||||
| 125 | predicate => '_has_show_timing', | ||||||||||||||||||||
| 126 | ); | ||||||||||||||||||||
| 127 | |||||||||||||||||||||
| 128 | 1 | has use_environment => ( | |||||||||||||||||||
| 129 | is => 'ro', | ||||||||||||||||||||
| 130 | isa => 'Bool', | ||||||||||||||||||||
| 131 | predicate => '_has_use_environment', | ||||||||||||||||||||
| 132 | ); | ||||||||||||||||||||
| 133 | |||||||||||||||||||||
| 134 | 1 | has _runner_class => ( | |||||||||||||||||||
| 135 | is => 'ro', | ||||||||||||||||||||
| 136 | isa => 'ClassName', | ||||||||||||||||||||
| 137 | init_arg => 'runner_class', | ||||||||||||||||||||
| 138 | default => 'Test::Class::Moose::Runner', | ||||||||||||||||||||
| 139 | ); | ||||||||||||||||||||
| 140 | |||||||||||||||||||||
| 141 | 1 | has _timing_data_file => ( | |||||||||||||||||||
| 142 | is => 'ro', | ||||||||||||||||||||
| 143 | isa => 'Str', | ||||||||||||||||||||
| 144 | init_arg => 'timing_data_file', | ||||||||||||||||||||
| 145 | predicate => '_has_timing_data_file', | ||||||||||||||||||||
| 146 | ); | ||||||||||||||||||||
| 147 | |||||||||||||||||||||
| 148 | has _start_time => ( | ||||||||||||||||||||
| 149 | is => 'ro', | ||||||||||||||||||||
| 150 | isa => 'Int', | ||||||||||||||||||||
| 151 | init_arg => undef, | ||||||||||||||||||||
| 152 | 15 | ▶ | default => sub {time}, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 153 | 1 | ); | |||||||||||||||||||
| 154 | |||||||||||||||||||||
| 155 | 1 | has _runner => ( | |||||||||||||||||||
| 156 | is => 'ro', | ||||||||||||||||||||
| 157 | init_arg => undef, | ||||||||||||||||||||
| 158 | lazy => 1, | ||||||||||||||||||||
| 159 | builder => '_build_runner', | ||||||||||||||||||||
| 160 | ); | ||||||||||||||||||||
| 161 | |||||||||||||||||||||
| 162 | 1 | has _class_names => ( | |||||||||||||||||||
| 163 | traits => ['Array'], | ||||||||||||||||||||
| 164 | is => 'ro', | ||||||||||||||||||||
| 165 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||
| 166 | init_arg => undef, | ||||||||||||||||||||
| 167 | lazy => 1, | ||||||||||||||||||||
| 168 | builder => '_build_class_names', | ||||||||||||||||||||
| 169 | handles => { | ||||||||||||||||||||
| 170 | _has_class_names => 'count', | ||||||||||||||||||||
| 171 | }, | ||||||||||||||||||||
| 172 | ); | ||||||||||||||||||||
| 173 | |||||||||||||||||||||
| 174 | 1 | with 'MooseX::Getopt::Dashes'; | |||||||||||||||||||
| 175 | |||||||||||||||||||||
| 176 | 12 | ▶ | sub run { | ||||||||||||||||||
|
Subroutine
run: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 177 | 12 | my $self = shift; | |||||||||||||||||||
| 178 | |||||||||||||||||||||
| 179 | 12 | $self->_before_run; | |||||||||||||||||||
| 180 | 12 | $self->_load_classes; | |||||||||||||||||||
| 181 | 12 | $self->_runner->runtests; | |||||||||||||||||||
| 182 | 12 | $self->_after_run; | |||||||||||||||||||
| 183 | 12 | $self->_maybe_save_timing_data; | |||||||||||||||||||
| 184 | |||||||||||||||||||||
| 185 | 12 | return $self->_runner; | |||||||||||||||||||
| 186 | } | ||||||||||||||||||||
| 187 | |||||||||||||||||||||
| 188 | 11 | ▶ | sub _before_run { } | ||||||||||||||||||
|
Subroutine
_before_run: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 189 | |||||||||||||||||||||
| 190 | 11 | ▶ | sub _load_classes { | ||||||||||||||||||
|
Subroutine
_load_classes: called CC=3 SCAR=11.0
| |||||||||||||||||||||
| 191 | 11 | my $self = shift; | |||||||||||||||||||
| 192 | |||||||||||||||||||||
| 193 | 11 | ▶ | if ( $self->_has_class_names ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 194 | 2 | local @INC = ( $self->_test_lib_dirs, @INC ); | |||||||||||||||||||
| 195 | 2 | use_package_optimistically($_) for @{ $self->_class_names }; | |||||||||||||||||||
| 196 | } | ||||||||||||||||||||
| 197 | else { | ||||||||||||||||||||
| 198 | 9 | require Test::Class::Moose::Load; | |||||||||||||||||||
| 199 | 9 | Test::Class::Moose::Load->import( $self->_test_lib_dirs ); | |||||||||||||||||||
| 200 | } | ||||||||||||||||||||
| 201 | |||||||||||||||||||||
| 202 | 11 | return; | |||||||||||||||||||
| 203 | } | ||||||||||||||||||||
| 204 | |||||||||||||||||||||
| 205 | 11 | ▶ | sub _after_run { } | ||||||||||||||||||
|
Subroutine
_after_run: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 206 | |||||||||||||||||||||
| 207 | { | ||||||||||||||||||||
| 208 | 1 | my $meta = __PACKAGE__->meta; | |||||||||||||||||||
| 209 | 14 | my %attr_map = map { $_ => $_ } | |||||||||||||||||||
| 210 | 18 | grep { $meta->get_attribute($_)->original_role->name eq __PACKAGE__ } | |||||||||||||||||||
| 211 | 1 | ▶ | grep { !/^_/ && $_ ne 'classes' } $meta->get_attribute_list; | ||||||||||||||||||
|
Condition100%3/3
!/^_/ && $_ ne 'classes'
MC/DC100%2/2
!/^_/ && $_ ne 'classes'
!/^_/
$_ ne 'classes'
Truth table100%3/3
not(A) && B
A= !/^_/B= $_ ne 'classes'
| |||||||||||||||||||||
| 212 | 1 | $attr_map{randomize_methods} = 'randomize'; | |||||||||||||||||||
| 213 | 1 | $attr_map{tags} = 'include_tags'; | |||||||||||||||||||
| 214 | 1 | $attr_map{color} = 'color_output'; | |||||||||||||||||||
| 215 | 1 | $attr_map{parallel_progress} = 'show_parallel_progress'; | |||||||||||||||||||
| 216 | |||||||||||||||||||||
| 217 | 12 | ▶ | sub _build_runner { | ||||||||||||||||||
|
Subroutine
_build_runner: called CC=6 SCAR=17.9
| |||||||||||||||||||||
| 218 | 12 | my $self = shift; | |||||||||||||||||||
| 219 | |||||||||||||||||||||
| 220 | 12 | my %args; | |||||||||||||||||||
| 221 | 12 | for my $attr ( keys %attr_map ) { | |||||||||||||||||||
| 222 | 168 | my $pred = '_has_' . $attr; | |||||||||||||||||||
| 223 | 168 | ▶ | next unless $self->$pred(); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 224 | |||||||||||||||||||||
| 225 | 18 | $args{ $attr_map{$attr} } = $self->$attr; | |||||||||||||||||||
| 226 | } | ||||||||||||||||||||
| 227 | |||||||||||||||||||||
| 228 | 12 | ▶ | if ( $self->_has_class_names ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 229 | 3 | $args{test_classes} = $self->_class_names; | |||||||||||||||||||
| 230 | } | ||||||||||||||||||||
| 231 | |||||||||||||||||||||
| 232 | 12 | ▶ | if ( $args{methods} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 233 | my $re = join '|', | ||||||||||||||||||||
| 234 | 1 | map { quotemeta($_) } @{ delete $args{methods} }; | |||||||||||||||||||
| 235 | 1 | $args{include} = qr/^(?:$re)$/; | |||||||||||||||||||
| 236 | } | ||||||||||||||||||||
| 237 | |||||||||||||||||||||
| 238 | 12 | ▶ | if ( $args{exclude_methods} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 239 | my $re = join '|', | ||||||||||||||||||||
| 240 | 1 | map { quotemeta($_) } @{ delete $args{exclude_methods} }; | |||||||||||||||||||
| 241 | 1 | $args{exclude} = qr/^(?:$re)$/; | |||||||||||||||||||
| 242 | } | ||||||||||||||||||||
| 243 | |||||||||||||||||||||
| 244 | 12 | use_package_optimistically( $self->_runner_class ); | |||||||||||||||||||
| 245 | 12 | return $self->_runner_class->new(%args); | |||||||||||||||||||
| 246 | } | ||||||||||||||||||||
| 247 | } | ||||||||||||||||||||
| 248 | |||||||||||||||||||||
| 249 | 1 | ▶ | sub _build_class_names { | ||||||||||||||||||
|
Subroutine
_build_class_names: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 250 | 15 | my $self = shift; | |||||||||||||||||||
| 251 | |||||||||||||||||||||
| 252 | return [ | ||||||||||||||||||||
| 253 | 13 | map { $self->_munge_class($_) } | |||||||||||||||||||
| 254 | 15 | map { $self->_maybe_resolve_path($_) } @{ $self->classes } | |||||||||||||||||||
| 255 | ]; | ||||||||||||||||||||
| 256 | } | ||||||||||||||||||||
| 257 | |||||||||||||||||||||
| 258 | 9 | ▶ | sub _munge_class { $_[1] } | ||||||||||||||||||
|
Subroutine
_munge_class: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 259 | |||||||||||||||||||||
| 260 | 12 | ▶ | sub _maybe_resolve_path { | ||||||||||||||||||
|
Subroutine
_maybe_resolve_path: called CC=5 SCAR=16.1
| |||||||||||||||||||||
| 261 | 12 | my $self = shift; | |||||||||||||||||||
| 262 | 12 | my $path = shift; | |||||||||||||||||||
| 263 | |||||||||||||||||||||
| 264 | 12 | ▶ | if ( -d $path ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 265 | 1 | return $self->_find_classes($path); | |||||||||||||||||||
| 266 | } | ||||||||||||||||||||
| 267 | |||||||||||||||||||||
| 268 | 11 | ▶ | if ( $path =~ /\.pm$/ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 269 | 5 | for my $dir ( $self->_test_lib_dirs ) { | |||||||||||||||||||
| 270 | 6 | ▶ | if ( $path =~ s{^.*\Q$dir}{} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 271 | 5 | return fs_path_to_module($path); | |||||||||||||||||||
| 272 | } | ||||||||||||||||||||
| 273 | } | ||||||||||||||||||||
| 274 | } | ||||||||||||||||||||
| 275 | |||||||||||||||||||||
| 276 | 6 | return $path; | |||||||||||||||||||
| 277 | } | ||||||||||||||||||||
| 278 | |||||||||||||||||||||
| 279 | # This is still here to maintain backwards compatibility for people writing | ||||||||||||||||||||
| 280 | # custom test runners. In past releases the only way to customize this value | ||||||||||||||||||||
| 281 | # was to override this method, though we later added a CLI option to set this | ||||||||||||||||||||
| 282 | # value. | ||||||||||||||||||||
| 283 | 15 | ▶ | sub _test_lib_dirs { | ||||||||||||||||||
|
Subroutine
_test_lib_dirs: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 284 | 15 | my $self = shift; | |||||||||||||||||||
| 285 | 15 | return $self->_all_test_lib_dirs; | |||||||||||||||||||
| 286 | } | ||||||||||||||||||||
| 287 | |||||||||||||||||||||
| 288 | 1 | ▶ | sub _find_classes { | ||||||||||||||||||
|
Subroutine
_find_classes: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 289 | 1 | my $self = shift; | |||||||||||||||||||
| 290 | 1 | my $dir = shift; | |||||||||||||||||||
| 291 | |||||||||||||||||||||
| 292 | 1 | my @classes; | |||||||||||||||||||
| 293 | 3 | ▶ | my $finder = sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||
| 294 | 3 | ▶ | return unless /\.pm$/; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 295 | 2 | s{^.*\Q$dir}{}; | |||||||||||||||||||
| 296 | 2 | push @classes, fs_path_to_module($_); | |||||||||||||||||||
| 297 | 1 | }; | |||||||||||||||||||
| 298 | |||||||||||||||||||||
| 299 | 1 | find( | |||||||||||||||||||
| 300 | { wanted => $finder, | ||||||||||||||||||||
| 301 | no_chdir => 1, | ||||||||||||||||||||
| 302 | }, | ||||||||||||||||||||
| 303 | $dir | ||||||||||||||||||||
| 304 | ); | ||||||||||||||||||||
| 305 | |||||||||||||||||||||
| 306 | 1 | return @classes; | |||||||||||||||||||
| 307 | } | ||||||||||||||||||||
| 308 | |||||||||||||||||||||
| 309 | 12 | ▶ | sub _maybe_save_timing_data { | ||||||||||||||||||
|
Subroutine
_maybe_save_timing_data: called CC=5 SCAR=16.4
| |||||||||||||||||||||
| 310 | 12 | my $self = shift; | |||||||||||||||||||
| 311 | |||||||||||||||||||||
| 312 | 12 | ▶ | return unless $self->_has_timing_data_file; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 313 | |||||||||||||||||||||
| 314 | 1 | my $file = $self->_timing_data_file; | |||||||||||||||||||
| 315 | 1 | ▶ | open my $fh, '>', $file or die "Cannot write to $file: $!"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 316 | 1 | ▶ | print {$fh} encode_json( | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 317 | { process_name => $0, | ||||||||||||||||||||
| 318 | start_time => $self->_start_time, | ||||||||||||||||||||
| 319 | timing => $self->_runner->test_report->timing_data, | ||||||||||||||||||||
| 320 | } | ||||||||||||||||||||
| 321 | ) or die "Cannot write to $file: $!"; | ||||||||||||||||||||
| 322 | 1 | ▶ | close $fh or die "Cannot write to $file: $!"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 323 | |||||||||||||||||||||
| 324 | 1 | return; | |||||||||||||||||||
| 325 | } | ||||||||||||||||||||
| 326 | |||||||||||||||||||||
| 327 | 1 | 1; | |||||||||||||||||||
| 328 | |||||||||||||||||||||
| 329 | __END__ | ||||||||||||||||||||