Bug 13836 - Koha/Number/Price.pm: format_for_editing fails 3 tests because of leading spaces in output
Summary: Koha/Number/Price.pm: format_for_editing fails 3 tests because of leading spa...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-15 06:32 UTC by Marc Véron
Modified: 2015-12-03 22:03 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 13836: Does not separate symbol and value if symbol is not displayed. (959 bytes, patch)
2015-03-16 14:25 UTC, Jonathan Druart
Details | Diff | Splinter Review
[Signed-off] Bug 13836: Does not separate symbol and value if symbol is not displayed. (1.15 KB, patch)
2015-03-16 14:58 UTC, Marc Véron
Details | Diff | Splinter Review
[PASSED QA] Bug 13836: Does not separate symbol and value if symbol is not displayed. (1.20 KB, patch)
2015-03-16 21:29 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Véron 2015-03-15 06:32:47 UTC
#   Failed test 'format_for_editing should return unformated integer part with 2 decimals'
#   at t/Prices.t line 610.
#          got: ' 1234567.00'
#     expected: '1234567.00'
Comment 1 Katrin Fischer 2015-03-15 23:09:22 UTC
Hi Marc,

they pass ok for me:

prove t/Prices.t 
t/Prices.t .. ok     
All tests successful.
Files=1, Tests=16,  1 wallclock secs ( 0.04 usr  0.00 sys +  0.59 cusr  0.05 csys =  0.68 CPU)
Result: PASS
Comment 2 Marc Véron 2015-03-16 07:09:05 UTC
Hi Katrin,

See my results below. 
Maybe related to Number::Format?

cpan -D Number::Format 	
Installed: 1.73
CPAN:      1.73  up to date

http://search.cpan.org/~wrw/Number-Format-1.73/Format.pm

Koha version 3.19.00.016
Perl version 5.014002

------------
prove t/Prices.t
t/Prices.t .. 1/16 
#   Failed test 'format_for_editing should return unformated integer part with 2 decimals'
#   at t/Prices.t line 610.
#          got: ' 1234567.00'
#     expected: '1234567.00'

#   Failed test 'format_for_editing should return unformated integer part with 2 decimals'
#   at t/Prices.t line 611.
#          got: ' 1234567.89'
#     expected: '1234567.89'

#   Failed test 'format_for_editing should return unformated integer part with 2 decimals'
#   at t/Prices.t line 610.
#          got: ' 1234567.00'
#     expected: '1234567.00'

#   Failed test 'format_for_editing should return unformated integer part with 2 decimals'
#   at t/Prices.t line 611.
#          got: ' 1234567.89'
#     expected: '1234567.89'
# Looks like you failed 4 tests of 16.
t/Prices.t .. Dubious, test returned 4 (wstat 1024, 0x400)
Failed 4/16 subtests 

Test Summary Report
-------------------
t/Prices.t (Wstat: 1024 Tests: 16 Failed: 4)
  Failed tests:  13-16
  Non-zero exit status: 4
Files=1, Tests=16,  1 wallclock secs ( 0.01 usr  0.01 sys +  0.35 cusr  0.18 csys =  0.55 CPU)
Result: FAIL
Comment 3 Katrin Fischer 2015-03-16 08:25:17 UTC
Hi Marc, I have the same version. What is your locale setting?
Comment 4 Marc Véron 2015-03-16 10:05:02 UTC
Hi Katrin,

# dpkg -l locales

||/ Name           Version      Architektur  Beschreibung
+++-==============-============-============-=================================
ii  locales        2.13-38+deb7 all          Embedded GNU C Library: National 

# locale
LANG=de_CH.UTF-8
LANGUAGE=de_CH:de
LC_CTYPE="de_CH.UTF-8"
LC_NUMERIC="de_CH.UTF-8"
LC_TIME="de_CH.UTF-8"
LC_COLLATE="de_CH.UTF-8"
LC_MONETARY="de_CH.UTF-8"
LC_MESSAGES="de_CH.UTF-8"
LC_PAPER="de_CH.UTF-8"
LC_NAME="de_CH.UTF-8"
LC_ADDRESS="de_CH.UTF-8"
LC_TELEPHONE="de_CH.UTF-8"
LC_MEASUREMENT="de_CH.UTF-8"
LC_IDENTIFICATION="de_CH.UTF-8"
LC_ALL=
Comment 5 Marc Véron 2015-03-16 10:43:50 UTC
With de_DE.UTF-8 *) tests pass OK

What impact have locales on Koha?
Could there be bugs related to locales?


*)
# locale
LANG=de_DE.UTF-8
LANGUAGE=de_CH:de
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=
Comment 6 Katrin Fischer 2015-03-16 10:50:28 UTC
I think it's the Number::Price that might be a bit specific here - adding Jonathan to the bug report.
Comment 7 Jonathan Druart 2015-03-16 14:25:27 UTC Comment hidden (obsolete)
Comment 8 Marc Véron 2015-03-16 14:58:35 UTC Comment hidden (obsolete)
Comment 9 Katrin Fischer 2015-03-16 21:29:42 UTC
Created attachment 36937 [details] [review]
[PASSED QA] Bug 13836: Does not separate symbol and value if symbol is not displayed.

This patch force the separation between the symbol and the value to an
empty string if the symbol is not displayed.

Tested with locale de_CH.UTF-8, prove t/Prices.t is now successful.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Tomás Cohen Arazi 2015-03-19 17:13:12 UTC
Patch pushed to master.

Thanks Jonathan!
Comment 11 Chris Cormack 2015-03-22 05:13:43 UTC
Pushed to 3.18.x will be in 3.18.5