如何检查上次测试是否失败?

How to check that last test is failed?

我通过 Test2::V0

测试我的代码
is $result, 'value', 'Test OK';

我可以检查上次测试是否失败吗?

以mojolicious为例,有->or(sub{ ... })

Test2::V0有类似的东西吗?

测试函数有 return 个值 -- 真值或假值取决于测试的结果 -- 可以被捕获或检查。

if (! is $result, 'value', 'Test Ok') {
    warn "Test 42 failed. Skip test 43\n";
}

is $result, 'value', 'Test Ok'
    or warn "Test 42 failed. Skip test 43\n";

$z1 = is $result1, 'value1';
$z2 = is $result2, 'value2';
$z3 = is $result3, 'value3';
if (!!$z1 + !!$z2 + !!$z3 >= 2) {
    print "At least two of the previous three tests passed!\n";
}