1#!./perl -w
2#
3# automated tests for Data::Dumper that need large amounts of memory; they
4# are skipped unless PERL_TEST_MEMORY is set, and at least 10
5#
6
7use strict;
8use warnings;
9
10use Test::More;
11
12use Config;
13use Data::Dumper;
14
15BEGIN {
16    plan skip_all => 'Need 64-bit pointers for this test'
17        if $Config{ptrsize} < 8;
18    plan skip_all => 'Need ~10 GiB of core for this test'
19        if !$ENV{PERL_TEST_MEMORY} || $ENV{PERL_TEST_MEMORY} < 10;
20}
21
22plan tests => 1;
23
24{
25    my $input = q/'/ x 2**31;
26    my $len = length Dumper($input);
27    # Each single-quote will get backslashed, so the output must have
28    # stricly more than twice as many characters as the input.
29    cmp_ok($len, '>', 2**32, 'correct output for huge all-quotable value');
30    undef $input;
31}
32