Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make sure we don't die on empty arrays
  • Loading branch information
lizmat committed Jan 15, 2015
1 parent 22ef35b commit 7cbffe8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions S17-scheduler/at.t
Expand Up @@ -49,9 +49,9 @@ ok $*SCHEDULER ~~ Scheduler, "{$*SCHEDULER.^name} does Scheduler role";
my $tracker = '';
my @c;
push @c, $*SCHEDULER.cue({ $tracker ~= '2s'; }, :at(now + 2));
ok @c[*-1].can("cancel"), 'can we cancel (1)';
ok @c && @c[*-1].can("cancel"), 'can we cancel (1)';
push @c, $*SCHEDULER.cue({ $tracker ~= '1s'; }, :at(now + 1));
ok @c[*-1].can("cancel"), 'can we cancel (2)';
ok @c && @c[*-1].can("cancel"), 'can we cancel (2)';
is $tracker, '2s1s', "Cue on $name with :at *DOES* schedule immediately";
LEAVE @c>>.cancel;
}
Expand All @@ -65,13 +65,13 @@ ok $*SCHEDULER ~~ Scheduler, "{$*SCHEDULER.^name} does Scheduler role";
:catch({ $tracker ~= '2scatch'})
);
#?rakudo todo "huh?"
ok @c[*-1].can("cancel"), 'can we cancel (3)';
ok @c && @c[*-1].can("cancel"), 'can we cancel (3)';
push @c, $*SCHEDULER.cue(
{ $tracker ~= '1s'; },
:at(now + 1),
:catch({ $tracker ~= '1scatch'})
);
ok @c[*-1].can("cancel"), 'can we cancel (4)';
ok @c && @c[*-1].can("cancel"), 'can we cancel (4)';
is $tracker, '2s2scatch1s', "Cue on $name with :at/:catch *DOES* schedule immediately";
LEAVE @c>>.cancel;
}

0 comments on commit 7cbffe8

Please sign in to comment.