Skip to content

Commit

Permalink
Adapt tests because of 2a635cd
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Dec 6, 2015
1 parent 182fd17 commit 9fd62a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
22 changes: 5 additions & 17 deletions S17-scheduler/basic.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 40;
plan 34;

# real scheduling here
my $name = $*SCHEDULER.^name;
Expand Down Expand Up @@ -77,14 +77,8 @@ ok $*SCHEDULER ~~ Scheduler, "$name does Scheduler role";
"$name cannot combine :catch with :in and :at";
dies-ok { $*SCHEDULER.cue({ ... }, :every(0.1), :at(now + 2), :in(1)), :catch({...}) },
"$name cannot combine :every/:catch with :in and :at";
dies-ok { $*SCHEDULER.cue({ ... }, :every(0.1), :times(10)) },
"$name cannot combine :every and :times";
dies-ok { $*SCHEDULER.cue({ ... }, :every(0.1), :times(10), :at(now + 2)) },
"$name cannot combine :every and :times with :at";
dies-ok { $*SCHEDULER.cue({ ... }, :every(0.1), :times(10), :in(1)) },
"$name cannot combine :every and :times with :in";
dies-ok { $*SCHEDULER.cue({ ... }, :every(0.1), :times(10), :catch({...})) },
"$name cannot combine :every and :times with :catch";
dies-ok { $*SCHEDULER.cue({ ... }, :every(0.1), :times(10), :stop({...})) },
"$name cannot combine :every, :times and :stop";
}

# fake scheduling from here on out
Expand Down Expand Up @@ -154,12 +148,6 @@ ok $*SCHEDULER ~~ Scheduler, "{$*SCHEDULER.^name} does Scheduler role";
"$name cannot combine :catch with :in and :at";
dies-ok { $*SCHEDULER.cue({ ... }, :every(0.1), :at(now + 2), :in(1)), :catch({...}) },
"$name cannot combine :every/:catch with :in and :at";
dies-ok { $*SCHEDULER.cue({ ... }, :every(0.1), :times(10)) },
"$name cannot combine :every and :times";
dies-ok { $*SCHEDULER.cue({ ... }, :every(0.1), :times(10), :at(now + 2)) },
"$name cannot combine :every and :times with :at";
dies-ok { $*SCHEDULER.cue({ ... }, :every(0.1), :times(10), :in(1)) },
"$name cannot combine :every and :times with :in";
dies-ok { $*SCHEDULER.cue({ ... }, :every(0.1), :times(10), :catch({...})) },
"$name cannot combine :every and :times with :catch";
dies-ok { $*SCHEDULER.cue({ ... }, :every(0.1), :times(10), :stop({...})) },
"$name cannot combine :every, :times and :stop";
}
12 changes: 11 additions & 1 deletion S17-scheduler/every.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 18;
plan 20;

# real scheduling here
my $name = $*SCHEDULER.^name;
Expand Down Expand Up @@ -83,6 +83,16 @@ my $name = $*SCHEDULER.^name;
LEAVE $c.cancel;
}

{
my $a = 0;
my $c = $*SCHEDULER.cue({ cas $a, {.succ} }, :every(0.1), :10times);
isa-ok $c, Cancellation;
sleep 3;
diag "seen $a runs" if !
is $a, 10, "Cue with :every/:times schedules repeatedly for 10 times";
LEAVE $c.cancel;
}

{
my $a = 0;
my $b = 0;
Expand Down

0 comments on commit 9fd62a1

Please sign in to comment.