set_up_inc('../lib');
}
use warnings;
-plan(tests => 197);
+plan(tests => 198);
# these shouldn't hang
{
@a = sort { $a <=> $b } @a;
$$r = "z";
is ("@a", "3 4 5", "RT #128340");
+}
+# in-place sorting of weak references
+SKIP: {
+ skip_if_miniperl("no dynamic loading on miniperl, no extension Scalar::Util", 1);
+ require Scalar::Util;
+ my @a = map { \(my $dummy = $_) } qw(c a d b);
+ my $r = $a[1];
+ Scalar::Util::weaken($a[1]);
+ @a = sort { $$a cmp $$b } @a;
+ undef $r;
+ ok defined $a[0] && ${$a[0]} eq 'a', "in-place sort strengthens weak references";
}
# Test optimisations of reversed sorts. As we now guarantee stability by