Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #39 from Nami-Doc/patch-1
Swap `try`s for `lives_ok`
  • Loading branch information
timo committed Apr 5, 2014
2 parents 580f5c1 + d90866d commit 57c7c92
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions S03-operators/orelse.t
Expand Up @@ -13,38 +13,38 @@ nok $tracker, 'orelse thunks';

#?rakudo todo "orelse exception semantics"
{
my $result = 0;
try {
die "oh noes!" orelse $result = 1;
die "oh noes!" orelse pass("orelse continues after an exception");
CATCH { flunk "orelse shouldn't rethrow exceptions" }
}
ok $result, "orelse continues after an exception";
}

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

#?rakudo todo "orelse exception semantics"
{
my $result = 0;
try {
die "oh noes!" orelse -> $foo { $result = ~$foo eq "oh noes!" };
die "oh noes!" orelse -> $foo {
ok ~$foo eq "oh noes!", "orelse passes $! to one argument after an exception";
};
CATCH { flunk "orelse shouldn't rethrow exceptions" }
}
ok $result, "orelse passes $! to one argument after an exception";
}

#?rakudo todo "orelse exception semantics"
{
my $result = 0;
try {
die "oh noes!" orelse -> $foo, $bar { $result = ~$foo eq "oh noes!" && ~$bar eq "oh noes!" };
die "oh noes!" orelse -> $foo, $bar {
ok ~$foo eq "oh noes!" && ~$bar eq "oh noes!", "orelse passes $! to two arguments after an exception";
};
CATCH { flunk "orelse shouldn't rethrow exceptions" }
}
ok $result, "orelse passes $! to two arguments after an exception";
}


Expand Down

0 comments on commit 57c7c92

Please sign in to comment.