Net-Fluidinfo

 view release on metacpan or  search on metacpan

t/Net/Fluidinfo/TestUtils.pm  view on Meta::CPAN


sub skip_all_message {
    'this suite is brittle in a shared sandbox, only runs in the dev machine'
}

sub ok_sets_cmp {
    my ($a, $b) = @_;
    is_deeply [sort @$a], [sort @$b];
}

sub ok_dies(&) {
    eval { shift->() };
    ok $@;
}

sub skip_suite_unless_run_all {
    unless ($ENV{NET_FLUIDINFO_RUN_FULL_SUITE}) {
       plan skip_all => "set NET_FLUIDINFO_RUN_FULL_SUITE to run these";
       exit 0;
    }
}

# This subroutine allows you to run a coderef until it returns true,
# waiting one second between calls. If a threshold of one minute is
# reached, we print a skip message and move on.
#
# Useful for testing searching after tagging for example, since new
# tags are not visible immediately for searching.
sub tolerate_delay(&) {
    my $code = shift;

    SKIP: {
        for (my $n = 0; $n < 60; ++$n) {
            return if $code->();
            sleep 1;
        }

        skip "search is taking too long, skipping", 1;
    }



( run in 0.480 second using v1.01-cache-2.11-cpan-49f99fa48dc )