Skip to content

Commit

Permalink
Add test for using needs with nested modules (ref RexOps#1188)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferki authored and alip committed Aug 10, 2020
1 parent 869e22b commit 2821543
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion t/needs.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,34 @@ use Rex::Commands;
1;
}

{
package Nested::Module;

use strict;
use warnings;

use Rex::Commands;

task "test", sub {
open( my $fh, ">", "test.txt" );
close($fh);
};
}

{
package Rex::Module;

use strict;
use warnings;

use Rex::Commands;

task "test", sub {
open( my $fh, ">", "test.txt" );
close($fh);
};
}

task "test", sub {
needs MyTest;

Expand Down Expand Up @@ -62,9 +90,31 @@ task "test4", sub {
close($fh);
};

task "test5", sub {
needs Nested::Module "test";

if ( -f "test.txt" ) {
unlink("test.txt");
return 1;
}

die;
};

task "test6", sub {
needs Rex::Module "test";

if ( -f "test.txt" ) {
unlink("test.txt");
return 1;
}

die;
};

my $task_list = Rex::TaskList->create;
my $run_list = Rex::RunList->instance;
$run_list->parse_opts(qw/test test2 test3/);
$run_list->parse_opts(qw/test test2 test3 test5 test6/);

for my $task ( $run_list->tasks ) {
$task_list->run($task);
Expand Down

0 comments on commit 2821543

Please sign in to comment.