我能够编写单元测试test_case.t
为Perl模块ModuleOne.pm
如何编写单元测试用例Perl脚本
test_case.t
use strict;
use warnings;
use Test::More;
use Test::Cmd;
use ModuleOne; # Included the module here
my $ret = ModuleOne::methodone(args);
is($ret->{val}, 1, "Checking return value"); # success
我想要的实现同一单元测试用例一个perl脚本script_one.pl
script_one.pl
use strict;
use warnings;
use ModuleOne;
my $NAME;
my $ID;
# get parameters
GetOptions (
"name" => \$NAME,
"emp_id" => \$ID,
)
validate_params();
sub validate_params {
# this method will validate params
}
sub print_name {
# this method will print name
}
我怎么能包括test_case.t
本perl的文件script_one.pl
和编写测试用例的方法validate_params
和print_name
?