File: jsfunc_memory_handling.t

package info (click to toggle)
libjavascript-quickjs-perl 0.21-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,180 kB
  • sloc: ansic: 72,822; javascript: 7,743; perl: 1,065; makefile: 353; sh: 108
file content (37 lines) | stat: -rw-r--r-- 565 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env perl

use strict;
use warnings;

use Test::More;
use Test::Deep;
use Test::FailWarnings;

use JavaScript::QuickJS;

{
    my $return;

    my $js = JavaScript::QuickJS->new();

    $js->set_globals(  __return => sub { $return = shift } );

    my $ret = $js->eval('__return( a => a );');

    isa_ok(
        $return,
        'JavaScript::QuickJS::Function',
        'eval() of an arrow function',
    );

    like(
        "$return",
        qr<JavaScript::QuickJS::Function>,
        'stringification',
    );

    undef $return;

}

done_testing;