Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Object-String CPAN distribution.

Report information
The Basics
Id: 100598
Status: resolved
Priority: 0/
Queue: Object-String

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

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



Subject: Test suite fails with all perl versions
I see the following test fails for perls between 5.8 and 5.21, linux and freebsd: # Failed test 'test if the string "TEST" is lower case' # at t/String.t line 227. # Failed test 'test if the string "tEST" is lower case' # at t/String.t line 228. # Failed test 'test if the string "test" is upper case' # at t/String.t line 233. # Failed test 'test if the string "tEST" is upper case' # at t/String.t line 235.
Please, add more details because I've tested on my GNU/Linux machines with Perl from 5.12.5 to 5.20.1 and it works with all versions.
On Fri Nov 28 14:41:16 2014, SREZIC wrote: Show quoted text
> I see the following test fails for perls between 5.8 and 5.21, linux > and freebsd: > > # Failed test 'test if the string "TEST" is lower case' > # at t/String.t line 227. > > # Failed test 'test if the string "tEST" is lower case' > # at t/String.t line 228. > > # Failed test 'test if the string "test" is upper case' > # at t/String.t line 233. > > # Failed test 'test if the string "tEST" is upper case' > # at t/String.t line 235.
It works for me on Mac OS X Mountain Lion. Is this a locale-related issue?
On Fri Nov 28 14:41:16 2014, SREZIC wrote: Show quoted text
> I see the following test fails for perls between 5.8 and 5.21, linux > and freebsd: > > # Failed test 'test if the string "TEST" is lower case' > # at t/String.t line 227. > > # Failed test 'test if the string "tEST" is lower case' > # at t/String.t line 228. > > # Failed test 'test if the string "test" is upper case' > # at t/String.t line 233. > > # Failed test 'test if the string "tEST" is upper case' > # at t/String.t line 235.
It works for me on Mac OS X Mountain Lion. Is this a locale-related issue?
Le Sam 29 Nov 2014 08:58:48, SPROUT a écrit : Show quoted text
> On Fri Nov 28 14:41:16 2014, SREZIC wrote:
> > I see the following test fails for perls between 5.8 and 5.21, linux > > and freebsd: > > > > # Failed test 'test if the string "TEST" is lower case' > > # at t/String.t line 227. > > > > # Failed test 'test if the string "tEST" is lower case' > > # at t/String.t line 228. > > > > # Failed test 'test if the string "test" is upper case' > > # at t/String.t line 233. > > > > # Failed test 'test if the string "tEST" is upper case' > > # at t/String.t line 235.
> > It works for me on Mac OS X Mountain Lion. Is this a locale-related issue?
I've tested different locales with different Perl versions on multiple machines and it always works. for example is_upper() method is implemented as this: sub is_upper { my $self = shift; return $self->string eq $self->to_upper->string; } And to_upper() just uses the Perl function uc() (http://perldoc.perl.org/functions/uc.html). Very simple code and I don't get why this fails some tests.
On 2014-11-29 08:15:35, BERZINV wrote: Show quoted text
> Please, add more details because I've tested on my GNU/Linux machines > with Perl from 5.12.5 to 5.20.1 and it works with all versions.
You can find all the test reports here: http://matrix.cpantesters.org/?dist=Object-String+0.06
On 2014-11-29 10:03:28, BERZINV wrote: Show quoted text
> Le Sam 29 Nov 2014 08:58:48, SPROUT a écrit :
> > On Fri Nov 28 14:41:16 2014, SREZIC wrote:
> > > I see the following test fails for perls between 5.8 and 5.21, > > > linux > > > and freebsd: > > > > > > # Failed test 'test if the string "TEST" is lower case' > > > # at t/String.t line 227. > > > > > > # Failed test 'test if the string "tEST" is lower case' > > > # at t/String.t line 228. > > > > > > # Failed test 'test if the string "test" is upper case' > > > # at t/String.t line 233. > > > > > > # Failed test 'test if the string "tEST" is upper case' > > > # at t/String.t line 235.
> > > > It works for me on Mac OS X Mountain Lion. Is this a locale-related > > issue?
> > > I've tested different locales with different Perl versions on multiple > machines and it always works. > > for example is_upper() method is implemented as this: > > sub is_upper { > my $self = shift; > return $self->string eq $self->to_upper->string; > } > > And to_upper() just uses the Perl function uc() > (http://perldoc.perl.org/functions/uc.html). > > Very simple code and I don't get why this fails some tests.
The is_upper and is_lower implementations look broken. to_upper and to_lower are *changing* $self, so after calling the is* methods the string will actually have the upper resp. lower value! Try the following: #!perl use strict; use Test::More 'no_plan'; use Object::String; my $s = str('UPPER'); is $s->string, 'UPPER'; $s->is_lower; is $s->string, 'UPPER'; __END__
Le Sam 29 Nov 2014 12:25:39, SREZIC a écrit : Show quoted text
> On 2014-11-29 10:03:28, BERZINV wrote:
> > Le Sam 29 Nov 2014 08:58:48, SPROUT a écrit :
> > > On Fri Nov 28 14:41:16 2014, SREZIC wrote:
> > > > I see the following test fails for perls between 5.8 and 5.21, > > > > linux > > > > and freebsd: > > > > > > > > # Failed test 'test if the string "TEST" is lower case' > > > > # at t/String.t line 227. > > > > > > > > # Failed test 'test if the string "tEST" is lower case' > > > > # at t/String.t line 228. > > > > > > > > # Failed test 'test if the string "test" is upper case' > > > > # at t/String.t line 233. > > > > > > > > # Failed test 'test if the string "tEST" is upper case' > > > > # at t/String.t line 235.
> > > > > > It works for me on Mac OS X Mountain Lion. Is this a locale- > > > related > > > issue?
> > > > > > I've tested different locales with different Perl versions on > > multiple > > machines and it always works. > > > > for example is_upper() method is implemented as this: > > > > sub is_upper { > > my $self = shift; > > return $self->string eq $self->to_upper->string; > > } > > > > And to_upper() just uses the Perl function uc() > > (http://perldoc.perl.org/functions/uc.html). > > > > Very simple code and I don't get why this fails some tests.
> > The is_upper and is_lower implementations look broken. to_upper and > to_lower are *changing* $self, so after calling the is* methods the > string will actually have the upper resp. lower value! Try the > following: > > #!perl > use strict; > use Test::More 'no_plan'; > use Object::String; > > my $s = str('UPPER'); > is $s->string, 'UPPER'; > $s->is_lower; > is $s->string, 'UPPER'; > __END__
Good point ! Many thanks. Fixed and released a version 0.07.