gpt4 book ai didi

windows - 如果 Windows,如何跳过子测试中的所有测试?

转载 作者:可可西里 更新时间:2023-11-01 11:22:03 26 4
gpt4 key购买 nike

我试过了,好像不行

subtest 'catalyst scripts that should be executable' => sub {
plan({ skip_all => 'skip failing executable tests on windows' }) if $^O eq 'MSWin32';
my $should_exec = [ @{ $dzpcs->scripts } ];

foreach ( @{ $should_exec } ) {
ok ( -x $_ , "$_" . ' is executable' );
}
};

这是我在 cpants 报告中得到的内容。

plan() doesn't understand HASH(0x286f4cc) at t/02-MintingProfileCatalyst.t line 46. # Child (catalyst scripts that should be executable) exited without calling finalize()# Failed test 'catalyst scripts that should be executable'# at C:/strawberry/perl/lib/Test/Builder.pm line 252.# Tests were run but no plan was declared and done_testing() was not seen.

所以我猜它不是哈希,然后不太确定它是什么......使这项工作最干净的方法是什么? (p.s. 我不能测试 win32,我只有我的 Linux 盒子)

最佳答案

plan 接受两个参数,而不是 hashref:

plan( skip_all => 'skip failing executable tests on windows' ) if $^O eq 'MSWin32';

并不是所有的东西都使用 Moose . ;-)

注意:出于测试目的,您可以将 eq 更改为 ne,这样它将跳过您的 Linux 机器上的测试。请记住事后将其改回。

关于windows - 如果 Windows,如何跳过子测试中的所有测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5027319/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com