Skip on the fly


There are cases when you cannot easily decide up front which tests you'll need to skip. In such cases you can rely on the skip method of Test::Builder that you can access from Test::More as well.

examples/test-perl/t/skip.t
use strict;
use warnings;

use FindBin;
use Test::More;

my @files = glob "$FindBin::Bin/[0-9]*.t";

plan tests => scalar @files;

my $T = Test::More->builder;

foreach my $file (@files) {
    if ($file =~ /explain/) {
        $T->skip("Not this one");
        next;
    }
    ok(-e $file, $file);
}