Skip to content

Commit e5a47aa

Browse files
committed
run/locale.t: Skip tests if no appropriate locale
Supercedes #23268, which didn't really get to the core problem. These were generating uninitialized variable warnings on OpenBSD, due to the reference existing, but the array being empty.
1 parent 3a938f2 commit e5a47aa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

t/run/locale.t

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,8 @@ EOF
612612

613613
SKIP:
614614
{
615-
skip "didn't find a suitable UTF-8 locale", 1 unless $utf8_ref;
615+
skip "didn't find a suitable UTF-8 locale", 1
616+
unless $utf8_ref && $utf8_ref->@*;
616617
my $locale = $utf8_ref->[0];
617618

618619
fresh_perl_is(<<"EOF", "ok\n", {}, "Handles above Unicode in a UTF8 locale");
@@ -632,7 +633,8 @@ EOF
632633

633634
SKIP:
634635
{
635-
skip "didn't find a suitable UTF-8 locale", 1 unless $utf8_ref;
636+
skip "didn't find a suitable UTF-8 locale", 1
637+
unless $utf8_ref && $utf8_ref->@*;
636638
my $is64bit = length sprintf("%x", ~0) > 8;
637639
skip "32-bit ASCII platforms can't physically have extended UTF-8", 1
638640
if $::IS_ASCII && ! $is64bit;
@@ -655,7 +657,8 @@ EOF
655657
}
656658

657659
SKIP: { # GH #20085
658-
skip "didn't find a suitable UTF-8 locale", 1 unless $utf8_ref;
660+
skip "didn't find a suitable UTF-8 locale", 1
661+
unless $utf8_ref && $utf8_ref->@*;
659662
local $ENV{LC_CTYPE} = $utf8_ref->[0];
660663
local $ENV{LC_ALL} = undef;
661664
fresh_perl_is(<<~'EOF', "ok\n", {}, "check that setlocale overrides startup");

0 commit comments

Comments
 (0)