Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Properly plan / skip orelse tests
Before we had a plan, some tests were basically ignored.  Now with a plan,
and skips in place, we still somehow miss the last test being executed.
Patches welcome.
  • Loading branch information
lizmat committed Apr 12, 2014
1 parent f6606d2 commit 0003eab
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions S03-operators/orelse.t
@@ -1,6 +1,8 @@
use v6;
use Test;

plan 11;

is (1 orelse 2), 1, 'orelse basics';
is (1 orelse 2 orelse 3), 1, 'orelse chained';
is (Any orelse Int orelse 3), 3, 'orelse chained';
Expand All @@ -11,18 +13,21 @@ my $tracker = 0;
ok (1 orelse ($tracker = 1)), 'sanity';
nok $tracker, 'orelse thunks';

#?rakudo todo 'orelse $! semantics'
try { die "oh noes!" } orelse ok(~$! eq "oh noes!", 'orelse sets $! after an exception');

#?rakudo todo 'orelse $! semantics'
try { die "oh noes!" } orelse -> $foo {
ok ~$foo eq "oh noes!", 'orelse passes $! to one argument after an exception';
};

#?rakudo todo 'orelse $! semantics'
try { die "oh noes!" } orelse -> $foo, $bar {
ok ~$foo eq "oh noes!" && ~$bar eq "oh noes!", 'orelse passes $! to two arguments after an exception';
};
#?rakudo skip 'orelse $! semantics'
{
try { die "oh noes!" } orelse ok(~$! eq "oh noes!", 'orelse sets $! after an exception');
}

#?rakudo skip 'orelse $! semantics'
{
try { die "oh noes!" } orelse -> $foo {
ok ~$foo eq "oh noes!", 'orelse passes $! to one argument after an exception';
};
}

done;
#?rakudo skip 'orelse $! semantics'
{
try { die "oh noes!" } orelse -> $foo, $bar {
ok ~$foo eq "oh noes!" && ~$bar eq "oh noes!", 'orelse passes $! to two arguments after an exception';
};
}

0 comments on commit 0003eab

Please sign in to comment.