Skip to content

Commit 5bb402b

Browse files
committed
loc_tools: Generally return at least C locale
If a category exists on the system, but we are supposed to keep it in the C locale, it still is testable as C or POSIX. Prior to this commit, it wasn't considered testable, and as a result tests in our suite were wrongly skipped.
1 parent ed79937 commit 5bb402b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

t/loc_tools.pl

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,24 @@ ($;$)
490490
my @categories = (ref $input_categories)
491491
? $input_categories->@*
492492
: $input_categories;
493-
return unless locales_enabled(\@categories);
493+
494+
# If we can't use at least one of these categories, investigate further
495+
if (! locales_enabled(\@categories)) {
496+
497+
# Not usable at all if system doesn't have locales
498+
return unless locales_enabled();
499+
500+
# Nor if any of the required categories isn't on the system
501+
my @on_platform = platform_locale_categories();
502+
for my $category (@categories) {
503+
return unless grep { $category eq $_ } @on_platform;
504+
}
505+
506+
# Otherwise the category is on the system, but not generally usable.
507+
# But the two always-present locales should be usable
508+
return ( "C", "POSIX" );
509+
}
510+
494511

495512
# Note, the subroutine call above converts the $categories into a form
496513
# suitable for _trylocale().

0 commit comments

Comments
 (0)