仅报告 Test::More 中失败的测试

Report only failed tests in Test::More

我对随机生成的数据进行了大量检查。如何只获取失败测试的报告消息,如果检查正常则不显示任何内容?

您可以使用 fail 例程。在任何 Test::More 代码之外进行检查,并使用该结果来决定是否输出测试消息。

foreach my $element ( @randomly_generated_data ) {
    my $result = ...; # your checks here
    next if $result;
    fail( 'Some message' );
    }