~ubuntu-branches/ubuntu/wily/libsereal-encoder-perl/wily-proposed

« back to all changes in this revision

Viewing changes to t/160_recursion.t

  • Committer: Package Import Robot
  • Author(s): Alexandre Mestiashvili
  • Date: 2013-02-20 08:29:14 UTC
  • Revision ID: package-import@ubuntu.com-20130220082914-dljb6eixvtj2m1v2
Tags: upstream-0.31
ImportĀ upstreamĀ versionĀ 0.31

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!perl
 
2
use strict;
 
3
use warnings;
 
4
use Sereal::Encoder qw(encode_sereal);
 
5
use File::Spec;
 
6
 
 
7
use lib File::Spec->catdir(qw(t lib));
 
8
BEGIN {
 
9
    lib->import('lib')
 
10
        if !-d 't';
 
11
}
 
12
 
 
13
use Test::More;
 
14
 
 
15
my $recur_depth = 1000;
 
16
my $ref = [];
 
17
my $pos = $ref;
 
18
$pos = $pos->[0] = [] for 1..$recur_depth-1;
 
19
 
 
20
my $out = encode_sereal($ref, {max_recursion_depth => $recur_depth+1});
 
21
pass("alive");
 
22
my $no_exception = eval {
 
23
    $out = encode_sereal($ref, {max_recursion_depth => $recur_depth-1});
 
24
    1
 
25
};
 
26
ok(!$no_exception);
 
27
 
 
28
done_testing();
 
29
note("All done folks!");
 
30