Skip to content

Commit

Permalink
extract setup_package_ignore() into testutil.pm
Browse files Browse the repository at this point in the history
  • Loading branch information
aspiers committed Sep 8, 2024
1 parent cfa1a11 commit 3ca1df5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 3 additions & 4 deletions t/ignore.t
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,9 @@ sub setup_package_local_list {
my ($stow_path, $package, $list) = @_;
my $package_path = join_paths($stow_path, $package);
make_path($package_path);
my $local_ignore = join_paths($package_path, $Stow::LOCAL_IGNORE_FILE);
make_file($local_ignore, $list);
$stow->invalidate_memoized_regexp($local_ignore);
return $local_ignore;
my $package_ignore = setup_package_ignore($package_path, $list);
$stow->invalidate_memoized_regexp($package_ignore);
return $package_ignore;
}

sub main {
Expand Down
9 changes: 8 additions & 1 deletion t/testutil.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ our @EXPORT = qw(
cd
new_Stow new_compat_Stow
make_path make_link make_invalid_link make_file
setup_global_ignore
setup_global_ignore setup_package_ignore
remove_dir remove_file remove_link
cat_file
is_link is_dir_not_symlink is_nonexistent_path
Expand Down Expand Up @@ -168,6 +168,13 @@ sub setup_global_ignore {
return $global_ignore_file;
}

sub setup_package_ignore {
my ($package_path, $contents) = @_;
my $package_ignore_file = join_paths($package_path, $Stow::LOCAL_IGNORE_FILE);
make_file($package_ignore_file, $contents);
return $package_ignore_file;
}

#===== SUBROUTINE ===========================================================
# Name : remove_link()
# Purpose : remove an esiting symbolic link
Expand Down

0 comments on commit 3ca1df5

Please sign in to comment.