From 497f272c125a5ad52600182336a02bb8704793d8 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Thu, 17 Nov 2011 18:46:13 +0000 Subject: [PATCH] Refactored reset_state() into t/util.pm --- t/cleanup_invalid_links.t | 10 ---------- t/examples.t | 10 ---------- t/stow_contents.t | 10 ---------- t/unstow_contents.t | 10 ---------- t/unstow_contents_orig.t | 10 ---------- t/util.pm | 18 ++++++++++++++++++ 6 files changed, 18 insertions(+), 50 deletions(-) diff --git a/t/cleanup_invalid_links.t b/t/cleanup_invalid_links.t index 92741cc..d8fb839 100755 --- a/t/cleanup_invalid_links.t +++ b/t/cleanup_invalid_links.t @@ -10,16 +10,6 @@ BEGIN { use lib qw(.); require "t/util.pm"; require "stow"; } use Test::More tests => 3; use English qw(-no_match_vars); -# local utility -sub reset_state { - @Tasks = (); - @Conflicts = (); - %Link_Task_For = (); - %Dir_Task_For = (); - %Option = (); - return; -} - ### setup eval { remove_dir('t/target'); }; eval { remove_dir('t/stow'); }; diff --git a/t/examples.t b/t/examples.t index ec90cef..4a8b9ec 100755 --- a/t/examples.t +++ b/t/examples.t @@ -10,16 +10,6 @@ BEGIN { use lib qw(.); require "t/util.pm"; require "stow"; } use Test::More tests => 4; use English qw(-no_match_vars); -# local utility -sub reset_state { - @Tasks = (); - @Conflicts = (); - %Link_Task_For = (); - %Dir_Task_For = (); - %Option = (); - return; -} - ### setup eval { remove_dir('t/target'); }; make_dir('t/target/stow'); diff --git a/t/stow_contents.t b/t/stow_contents.t index 97645c2..d589844 100755 --- a/t/stow_contents.t +++ b/t/stow_contents.t @@ -11,16 +11,6 @@ use Test::More tests => 14; use Test::Output; use English qw(-no_match_vars); -# local utility -sub reset_state { - @Tasks = (); - @Conflicts = (); - %Link_Task_For = (); - %Dir_Task_For = (); - %Option = (); - return; -} - ### setup eval { remove_dir('t/target'); }; eval { remove_dir('t/stow'); }; diff --git a/t/unstow_contents.t b/t/unstow_contents.t index 817f544..f37d15e 100755 --- a/t/unstow_contents.t +++ b/t/unstow_contents.t @@ -11,16 +11,6 @@ use Test::More tests => 14; use Test::Output; use English qw(-no_match_vars); -# local utility -sub reset_state { - @Tasks = (); - @Conflicts = (); - %Link_Task_For = (); - %Dir_Task_For = (); - %Option = (); - return; -} - ### setup eval { remove_dir('t/target'); }; eval { remove_dir('t/stow'); }; diff --git a/t/unstow_contents_orig.t b/t/unstow_contents_orig.t index ebed239..612bcbf 100755 --- a/t/unstow_contents_orig.t +++ b/t/unstow_contents_orig.t @@ -11,16 +11,6 @@ use Test::More tests => 14; use Test::Output; use English qw(-no_match_vars); -# local utility -sub reset_state { - @Tasks = (); - @Conflicts = (); - %Link_Task_For = (); - %Dir_Task_For = (); - %Option = (); - return; -} - ### setup eval { remove_dir('t/target'); }; eval { remove_dir('t/stow'); }; diff --git a/t/util.pm b/t/util.pm index ff74161..0beade9 100755 --- a/t/util.pm +++ b/t/util.pm @@ -7,6 +7,24 @@ use strict; 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 =========================================================== # Name : make_link() # Purpose : safely create a link