Skip to content

Commit a6ce8ea

Browse files
committed
Try::Tiny interaction failing test case
1 parent fb23c1b commit a6ce8ea

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

Makefile.PL

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ WriteMakefile(
2424
},
2525
TEST_REQUIRES => {
2626
'Test::Fatal' => '0.014',
27+
'Try::Tiny' => '0.24',
2728
}
2829
);

t/nested.t

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@ use JavaScript::Duktape;
55
use Test::More;
66
use Test::Fatal;
77

8+
use Try::Tiny;
9+
10+
subtest 'try-tiny interaction' => sub {
11+
sub eval_js {
12+
my $code = shift;
13+
14+
my $js = JavaScript::Duktape->new;
15+
16+
try {
17+
$js->eval( $code );
18+
} catch {
19+
my $err = $_;
20+
warn "CAUGHT ERR: $err";
21+
die "JS ERR: $err";
22+
};
23+
}
24+
25+
eval {
26+
eval_js(q{
27+
throw new Error('oh boy!');
28+
});
29+
};
30+
isnt $@, '', 'error message comes through';
31+
};
32+
833
subtest 'simple nested thrown exception' => sub{
934
my $js = JavaScript::Duktape->new();
1035
$js->set( each => sub{

0 commit comments

Comments
 (0)