Permalink
Browse files

analogous eval_dies_with_error for niecza

  • Loading branch information...
1 parent ea3d97a commit 2a309708f6b7066efacc34981b9a9a9cb26af5f1 @diakopter diakopter committed Jun 2, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 lib/Test.pm6
View
@@ -143,6 +143,16 @@ sub eval_lives_ok($code,$why?) is export {
sub eval_dies_ok($code,$why?) is export {
$*TEST-BUILDER.ok(no-control({ eval $code }) eq "die", $why);
}
+sub eval_dies_with_error($code, $error_pattern, $why?) is export {
+ my $died_with_error;
+ try {
+ CATCH {
+ $died_with_error = "$_" ~~ $error_pattern;
+ }
+ eval $code;
+ }
+ $*TEST-BUILDER.ok($died_with_error, $why);
+}
sub eval_succeeds_ok($code,$why?,:$ignore = ()) is export {
$*TEST-BUILDER.ok(?(no-control({ eval $code }) eq any("", @$ignore)), $why);
}

0 comments on commit 2a30970

Please sign in to comment.