diff options
author | Karl Williamson <khw@cpan.org> | 2022-11-25 14:49:05 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-11-30 17:42:46 -0700 |
commit | 04de0222db2c455e25ec09919a16dd3550a2c9f2 (patch) | |
tree | 554c68209a69eaf16ec65d3a7c545180077cfc84 /ext/POSIX/t | |
parent | f42fb42da6158a7aa9310d4aa8a8db32e526d6b4 (diff) | |
download | perl-04de0222db2c455e25ec09919a16dd3550a2c9f2.tar.gz |
POSIX::localeconv: Return empty/special values
This function returns a hash allowing Perl access to the localeconv()
data structure, with the keys being the structure's field names, and the
values being their corresponding value in the current locale.
Prior to this commit, it did not populate the hash with:
1) any string-valued keys whose value is the empty string
2) any numeric-valued keys whose value is the special value CHAR_MAX
This is wrong. localeconv() should return a complete list of fields on
the platform, regardless of their values. Someone may well wish
to iterate over all the keys in the hash.
CHAR_MAX just indicates special handling is required for that
numeric field. And all string fields legally can be empty, except for
the decimal point. For example, the symbol indicating a number is
positive is empty in many locales.
I couldn't find a reason in the history why these have been omitted.
Diffstat (limited to 'ext/POSIX/t')
-rw-r--r-- | ext/POSIX/t/posix.t | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/ext/POSIX/t/posix.t b/ext/POSIX/t/posix.t index f200a895bd..117fa5e138 100644 --- a/ext/POSIX/t/posix.t +++ b/ext/POSIX/t/posix.t @@ -373,10 +373,9 @@ SKIP: { currency_symbol mon_decimal_point mon_thousands_sep mon_grouping positive_sign negative_sign)) { SKIP: { - skip("localeconv has no result for $_", 1) - unless exists $conv->{$_}; - unlike(delete $conv->{$_}, qr/\A\z/, - "localeconv returned a non-empty string for $_"); + my $value = delete $conv->{$_}; + skip("localeconv '$_' may be empty", 1) if $_ ne 'decimal_point'; + isnt($value, "", "localeconv returned a non-empty string for $_"); } } @@ -399,8 +398,6 @@ SKIP: { foreach (@lconv) { SKIP: { - skip("localeconv has no result for $_", 1) - unless exists $conv->{$_}; like(delete $conv->{$_}, qr/\A-?\d+\z/, "localeconv returned an integer for $_"); } |