Skip to content

Commit

Permalink
Add test for using needs with nested modules (ref #1188)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferki committed Jan 17, 2018
1 parent 13a6d6c commit 2e1f101
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion t/needs.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ use Rex::Commands;
1;
}

{
package Nested::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 +76,20 @@ task "test4", sub {
close($fh);
};

task "test5", sub {
needs Nested::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/);

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

0 comments on commit 2e1f101

Please sign in to comment.