Skip Menu |

This queue is for tickets about the SVN-Web CPAN distribution.

Report information
The Basics
Id: 25435
Status: resolved
Priority: 0/
Queue: SVN-Web

People
Owner: NIKC [...] cpan.org
Requestors: emazep [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.52
Fixed in: (no value)



Subject: timedate_format tests don't honour locale settings.
Here is an example of how timedate_format.t fails on a system where a time format different from the one expected by the author is in effect: t/timedate_format.... # Failed test at t/timedate_format.t line 24. t/timedate_format....ok 1/4# got: 'lun. mag 08, 7:30' # expected: 'Mon. May 08, 7:30PM' t/timedate_format....NOK 3/4 # Failed test at t/timedate_format.t line 28. # got: 'lun. mag 08, 8:30' # expected: 'Mon. May 08, 8:30PM' t/timedate_format....NOK 4/4# Looks like you failed 2 tests of 4. Furthermore the module Number::Format (unfortunately requested by SVN::Web) suffers from similar problems. I know that it may sound strange, but English is not the only language in the world (nor the oldest one). Cheers, Emanuele.
On Wed Mar 14 13:00:43 2007, emazep wrote: Show quoted text
> Here is an example of how timedate_format.t fails on a system where a > time format different from the one expected by the author is in effect: > > t/timedate_format.... > # Failed test at t/timedate_format.t line 24. > t/timedate_format....ok 1/4# got: 'lun. mag 08, 7:30' > # expected: 'Mon. May 08, 7:30PM' > t/timedate_format....NOK 3/4 > # Failed test at t/timedate_format.t line 28. > # got: 'lun. mag 08, 8:30' > # expected: 'Mon. May 08, 8:30PM' > t/timedate_format....NOK 4/4# Looks like you failed 2 tests of 4. > > Furthermore the module Number::Format (unfortunately requested by > SVN::Web) suffers from similar problems.
Good point. Can you send me the output from running the env(1) command on your system please, and I'll work on fixing this. Thanks.
From: ema_zep [...] libero.it
On Mon Apr 09 14:07:42 2007, NIKC wrote: Show quoted text
> Good point. Can you send me the output from running the env(1) > command on your system please, and I'll work on fixing this.
Sure, here it is. I also add the locale(1) output, which is probably more relevant. locale(1) output: LANG=it_IT.UTF-8 LC_CTYPE="it_IT.UTF-8" LC_NUMERIC="it_IT.UTF-8" LC_TIME="it_IT.UTF-8" LC_COLLATE="it_IT.UTF-8" LC_MONETARY="it_IT.UTF-8" LC_MESSAGES="it_IT.UTF-8" LC_PAPER="it_IT.UTF-8" LC_NAME="it_IT.UTF-8" LC_ADDRESS="it_IT.UTF-8" LC_TELEPHONE="it_IT.UTF-8" LC_MEASUREMENT="it_IT.UTF-8" LC_IDENTIFICATION="it_IT.UTF-8" LC_ALL= The problem is simply that you shouldn't use English days and months names in your tests, since not everyone is using an English locale. You can try it on your system by setting another locale different from en* (locale -a will show all the locales available on your system). Of course the problem I've reported does not prevent one to use SVN::Web by forcing the installation, but could discourage the casual user. Here is the env(1) output (without some private non-relevant information): DESKTOP_STARTUP_ID= SHELL=/bin/bash TERM=xterm GTK_RC_FILES=/etc/gtk/gtkrc:/home/emanuele/.gtkrc-1.2-gnome2 WINDOWID=28655513 SSH_TTY=/dev/pts/0 PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games LANG=it_IT.UTF-8 HISTCONTROL=ignoredups SHLVL=4 GNOME_DESKTOP_SESSION_ID=Default LESSOPEN=| /usr/bin/lesspipe %s DISPLAY=:1.0 LESSCLOSE=/usr/bin/lesspipe %s %s COLORTERM=gnome-terminal _=/usr/bin/env Also let me know if you have difficulties in replacing Number::Format (if you plan to do it): I can upload on CPAN a Number::Format replacement (though not a drop-in replacement) I've developed, which does not suffer from the Number::Format limitations. Thanks for your kind reply and for your great work with SVN::Web. Cheers, Emanuele.
This patch should fix the test. Can you verify it works on your system please. Thanks. Index: t/timedate_format.t =================================================================== --- t/timedate_format.t (revision 1302) +++ t/timedate_format.t (working copy) @@ -3,10 +3,15 @@ use strict; use warnings; +use POSIX qw(locale_h); + use SVN::Web::action; - use Test::More tests => 4; +# Force the 'C' locale, so that tests give consistent results even if the +# user running under a non-English locale. +setlocale(LC_TIME, 'C'); + my %config = (timezone => '', timedate_format => '%Y/%m/%d %H:%M:%S', );