1#!perl 2BEGIN { 3 chdir 't' if -d 't'; 4 @INC = "../lib"; 5 require './test.pl'; 6} 7 8use Config qw(%Config); 9 10$ENV{PERL_TEST_MEMORY} >= 4 11 or skip_all("Need ~4Gb for this test"); 12$Config{ptrsize} >= 8 13 or skip_all("Need 64-bit pointers for this test"); 14 15plan(2); 16 17sub exn { 18 my ($code_string) = @_; 19 local $@; 20 return undef if eval "do { $code_string }; 1"; 21 return $@; 22} 23 24like(exn('my $h = { "x" x 2**31, undef }'), 25 qr/^\QSorry, hash keys must be smaller than 2**31 bytes\E\b/, 26 "hash constructed with huge key"); 27 28like(exn('my %h; $h{ "x" x 2**31 } = undef'), 29 qr/^\QSorry, hash keys must be smaller than 2**31 bytes\E\b/, 30 "assign to huge hash key"); 31