Permalink
Browse files

Add tests for Supply.last

  • Loading branch information...
lizmat committed May 3, 2014
1 parent d08d001 commit 432761fc8f08806b06fef42f283cab00a21ca0de
Showing with 21 additions and 0 deletions.
  1. +21 −0 S17-supply/last.t
View
@@ -0,0 +1,21 @@
use v6;
use lib 't/spec/packages';
use Test;
use Test::Tap;
plan 35;
dies_ok { Supply.last }, 'can not be called as a class method';
#?rakudo todo "we don't have Natural numbers yet"
dies_ok { Supply.new.last(0) }, 'cannot have 0 last';
dies_ok { Supply.new.last("foo") }, 'cannot have "foo" last';
for (ThreadPoolScheduler, CurrentThreadScheduler) {
$*SCHEDULER = .new;
isa_ok $*SCHEDULER, $_, "***** scheduling with {$_.gist}";
tap_ok Supply.for(1..10).last, [10], "the last one works";
tap_ok Supply.for(1..10).last(5), [6..10], "the last five works";
tap_ok Supply.for(1..10).last(15), [1..10], "the last 15 works";
}

0 comments on commit 432761f

Please sign in to comment.