File: sv_gets.t

package info (click to toggle)
perl 5.42.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 128,392 kB
  • sloc: perl: 534,963; ansic: 240,563; sh: 72,042; pascal: 6,934; xml: 2,428; yacc: 1,360; makefile: 1,197; cpp: 208; lisp: 1
file content (48 lines) | stat: -rw-r--r-- 1,099 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
38
39
40
41
42
43
44
45
46
47
48
#!perl
BEGIN {
    chdir 't' if -d 't';
    @INC = "../lib";
}

use strict;
require './test.pl';
use Config qw(%Config);

# 2 for the child, 2 for the parent
$ENV{PERL_TEST_MEMORY} >= 4
    or skip_all("Need ~4Gb for this test");
$Config{ptrsize} >= 8
    or skip_all("Need 64-bit pointers for this test");

{
    # https://www.perlmonks.org/?node_id=11161665
    my $x = `$^X -e "print q/x/ x 0x80000000"`;
    is(length $x, 0x80000000, "check entire input read");
    undef $x;
}

{
    # sv_gets_append_to_utf8 append parameter
    my $x = "x";
    $x x= 0x8000_0000;
    utf8::upgrade($x);
    # using bareword handle because the rcatline optimization isn't done
    # for non-barewords
    # for $fh
    # we chdired to "t"
    open FH, "<", "TEST" or die $!;
    $x .= <FH>;
    pass("didn't crash appending readline to large upgraded scalar");
}

{
    # sv_gets_read_record append parameter
    my $x = "x";
    $x x= 0x8000_0000;
    open FH, "<", "TEST" or die $!;
    local $/ = \100;
    $x .= <FH>;
    pass("didn't crash appending readline record to large scalar");
}

done_testing();