| 1 | # | ||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||
| 3 | # | ||||||||||
| 4 | |||||||||||
| 5 | package Rex::Test; | ||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use v5.14.4; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Rex -base; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use Rex::Commands::Box; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 1 | require Rex::CLI; | |||||||||
| 13 | |||||||||||
| 14 | 1 | our $VERSION = '1.16.1'; # VERSION | |||||||||
| 15 | |||||||||||
| 16 | 1 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 1 | ▶ | use Rex::Shared::Var; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 1 | share qw(@exit); | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | Rex::CLI->add_exit( | ||||||||||
| 22 | 0 | ▶ | sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 23 | 0 | ▶ | if ( scalar @exit > 0 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | CORE::exit(1); | |||||||||
| 25 | } | ||||||||||
| 26 | } | ||||||||||
| 27 | 1 | ); | |||||||||
| 28 | |||||||||||
| 29 | 0 | ▶ | sub push_exit { | ||||||||
|
Subroutine
push_exit: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 30 | 0 | push @exit, shift; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 1 | desc 'Run tests specified with --test=testfile (default: t/*.t)'; | |||||||||
| 34 | 0 | ▶ | task run => make { | ||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||
| 35 | 0 | Rex::Logger::info("Running integration tests..."); | |||||||||
| 36 | |||||||||||
| 37 | 0 | my $parameters = shift; | |||||||||
| 38 | 0 | my @files; | |||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | LOCAL { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 41 | @files = | ||||||||||
| 42 | 0 | ▶ | defined $parameters->{test} ? glob( $parameters->{test} ) : glob('t/*.t'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | }; | |||||||||
| 44 | |||||||||||
| 45 | 0 | for my $file (@files) { | |||||||||
| 46 | 0 | Rex::Logger::info("Running test: $file."); | |||||||||
| 47 | 0 | do "./$file"; | |||||||||
| 48 | 0 | ▶ | Rex::Logger::info( "Error running $file: $@", "error" ) if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | } | ||||||||||
| 50 | 1 | }; | |||||||||
| 51 | |||||||||||
| 52 | 1 | 1; | |||||||||