开发者

How do I skip all tests in a subtest if windows?

I tried this, but it doesn't seem to work

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' );
    }
};

Here's what I got in my cpants report.

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. 开发者_运维技巧

So I guess it's not a hash, not really sure what it is then... what's the cleanest way to make this work? (p.s. I can't test win32, I only have my Linux box)


plan takes two parameters, not a hashref:

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

Not everything uses Moose. ;-)

Note: for testing purposes, you could change eq to ne, so it will skip the tests on your Linux box. Just remember to change it back afterwards.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜