Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make the whole "exception semantics" situation clearer.
  • Loading branch information
timo committed Apr 7, 2014
1 parent 5a1a50a commit 49c0367
Showing 1 changed file with 10 additions and 33 deletions.
43 changes: 10 additions & 33 deletions S03-operators/orelse.t
Expand Up @@ -11,41 +11,18 @@ my $tracker = 0;
ok (1 orelse ($tracker = 1)), 'sanity';
nok $tracker, 'orelse thunks';

#?rakudo todo "orelse exception semantics"
{
try {
try { die "oh noes!" } orelse pass("orelse continues after an exception");
CATCH { default { flunk "orelse shouldn't rethrow exceptions" } }
}
}
#?rakudo todo 'orelse $! semantics'
try { die "oh noes!" } orelse ok(~$! eq "oh noes!", 'orelse sets $! after an exception');

#?rakudo todo "orelse exception semantics"
{
try {
try { die "oh noes!" } orelse ok(~$! eq "oh noes!", 'orelse sets $! after an exception');
CATCH { default { flunk "orelse shouldn't rethrow exceptions" } }
}
}
#?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 exception semantics"
{
try {
try { die "oh noes!" } orelse -> $foo {
ok ~$foo eq "oh noes!", 'orelse passes $! to one argument after an exception';
};
CATCH { default { flunk "orelse shouldn't rethrow exceptions" } }
}
}

#?rakudo todo "orelse exception semantics"
{
try {
try { die "oh noes!" } orelse -> $foo, $bar {
ok ~$foo eq "oh noes!" && ~$bar eq "oh noes!", 'orelse passes $! to two arguments after an exception';
};
CATCH { default { flunk "orelse shouldn't rethrow exceptions" } }
}
}
#?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';
};


done;

0 comments on commit 49c0367

Please sign in to comment.