Refactored reset_state() into t/util.pm

This commit is contained in:
Adam Spiers 2011-11-17 18:46:13 +00:00
parent aefaad37a4
commit 497f272c12
6 changed files with 18 additions and 50 deletions

View file

@ -10,16 +10,6 @@ BEGIN { use lib qw(.); require "t/util.pm"; require "stow"; }
use Test::More tests => 3; use Test::More tests => 3;
use English qw(-no_match_vars); use English qw(-no_match_vars);
# local utility
sub reset_state {
@Tasks = ();
@Conflicts = ();
%Link_Task_For = ();
%Dir_Task_For = ();
%Option = ();
return;
}
### setup ### setup
eval { remove_dir('t/target'); }; eval { remove_dir('t/target'); };
eval { remove_dir('t/stow'); }; eval { remove_dir('t/stow'); };

View file

@ -10,16 +10,6 @@ BEGIN { use lib qw(.); require "t/util.pm"; require "stow"; }
use Test::More tests => 4; use Test::More tests => 4;
use English qw(-no_match_vars); use English qw(-no_match_vars);
# local utility
sub reset_state {
@Tasks = ();
@Conflicts = ();
%Link_Task_For = ();
%Dir_Task_For = ();
%Option = ();
return;
}
### setup ### setup
eval { remove_dir('t/target'); }; eval { remove_dir('t/target'); };
make_dir('t/target/stow'); make_dir('t/target/stow');

View file

@ -11,16 +11,6 @@ use Test::More tests => 14;
use Test::Output; use Test::Output;
use English qw(-no_match_vars); use English qw(-no_match_vars);
# local utility
sub reset_state {
@Tasks = ();
@Conflicts = ();
%Link_Task_For = ();
%Dir_Task_For = ();
%Option = ();
return;
}
### setup ### setup
eval { remove_dir('t/target'); }; eval { remove_dir('t/target'); };
eval { remove_dir('t/stow'); }; eval { remove_dir('t/stow'); };

View file

@ -11,16 +11,6 @@ use Test::More tests => 14;
use Test::Output; use Test::Output;
use English qw(-no_match_vars); use English qw(-no_match_vars);
# local utility
sub reset_state {
@Tasks = ();
@Conflicts = ();
%Link_Task_For = ();
%Dir_Task_For = ();
%Option = ();
return;
}
### setup ### setup
eval { remove_dir('t/target'); }; eval { remove_dir('t/target'); };
eval { remove_dir('t/stow'); }; eval { remove_dir('t/stow'); };

View file

@ -11,16 +11,6 @@ use Test::More tests => 14;
use Test::Output; use Test::Output;
use English qw(-no_match_vars); use English qw(-no_match_vars);
# local utility
sub reset_state {
@Tasks = ();
@Conflicts = ();
%Link_Task_For = ();
%Dir_Task_For = ();
%Option = ();
return;
}
### setup ### setup
eval { remove_dir('t/target'); }; eval { remove_dir('t/target'); };
eval { remove_dir('t/stow'); }; eval { remove_dir('t/stow'); };

View file

@ -7,6 +7,24 @@
use strict; use strict;
use warnings; use warnings;
#===== SUBROUTINE ===========================================================
# Name : reset_state()
# Purpose : reset internal state machine
# Parameters: none
# Returns : n/a
# Throws : n/a
# Comments : none
#============================================================================
sub reset_state {
@::Tasks = ();
@::Conflicts = ();
%::Link_Task_For = ();
%::Dir_Task_For = ();
%::Option = ();
return;
}
#===== SUBROUTINE =========================================================== #===== SUBROUTINE ===========================================================
# Name : make_link() # Name : make_link()
# Purpose : safely create a link # Purpose : safely create a link