我正在比较的输出字符串是重复的,导致测试失败,但我不明白为什么。
这是我的测试文件:
t/68_template_test.t
t/68_template_test.t .. # 1
t/68_template_test.t .. 1/1
# Failed test at t/68_template_test.t line 45.
# got: 'This is string number one .This is string number one .'
# expected: 'This is string number one .'
# Looks like you failed 1 test of 1.
t/68_template_test.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests
以下是我测试失败的输出:
pool.join()
我似乎无法发现错误或弄清楚为什么会这样。
答案 0 :(得分:2)
有两次拨打$template->process(\$text, $vars, \$output)
。
我想你想要
my $rv = $template->process(\$text, $vars, \my $output);
ok($rv, "\$template->process ran successfully")
and note($rv)
or diag($template->error());
is($output, $expected_output, "\$template->process produced correct output");