我能够test_case.t
为 Perl 模块编写单元测试ModuleOne.pm
测试用例.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
}
如何包含这个 perl 文件并script_one.pl
为方法和test_case.t
编写测试用例?validate_params
print_name