这是我的代码:
my $self = shift;
my $h = shift;
print "$h\n";
my @headers = split /,/, $h;
foreach my $el (@{$expected}) {
my $t = shift @headers;
chomp ($t);
chomp ($el);
print Dumper($el cmp $t, $el, $t);
print "test: \'$el\' eq \'$t\' ";
unless ($el eq $t) {
print "not ok $el ne $t\n";
return 0;
} else {
print "ok\n";
}
}
return 1;
Run Code Online (Sandbox Code Playgroud)
在我的第一个单元测试中,我将一个字符串传递给 $h,该字符串与 $expected 匹配。然后我有一个单元测试,它确保函数在传递不匹配的字符串时失败。这两个测试的行为符合预期。
服务器、Jira 项目、问题类型、摘要、描述、受托人、标签、Epic 链接
$VAR1 = 0;
$VAR2 = '服务器';
$VAR3 = …