AnyEvent-WebService-Tracks

 view release on metacpan or  search on metacpan

t/04-todo.t  view on Meta::CPAN

use strict;
use warnings;

use FindBin;
use lib "$FindBin::Bin/lib";

use List::MoreUtils qw(all);
use Scalar::Util qw(looks_like_number);
use Storable qw(dclone);
use Test::AnyEvent::WebService::Tracks;
use Test::Exception;
use UNIVERSAL ();

my @orig_todos = ('Walk the dog', 'Finish TPS report', 'Take out the trash',
    'Install Tracks');
my @todos      = @orig_todos;

plan tests => 83 * @todos + 124;

my $tracks = get_tracks;

my $ctx;

run_tests_in_loop {
    my ( $cond ) = @_;

    $tracks->contexts(sub {
        my ( $contexts ) = @_;

        unless(@$contexts) {
            $cond->send;
            return;
        }

        my $run;

        $run = sub {
            my $ctx = shift @$contexts;

            $ctx->destroy(sub {
                if(@$contexts) {
                    $run->();
                } else {
                    $cond->send;
                }
            });
        };
        $run->();
    });
};

run_tests_in_loop {
    my ( $cond ) = @_;

    $tracks->create_context(name => 'Test Context', sub {
        ( $ctx ) = @_;

        ok($ctx);
        $cond->send;
    });
};

run_tests_in_loop {
    my ( $cond ) = @_;
    



( run in 0.477 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )