I have a module that I wrote with some utility functions.
One of the functions is just a usage statement (recommended by user @zdim)
use 5.008_008;
use strict;
use warnings;
# Function Name: 'usage'
# Function Inputs: 'none'
# Function Returns: 'none'
# Function Description: 'Prints usage on STDERR, for when invalid options are passed'
sub usage ## no critic qw(RequireArgUnpacking)
{
require File::Basename;
my $PROG = File::Basename::basename($0);
for (@_)
{
print {*STDERR} $_;
}
print {*STDERR} "Try $PROG --help for more information.\n";
exit 1;
}
I know the subroutine works as expected, and it's simple enough to test, but... For coverage reports, I'd like to include it in my unit tests.
Is there any way to test it using Test::More
?