This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/loc_tools.pl: Fix some bugs in locales_enabled()
authorKarl Williamson <khw@cpan.org>
Mon, 7 Sep 2015 16:03:27 +0000 (10:03 -0600)
committerKarl Williamson <khw@cpan.org>
Tue, 8 Sep 2015 16:05:56 +0000 (10:05 -0600)
commit308482c27259302fb2ca8c60b8383609a0e9f314
tree5e15ba76b2ea0b5365c1d8b99a65cc0d6f64d923
parentd8f8a4817f5910267c45439ddb7764b371f06276
t/loc_tools.pl: Fix some bugs in locales_enabled()

This code assumed that all locale categories were represented by
non-negative whole numbers.  However, it turns out that this assumption
is wrong, as on AIX, LC_ALL is -1.  This commit changes our assumption to
take into account that reality; it now assumes that all categories are
larger than a much more negative number, and now the new assumption is
tested for, and if wrong, the code dies instead of silently doing the
wrong thing.

There was also a bug where if a locale category wasn't defined on the
machine, but the corresponding #ifdef for using that category was still
set, the category was improperly assumed to exist
lib/locale.t
t/loc_tools.pl