Skip Menu |

This queue is for tickets about the ExtJS-Generator-DBIC CPAN distribution.

Report information
The Basics
Id: 114531
Status: resolved
Priority: 0/
Queue: ExtJS-Generator-DBIC

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.002
Fixed in: 0.003



Subject: Tests fail on systems with non-English locale
On freebsd systems with German locale (LC_ALL=de_DE.UTF-8 or de_DE.ISO8859-1): # non-existing dir is /var/tmp/cpansmoker-1023/2016052018/9vS4PXEOWr # Failed test 'non existing output directory throws ok' # at t/test.t line 152. # expecting: Regexp ((?^:No such file or directory)) # found: Datei oder Verzeichnis nicht gefunden: /var/tmp/cpansmoker-1023/2016052018/9vS4PXEOWr at /usr/home/eserte/.cpan/build/2016052018/ExtJS-Generator-DBIC-0.002-vM9OfV/blib/lib/ExtJS/Generator/DBIC/Model.pm line 532. # writing 'Another' to /var/tmp/cpansmoker-1023/2016052018/_anD6QIzLz # writing all models to /var/tmp/cpansmoker-1023/2016052018/uj21O1li26 # Looks like you failed 1 test of 7. t/test.t ................... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/7 subtests
Interesting! My locale settings are de_AT@UTF-8 and the error message is still English: LC_PAPER=de_AT.UTF-8 LC_ADDRESS=de_AT.UTF-8 LC_MONETARY=de_AT.UTF-8 LC_NUMERIC=de_AT.UTF-8 LC_ALL=de_AT.UTF-8 LC_TELEPHONE=de_AT.UTF-8 LC_IDENTIFICATION=de_AT.UTF-8 LC_MEASUREMENT=de_AT.UTF-8 LC_TIME=de_AT.UTF-8 LC_NAME=de_AT.UTF-8 Do you have a suggestion how to write this test in a portable manner?
On 2016-05-23 04:21:31, ABRAXXA wrote: Show quoted text
> Interesting! > My locale settings are de_AT@UTF-8 and the error message is still English:
I guess you have perl 5.22 or later installed. In these perls $! error messages are only localized if in a "use locale" block and LC_ALL or LANG or so are set. Show quoted text
> LC_PAPER=de_AT.UTF-8 > LC_ADDRESS=de_AT.UTF-8 > LC_MONETARY=de_AT.UTF-8 > LC_NUMERIC=de_AT.UTF-8 > LC_ALL=de_AT.UTF-8 > LC_TELEPHONE=de_AT.UTF-8 > LC_IDENTIFICATION=de_AT.UTF-8 > LC_MEASUREMENT=de_AT.UTF-8 > LC_TIME=de_AT.UTF-8 > LC_NAME=de_AT.UTF-8 > > Do you have a suggestion how to write this test in a portable manner?
See the attached patch. Using $ENV{LC_ALL}="C" does not work here, so only solution seems to be the usage of POSIX::setlocale.
Subject: 0001-fix-locale-specific-test-errors-RT-114531.patch
From a9e219f20b29d6b1aca1aa7c7fa46fe62abb28e3 Mon Sep 17 00:00:00 2001 From: Slaven Rezic <cpansand@cvrsnica-freebsd-101.herceg.de> Date: Sun, 12 Jun 2016 00:20:32 +0200 Subject: [PATCH] fix locale-specific test errors (RT #114531) --- t/test.t | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/t/test.t b/t/test.t index 785854e..b362ae9 100644 --- a/t/test.t +++ b/t/test.t @@ -9,6 +9,13 @@ use ExtJS::Generator::DBIC::Model; use Data::Dump::JavaScript qw( false true ); use lib 't/lib'; +BEGIN { + if ($] < 5.022) { + require POSIX; + POSIX::setlocale(&POSIX::LC_ALL, 'C'); + } +} + my $generator = ExtJS::Generator::DBIC::Model->new( schemaname => 'My::Schema', appname => 'MyApp', -- 2.6.0
Thanks for the patch, applied and released as 0.003