File: 160_recursion.t

package info (click to toggle)
libsereal-encoder-perl 4.005%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,980 kB
  • sloc: ansic: 8,664; perl: 5,705; sh: 25; makefile: 5
file content (31 lines) | stat: -rw-r--r-- 578 bytes parent folder | download | duplicates (4)
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
#!perl
use strict;
use warnings;
use File::Spec;

use lib File::Spec->catdir(qw(t lib));
BEGIN {
    lib->import('lib')
        if !-d 't';
}

use Test::More;
use Sereal::TestSet;
use Sereal::Encoder qw(encode_sereal);

my $recur_depth = 1000;
my $ref = [];
my $pos = $ref;
$pos = $pos->[0] = [] for 1..$recur_depth-1;

my $out = encode_sereal($ref, {max_recursion_depth => $recur_depth+1});
pass("alive");
my $no_exception = eval {
    $out = encode_sereal($ref, {max_recursion_depth => $recur_depth-1});
    1
};
ok(!$no_exception);

done_testing();
note("All done folks!");