summaryrefslogtreecommitdiff
path: root/lib/locale.t
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-06-06 13:04:55 -0600
committerKarl Williamson <khw@cpan.org>2014-06-07 10:24:58 -0600
commitf406a44534fb208bbd0ef2f84f722d1693b498a4 (patch)
treefa5c322281bcb9cca640350f2b4483f93d601779 /lib/locale.t
parent4874c8de0e9c2e6f771c454fd6122d32a42e42b6 (diff)
downloadperl-f406a44534fb208bbd0ef2f84f722d1693b498a4.tar.gz
PATCH: [perl #119425] strftime with %p
In a locale in which there is no a.m. nor p.m. indicator, a format with only %p in it would print %p instead of nothing.
Diffstat (limited to 'lib/locale.t')
-rw-r--r--lib/locale.t8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/locale.t b/lib/locale.t
index e9ed1a86cf..d0adbd83f5 100644
--- a/lib/locale.t
+++ b/lib/locale.t
@@ -1665,6 +1665,7 @@ foreach my $Locale (@Locale) {
my $ok16;
my $ok17;
my $ok18;
+ my $ok19;
my $c;
my $d;
@@ -1675,6 +1676,8 @@ foreach my $Locale (@Locale) {
my $i;
my $j;
+ my @times = CORE::localtime();
+
if (! $is_utf8_locale) {
use locale;
@@ -1733,6 +1736,7 @@ foreach my $Locale (@Locale) {
$ok17 = "1.5:1.25" eq sprintf("%g:%g", $h, $i);
}
$ok18 = $j eq sprintf("%g:%g", $h, $i);
+ $ok19 = POSIX::strftime("%p",@times) ne "%p"; # [perl #119425]
}
else {
use locale ':not_characters';
@@ -1811,6 +1815,7 @@ foreach my $Locale (@Locale) {
$ok17 = "1.5:1.25" eq sprintf("%g:%g", $h, $i);
}
$ok18 = $j eq sprintf("%g:%g", $h, $i);
+ $ok19 = POSIX::strftime("%p",@times) ne "%p"; # [perl #119425]
}
report_result($Locale, ++$locales_test_number, $ok1);
@@ -1890,6 +1895,9 @@ foreach my $Locale (@Locale) {
report_result($Locale, ++$locales_test_number, $ok18);
$test_names{$locales_test_number} = 'Verify that a sprintf of a number back within locale scope uses locale radix';
+ report_result($Locale, ++$locales_test_number, $ok19);
+ $test_names{$locales_test_number} = 'Verify that strftime doesn\'t return "%p" in locales where %p is empty';
+
debug "# $first_f_test..$locales_test_number: \$f = $f, \$g = $g, back to locale = $Locale\n";
# Does taking lc separately differ from taking