BEGIN {
chdir 't' if -d 't';
- @INC = qw(. ../lib);
- require 'test.pl';
+ require './test.pl';
+ set_up_inc( qw(. ../lib) );
}
use strict qw(refs subs);
-plan(234);
+plan(236);
+
+# Test this first before we extend the stack with other operations.
+# This caused an asan failure due to a bad write past the end of the stack.
+eval { die 1..127, $_=\() };
# Test glob operations.
$x = "Good";
is ($$$refref, 'Good');
-# Test nested anonymous lists.
+# Test nested anonymous arrays.
$ref = [[],2,[3,4,5,]];
is (scalar @$ref, 3);
is ($called, 1);
}
is ref eval {\&{""}}, "CODE", 'reference to &{""} [perl #94476]';
+delete $My::{"Foo::"};
+is ref \&My::Foo::foo, "CODE",
+ 'creating stub with \&deleted_stash::foo [perl #128532]';
+
# Test references to return values of operators (TARGs/PADTMPs)
{
is (scalar (@bzz), 3);
# also, it can't be an lvalue
+# (That’s what *you* think! --sprout)
eval '\\($x, $y) = (1, 2);';
-like ($@, qr/Can\'t modify.*ref.*in.*assignment/);
+like ($@, qr/Can\'t modify.*ref.*in.*assignment(?x:
+ )|Experimental aliasing via reference not enabled/);
# test for proper destruction of lexical objects
$test = curr_test();
{
local $@;
eval { ()[0]{foo} };
- like ( "$@", "Can't use an undefined value as a HASH reference",
+ like ( "$@", qr/Can't use an undefined value as a HASH reference/,
"deref of undef from list slice fails" );
}
eval { $_ = 4 };
like $@, qr/^Modification of a read-only/,
'assignment to value aliased to literal number';
- require Config;
- local $::TODO = " " if $Config::Config{useithreads};
eval { ${\$_} = 4 };
like $@, qr/^Modification of a read-only/,
'refgen does not allow assignment to value aliased to literal number';
eval { $_ = 4 };
like $@, qr/^Modification of a read-only/,
'assignment to value aliased to literal string';
- require Config;
- local $::TODO = " " if $Config::Config{useithreads};
eval { ${\$_} = 4 };
like $@, qr/^Modification of a read-only/,
'refgen does not allow assignment to value aliased to literal string';
}
+{
+ my $aref = \123;
+ is \$$aref, $aref,
+ '[perl #109746] referential identity of \literal under threads+mad'
+}
# Bit of a hack to make test.pl happy. There are 3 more tests after it leaves.
$test = curr_test();