5 my $debug = shift @ARGV;
7 use Test::More tests => 256;
8 use Data::Dump qw/dump/;
11 #use Devel::LeakTrace::Fast;
14 use_ok('CWMP::Queue');
18 ok(my $abs_path = abs_path($0), "abs_path");
19 $abs_path =~ s!/[^/]*$!/!; #!fix-vim
21 ok( my $obj = CWMP::Queue->new({
23 dir => "$abs_path/queue",
27 isa_ok( $obj, 'CWMP::Queue' );
29 for my $i ( 1 .. 42 ) {
41 while ( my $job = $obj->dequeue ) {
42 ok( $job, "dequeue $i" );
43 ok( my ( $dispatch, $args ) = $job->dispatch, "job->dispatch $i" );
44 cmp_ok( $dispatch, 'eq', "command-$i", "dispatch $i" );
45 diag "args = ",dump( $args ) if $debug;
46 cmp_ok( $args->{i}, '==', $i, "args i == $i" );
47 ok( $job->finish, "finish $i" );