Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test for specific types of Promise-related exceptions
  • Loading branch information
moritz committed Dec 21, 2014
1 parent c4a1041 commit d859717
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion S17-promise/basic.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 19;
plan 21;

{
my $p = Promise.new;
Expand All @@ -17,7 +17,10 @@ plan 19;
is $p.result, "kittens", "Correct result";

dies_ok { $p.cause }, "Cannot call cause on a Kept Promise";
throws_like { $p.cause }, X::Promise::CauseOnlyValidOnBroken,
status => 'Kept';
dies_ok { $p.keep("eating") }, "Cannot re-keep a Kept Promise";
throws_like { $p.keep('eating') }, X::Promise::Vowed;
dies_ok { $p.break("bad") }, "Cannot break a Kept Promise";
}

Expand Down

0 comments on commit d859717

Please sign in to comment.