Platform dependent tests



examples/test-more/t/without_skip.t
use strict;
use warnings;

use Test::More test => 2;

like( `/sbin/ifconfig`, qr/eth0/ );
like( `ipconfig`,       qr/Windows IP Configuration/ );

ok 1
Can't exec "ipconfig": No such file or directory at without_skip.t line 8.
not ok 2
#   Failed test at examples/intro/without_skip.t line 8.
#                   undef
#     doesn't match '(?-xism:Windows IP Configuration)'
1..2
# Looks like you failed 1 test of 2.

Sometimes, you know that a part of your test suite isn't relevant. Running them - if at all possible - would report false results. Maybe some of the features of your system are platform dependent, you don't want to test them on an unsupported platform. Sometimes failure of previous tests make a test irrelevant.

In all such cases what you actually want is to skip the tests. Surprisingly the way to do that is to enclose the tests in a SKIP block.