xref: /openbsd-src/gnu/usr.bin/perl/ext/XS-APItest/t/sort.t (revision 898184e3e61f9129feb5978fad5a8c6865f00b92)
1*898184e3Ssthen#!perl -w
2*898184e3Ssthen
3*898184e3Ssthenuse strict;
4*898184e3Ssthenuse warnings;
5*898184e3Ssthenuse Test::More tests => 2;
6*898184e3Ssthen
7*898184e3Ssthenuse XS::APItest;
8*898184e3Ssthen
9*898184e3Ssthenis join("", sort xs_cmp split//, '1415926535'), '1135559246',
10*898184e3Ssthen  'sort treats XS cmp routines as having implicit ($$)';
11*898184e3Ssthen{
12*898184e3Ssthen  my $w;
13*898184e3Ssthen  local $SIG{__WARN__} = sub { $w .= shift };
14*898184e3Ssthen  () = sort xs_cmp_undef 1,2;
15*898184e3Ssthen  like $w, qr/^Use of uninitialized value in sort at /,
16*898184e3Ssthen   'warning about undef retval from cmp routine mentions sort';
17*898184e3Ssthen}
18