Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added parameter checking. #4

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/Rex/Hook/File/Impostor.pm
Expand Up @@ -36,6 +36,9 @@ sub copy_file {
sub get_impostor_for {
my $file = shift;

die "get_impostor_for(): need a valid filepath"
unless defined $file;

return File::Spec->catfile( get_impostor_dir(), basename($file) );
}

Expand Down
5 changes: 4 additions & 1 deletion t/module.t
Expand Up @@ -14,7 +14,10 @@ use Rex::Hook::File::Impostor;
use Test2::V0;
use Test::File 1.443;

plan tests => 9;
plan tests => 10;

eval { Rex::Hook::File::Impostor::get_impostor_for() };
like($@, qr/get_impostor_for\(\): need a valid filepath/);

my $original_file = File::Temp->new('original_XXXX')->filename();
my $impostor_file = Rex::Hook::File::Impostor::get_impostor_for($original_file);
Expand Down