summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/dist/Data-Dumper/t/huge.t
blob: 09343b72bf17f9decf7491e32ecc5679fe670b50 (plain) (blame)
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
#!./perl -w
#
# automated tests for Data::Dumper that need large amounts of memory; they
# are skipped unless PERL_TEST_MEMORY is set, and at least 10
#

use strict;
use warnings;

use Test::More;

use Config;
use Data::Dumper;

BEGIN {
    plan skip_all => 'Data::Dumper was not built'
        if $Config{extensions} !~ m{\b Data/Dumper \b}x;
    plan skip_all => 'Need 64-bit pointers for this test'
        if $Config{ptrsize} < 8;
    plan skip_all => 'Need ~10 GiB of core for this test'
        if !$ENV{PERL_TEST_MEMORY} || $ENV{PERL_TEST_MEMORY} < 10;
}

plan tests => 1;

{
    my $input = q/'/ x 2**31;
    my $len = length Dumper($input);
    # Each single-quote will get backslashed, so the output must have
    # stricly more than twice as many characters as the input.
    cmp_ok($len, '>', 2**32, 'correct output for huge all-quotable value');
    undef $input;
}