Skip to content

Commit

Permalink
Try::Tiny interaction failing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
vasslabs committed Mar 25, 2016
1 parent fb23c1b commit a6ce8ea
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ WriteMakefile(
},
TEST_REQUIRES => {
'Test::Fatal' => '0.014',
'Try::Tiny' => '0.24',
}
);
25 changes: 25 additions & 0 deletions t/nested.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,31 @@ use JavaScript::Duktape;
use Test::More;
use Test::Fatal;

use Try::Tiny;

subtest 'try-tiny interaction' => sub {
sub eval_js {
my $code = shift;

my $js = JavaScript::Duktape->new;

try {
$js->eval( $code );
} catch {
my $err = $_;
warn "CAUGHT ERR: $err";
die "JS ERR: $err";
};
}

eval {
eval_js(q{
throw new Error('oh boy!');
});
};
isnt $@, '', 'error message comes through';
};

subtest 'simple nested thrown exception' => sub{
my $js = JavaScript::Duktape->new();
$js->set( each => sub{
Expand Down

0 comments on commit a6ce8ea

Please sign in to comment.