commit perl-Number-Format for openSUSE:Factory
Hello community, here is the log from the commit of package perl-Number-Format for openSUSE:Factory checked in at 2015-06-30 10:19:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Number-Format (Old) and /work/SRC/openSUSE:Factory/.perl-Number-Format.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-Number-Format" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Number-Format/perl-Number-Format.changes 2013-04-22 14:31:19.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Number-Format.new/perl-Number-Format.changes 2015-06-30 10:19:18.000000000 +0200 @@ -1,0 +2,27 @@ +Mon Jun 29 01:24:48 UTC 2015 - coolo@suse.com + +- updated to 1.75 + see /usr/share/doc/packages/perl-Number-Format/CHANGES + + Changes for version 1.75 (June 25, 2015) + ------------------------ + - Export only necessary from POSIX (RT#99970, thanks Alexandr Ciornii) + - Upgrade Makefile.PL (thanks Alexandr Ciornii) + - Fix testing issue with missing locales (RT 97607, 97766, thanks to KHW) + (thanks David Solimano) + - Fix testing issue with bad Russian data on some platforms (RT 92666) + (thanks David Solimano) + - Add t/bigfloat.t (thanks Paul Miller / Alexandr Ciornii) + + Changes for version 1.74 (April 19, 2011) + ------------------------ + - Only Perl 5.10.0 and newer supported + - Allow multi-character (e.g. " " for thousands_sep) (thanks + Nick Patch; RT 65489) + - Strip out illegal negative values returned by localeconv(), + observed on Windows - see @IGNORE_NEGATIVE (thanks Adam Kennedy; + RT 56802) + - Manage warnings when undef is passed to methods (RT 48038) + - Fix round() for Math::BigFloat objects (RT 62059) + +------------------------------------------------------------------- Old: ---- Number-Format-1.73.tar.gz New: ---- Number-Format-1.75.tar.gz cpanspec.yml ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Number-Format.spec ++++++ --- /var/tmp/diff_new_pack.RTsYFC/_old 2015-06-30 10:19:18.000000000 +0200 +++ /var/tmp/diff_new_pack.RTsYFC/_new 2015-06-30 10:19:18.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Number-Format # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,20 +17,19 @@ Name: perl-Number-Format -Version: 1.73 +Version: 1.75 Release: 0 %define cpan_name Number-Format Summary: Perl extension for formatting numbers License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Number-Format/ -Source: http://www.cpan.org/authors/id/W/WR/WRW/%{cpan_name}-%{version}.tar.gz +Source0: http://www.cpan.org/authors/id/W/WR/WRW/%{cpan_name}-%{version}.tar.gz +Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl -%if 0%{?suse_version} <= 1130 BuildRequires: perl-macros -%endif %{perl_requires} %description @@ -40,7 +39,26 @@ There are two ways to use this package. One is to declare an object of type Number::Format, which you can think of as a formatting engine. The various functions defined here are provided as object methods. The constructor -'new()' can be used to set the parameters of the formatting engine. +'new()' can be used to set the parameters of the formatting engine. Valid +parameters are: + + THOUSANDS_SEP - character inserted between groups of 3 digits + DECIMAL_POINT - character separating integer and fractional parts + MON_THOUSANDS_SEP - like THOUSANDS_SEP, but used for format_price + MON_DECIMAL_POINT - like DECIMAL_POINT, but used for format_price + INT_CURR_SYMBOL - character(s) denoting currency (see format_price()) + DECIMAL_DIGITS - number of digits to the right of dec point (def 2) + DECIMAL_FILL - boolean; whether to add zeroes to fill out decimal + NEG_FORMAT - format to display negative numbers (def ``-x'') + KILO_SUFFIX - suffix to add when format_bytes formats kilobytes (trad) + MEGA_SUFFIX - " " " " " " megabytes (trad) + GIGA_SUFFIX - " " " " " " gigabytes (trad) + KIBI_SUFFIX - suffix to add when format_bytes formats kibibytes (iec) + MEBI_SUFFIX - " " " " " " mebibytes (iec) + GIBI_SUFFIX - " " " " " " gibibytes (iec) + +They may be specified in upper or lower case, with or without a leading +hyphen ( - ). %prep %setup -q -n %{cpan_name}-%{version} ++++++ Number-Format-1.73.tar.gz -> Number-Format-1.75.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/CHANGES new/Number-Format-1.75/CHANGES --- old/Number-Format-1.73/CHANGES 2009-09-26 02:04:34.000000000 +0200 +++ new/Number-Format-1.75/CHANGES 2015-06-25 22:37:54.000000000 +0200 @@ -1,3 +1,24 @@ +Changes for version 1.75 (June 25, 2015) +------------------------ + - Export only necessary from POSIX (RT#99970, thanks Alexandr Ciornii) + - Upgrade Makefile.PL (thanks Alexandr Ciornii) + - Fix testing issue with missing locales (RT 97607, 97766, thanks to KHW) + (thanks David Solimano) + - Fix testing issue with bad Russian data on some platforms (RT 92666) + (thanks David Solimano) + - Add t/bigfloat.t (thanks Paul Miller / Alexandr Ciornii) + +Changes for version 1.74 (April 19, 2011) +------------------------ + - Only Perl 5.10.0 and newer supported + - Allow multi-character (e.g. " " for thousands_sep) (thanks + Nick Patch; RT 65489) + - Strip out illegal negative values returned by localeconv(), + observed on Windows - see @IGNORE_NEGATIVE (thanks Adam Kennedy; + RT 56802) + - Manage warnings when undef is passed to methods (RT 48038) + - Fix round() for Math::BigFloat objects (RT 62059) + Changes for version 1.73 (September 25, 2009) ------------------------ - Fix locale.t for RUR/RUB distinction (thanks Kevin Phair; RT 46660/45833) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/Format.pm new/Number-Format-1.75/Format.pm --- old/Number-Format-1.73/Format.pm 2009-09-26 01:47:51.000000000 +0200 +++ new/Number-Format-1.75/Format.pm 2015-06-25 22:31:52.000000000 +0200 @@ -1,8 +1,8 @@ package Number::Format; -# Minimum version is 5.8.0. May work on earlier versions, but not -# supported on any version older than 5.8. -require 5.008; +# Minimum version is 5.10.0. May work on earlier versions, but not +# supported on any version older than 5.10. Hack this line at your own risk: +require 5.010; use strict; use warnings; @@ -142,8 +142,8 @@ systems. The only restrictions on C<DECIMAL_POINT> and C<THOUSANDS_SEP> are that -they must not be digits, must not be identical, and must each be one -character. There are no restrictions on C<INT_CURR_SYMBOL>. +they must not be digits and must not be identical. There are no +restrictions on C<INT_CURR_SYMBOL>. For example, a German user might include this in their code: @@ -178,7 +178,7 @@ use strict; use Exporter; use Carp; -use POSIX; +use POSIX qw(localeconv); use base qw(Exporter); our @EXPORT_SUBS = @@ -211,7 +211,7 @@ other_vars => \@EXPORT_OTHER, all => \@EXPORT_ALL ); -our $VERSION = '1.73'; +our $VERSION = '1.75'; # Refer to http://www.opengroup.org/onlinepubs/007908775/xbd/locale.html # for more details about the POSIX variables @@ -285,6 +285,17 @@ ) }; # +# On Windows, the POSIX localeconv() call returns illegal negative +# numbers for some values, seemingly attempting to indicate null. The +# following list indicates the values for which this has been +# observed, and for which the values should be stripped out of +# localeconv(). +# +our @IGNORE_NEGATIVE = qw( frac_digits int_frac_digits + n_cs_precedes n_sep_by_space n_sign_posn + p_xs_precedes p_sep_by_space p_sign_posn ); + +# # Largest integer a 32-bit Perl can handle is based on the mantissa # size of a double float, which is up to 53 bits. While we may be # able to support larger values on 64-bit systems, some Perl integer @@ -378,6 +389,23 @@ } } +##---------------------------------------------------------------------- + +# _complain_undef displays a warning message on STDERR and is called +# when a subroutine has been invoked with an undef value. A warning +# message is printed if the calling environment has "uninitialized" +# warnings enabled. + +sub _complain_undef +{ + my @stack; + my($sub, $bitmask) = (caller(1))[3,9]; + my $offset = $warnings::Offsets{"uninitialized"}; + carp "Use of uninitialized value in call to $sub" + if vec($bitmask, $offset, 1); +} + + ###--------------------------------------------------------------------- =head1 METHODS @@ -411,7 +439,14 @@ # my $locale = setlocale(LC_ALL, ""); my $locale_values = localeconv(); - my $arg; + # Strip out illegal negative values from the current locale + foreach ( @IGNORE_NEGATIVE ) + { + if (defined($locale_values->{$_}) && $locale_values->{$_} eq '-1') + { + delete $locale_values->{$_}; + } + } while(my($arg, $default) = each %$DEFAULT_LOCALE) { @@ -472,9 +507,25 @@ sub round { my ($self, $number, $precision) = _get_self @_; + + unless (defined($number)) + { + _complain_undef(); + $number = 0; + } + $precision = $self->{decimal_digits} unless defined $precision; $precision = 2 unless defined $precision; - $number = 0 unless defined $number; + + croak("precision must be integer") + unless int($precision) == $precision; + + if (ref($number) && $number->isa("Math::BigFloat")) + { + my $rounded = $number->copy(); + $rounded->precision(-$precision); + return $rounded; + } my $sign = $number <=> 0; my $multiplier = (10 ** $precision); @@ -527,6 +578,13 @@ sub format_number { my ($self, $number, $precision, $trailing_zeroes, $mon) = _get_self @_; + + unless (defined($number)) + { + _complain_undef(); + $number = 0; + } + $self->_check_seps(); # first make sure the SEP variables are valid my($thousands_sep, $decimal_point) = @@ -577,8 +635,8 @@ $integer = join($thousands_sep, grep {$_ ne ''} split(/(...)/, $integer)); - # Strip off leading zeroes and/or comma - $integer =~ s/^0+\Q$thousands_sep\E?//; + # Strip off leading zeroes and optional thousands separator + $integer =~ s/^0+(?:\Q$thousands_sep\E)?//; } $integer = '0' if $integer eq ''; @@ -606,6 +664,13 @@ sub format_negative { my($self, $number, $format) = _get_self @_; + + unless (defined($number)) + { + _complain_undef(); + $number = 0; + } + $format = $self->{neg_format} unless defined $format; croak "Letter x must be present in picture in format_negative()" unless $format =~ /x/; @@ -649,6 +714,15 @@ sub format_picture { my ($self, $number, $picture) = _get_self @_; + + unless (defined($number)) + { + _complain_undef(); + $number = 0; + } + + croak "Picture not defined" unless defined($picture); + $self->_check_seps(); # Handle negative numbers @@ -770,6 +844,12 @@ { my ($self, $number, $precision, $curr_symbol) = _get_self @_; + unless (defined($number)) + { + _complain_undef(); + $number = 0; + } + # Determine what the monetary symbol should be $curr_symbol = $self->{int_curr_symbol} if (!defined($curr_symbol) || lc($curr_symbol) eq "int_curr_symbol"); @@ -992,6 +1072,12 @@ { my ($self, $number, @options) = _get_self @_; + unless (defined($number)) + { + _complain_undef(); + $number = 0; + } + croak "Negative number not allowed in format_bytes" if $number < 0; @@ -1135,6 +1221,13 @@ sub unformat_number { my ($self, $formatted, %options) = _get_self @_; + + unless (defined($formatted)) + { + _complain_undef(); + $formatted = ""; + } + $self->_check_seps(); return undef unless $formatted =~ /\d/; # require at least one digit diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/MANIFEST new/Number-Format-1.75/MANIFEST --- old/Number-Format-1.73/MANIFEST 2008-07-03 01:25:01.000000000 +0200 +++ new/Number-Format-1.75/MANIFEST 2015-06-25 22:39:55.000000000 +0200 @@ -14,3 +14,4 @@ t/object.t t/round.t t/unformat_number.t +META.json Module JSON meta-data (added by MakeMaker) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/META.json new/Number-Format-1.75/META.json --- old/Number-Format-1.73/META.json 1970-01-01 01:00:00.000000000 +0100 +++ new/Number-Format-1.75/META.json 2015-06-25 22:39:55.000000000 +0200 @@ -0,0 +1,51 @@ +{ + "abstract" : "Perl extension for formatting numbers", + "author" : [ + "William R. Ward <wrw@cpan.org>" + ], + "dynamic_config" : 1, + "generated_by" : "ExtUtils::MakeMaker version 6.72, CPAN::Meta::Converter version 2.120630", + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "Number-Format", + "no_index" : { + "directory" : [ + "t", + "inc" + ] + }, + "prereqs" : { + "build" : { + "requires" : { + "ExtUtils::MakeMaker" : "0", + "Test::More" : "0" + } + }, + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "runtime" : { + "requires" : { + "Carp" : "0", + "POSIX" : "0" + } + } + }, + "release_status" : "stable", + "resources" : { + "bugtracker" : { + "web" : "https://rt.cpan.org/NoAuth/Bugs.html?Dist=Number-Format" + }, + "repository" : { + "url" : "https://github.com/billward/number-format-perl.git" + } + }, + "version" : "1.75" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/META.yml new/Number-Format-1.75/META.yml --- old/Number-Format-1.73/META.yml 2009-09-26 02:07:06.000000000 +0200 +++ new/Number-Format-1.75/META.yml 2015-06-25 22:39:55.000000000 +0200 @@ -1,16 +1,27 @@ ---- #YAML:1.0 -name: Number-Format -version: 1.73 -abstract: Perl extension for formatting numbers -license: perl -author: - - William R. Ward <wrw@cpan.org> -generated_by: ExtUtils::MakeMaker version 6.42 -distribution_type: module -requires: - Carp: 0 - POSIX: 0 - Test::More: 0 +--- +abstract: 'Perl extension for formatting numbers' +author: + - 'William R. Ward <wrw@cpan.org>' +build_requires: + ExtUtils::MakeMaker: 0 + Test::More: 0 +configure_requires: + ExtUtils::MakeMaker: 0 +dynamic_config: 1 +generated_by: 'ExtUtils::MakeMaker version 6.72, CPAN::Meta::Converter version 2.120630' +license: perl meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.3.html - version: 1.3 + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: Number-Format +no_index: + directory: + - t + - inc +requires: + Carp: 0 + POSIX: 0 +resources: + bugtracker: https://rt.cpan.org/NoAuth/Bugs.html?Dist=Number-Format + repository: https://github.com/billward/number-format-perl.git +version: 1.75 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/Makefile.PL new/Number-Format-1.75/Makefile.PL --- old/Number-Format-1.73/Makefile.PL 2009-05-05 23:42:39.000000000 +0200 +++ new/Number-Format-1.75/Makefile.PL 2015-06-25 21:56:19.000000000 +0200 @@ -3,15 +3,49 @@ use warnings; use ExtUtils::MakeMaker; -WriteMakefile - ( NAME => 'Number::Format', +WriteMakefile1( + NAME => 'Number::Format', VERSION_FROM => 'Format.pm', # finds $VERSION - PREREQ_PM => { 'Test::More' => 0, - 'Carp' => 0, + PREREQ_PM => { 'Carp' => 0, 'POSIX' => 0 }, + TEST_REQUIRES => { 'Test::More' => 0, }, - ($ExtUtils::MakeMaker::VERSION ge '6.31'? (LICENSE => 'perl', ) : ()), - + LICENSE => 'perl', + META_MERGE => { + resources => { + repository => 'https://github.com/billward/number-format-perl.git', + bugtracker => 'https://rt.cpan.org/NoAuth/Bugs.html?Dist=Number-Format', + }, + }, AUTHOR => 'William R. Ward <wrw@'.'cpan.org>', ABSTRACT => 'Perl extension for formatting numbers', ); + +sub WriteMakefile1 { #Compatibility code for old versions of EU::MM. Written by Alexandr Ciornii, version 0.23. Added by eumm-upgrade. + my %params=@_; + my $eumm_version=$ExtUtils::MakeMaker::VERSION; + $eumm_version=eval $eumm_version; + die "EXTRA_META is deprecated" if exists $params{EXTRA_META}; + die "License not specified" if not exists $params{LICENSE}; + if ($params{AUTHOR} and ref($params{AUTHOR}) eq 'ARRAY' and $eumm_version < 6.5705) { + $params{META_ADD}->{author}=$params{AUTHOR}; + $params{AUTHOR}=join(', ',@{$params{AUTHOR}}); + } + if ($params{TEST_REQUIRES} and $eumm_version < 6.64) { + $params{BUILD_REQUIRES}={ %{$params{BUILD_REQUIRES} || {}} , %{$params{TEST_REQUIRES}} }; + delete $params{TEST_REQUIRES}; + } + if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) { + #EUMM 6.5502 has problems with BUILD_REQUIRES + $params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} }; + delete $params{BUILD_REQUIRES}; + } + delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52; + delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48; + delete $params{META_MERGE} if $eumm_version < 6.46; + delete $params{META_ADD} if $eumm_version < 6.46; + delete $params{LICENSE} if $eumm_version < 6.31; + + WriteMakefile(%params); +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/t/format_bytes.t new/Number-Format-1.75/t/format_bytes.t --- old/Number-Format-1.73/t/format_bytes.t 2009-05-05 22:52:30.000000000 +0200 +++ new/Number-Format-1.75/t/format_bytes.t 2015-06-25 21:56:19.000000000 +0200 @@ -4,6 +4,9 @@ use strict; use warnings; +use POSIX; +setlocale(&LC_ALL, 'C'); + BEGIN { use_ok('Number::Format', ':subs') } is(format_bytes(123.51), '123.51', 'no change'); @@ -30,3 +33,12 @@ is(format_bytes(1234567890.1, mode => "iec"), '1.15GiB', 'gibi'); is(format_bytes(1048576, mode => "iec", unit => 'K'), '1,024KiB', 'iec unit'); + +{ + my @warnings; + local $SIG{__WARN__} = sub { @warnings = @_ }; + is(format_bytes(undef), "0"); + my $file = __FILE__; + like("@warnings", + qr{Use of uninitialized value in call to Number::Format::format_bytes at \Q$file\E line \d+[.]?\n}); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/t/format_negative.t new/Number-Format-1.75/t/format_negative.t --- old/Number-Format-1.73/t/format_negative.t 2009-05-05 22:52:39.000000000 +0200 +++ new/Number-Format-1.75/t/format_negative.t 2015-06-25 21:56:19.000000000 +0200 @@ -5,7 +5,7 @@ use warnings; use POSIX; -setlocale(&LC_ALL, 'en_US'); +setlocale(&LC_ALL, 'C'); BEGIN { use_ok('Number::Format') } @@ -20,3 +20,12 @@ $x->{neg_format}='(x)'; is($x->format_number(-1), '(1.00000)', 'neg paren'); is($x->format_number(-.5), '(0.50000)', 'neg paren zero'); + +{ + my @warnings; + local $SIG{__WARN__} = sub { @warnings = @_ }; + is($x->format_negative(undef), "(0)"); + my $file = __FILE__; + like("@warnings", + qr{Use of uninitialized value in call to Number::Format::format_negative at \Q$file\E line \d+[.]?\n}); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/t/format_number.t new/Number-Format-1.75/t/format_number.t --- old/Number-Format-1.73/t/format_number.t 2009-05-05 22:52:50.000000000 +0200 +++ new/Number-Format-1.75/t/format_number.t 2015-06-25 21:56:19.000000000 +0200 @@ -5,7 +5,7 @@ use warnings; use POSIX; -setlocale(&LC_ALL, 'en_US'); +setlocale(&LC_ALL, 'C'); BEGIN { use_ok('Number::Format', ':subs') } @@ -27,3 +27,29 @@ like($@, qr/^\Qround() overflow. Try smaller precision or use Math::BigFloat/, "round overflow"); + +# +# https://rt.cpan.org/Ticket/Display.html?id=48038 +# Test with warnings enabled - expect a warning when called with undef +# +{ + my @warnings; + local $SIG{__WARN__} = sub { @warnings = @_ }; + is(format_number(undef), "0"); + my $file = __FILE__; + like("@warnings", + qr{Use of uninitialized value in call to Number::Format::format_number at \Q$file\E line \d+[.]?\n}); +} + +# +# https://rt.cpan.org/Ticket/Display.html?id=48038 +# Test again with warnings disabled to see if we do NOT get the warning +# +{ + no warnings "uninitialized"; + my @warnings; + local $SIG{__WARN__} = sub { @warnings = @_ }; + is(format_number(undef), "0"); + my $file = __FILE__; + is("@warnings", ""); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/t/format_picture.t new/Number-Format-1.75/t/format_picture.t --- old/Number-Format-1.73/t/format_picture.t 2009-05-05 23:31:39.000000000 +0200 +++ new/Number-Format-1.75/t/format_picture.t 2015-06-25 21:56:19.000000000 +0200 @@ -5,7 +5,7 @@ use warnings; use POSIX; -setlocale(&LC_ALL, 'en_US'); +setlocale(&LC_ALL, 'C'); BEGIN { use_ok('Number::Format') } @@ -26,3 +26,12 @@ $pic = '#'; is($x->format_picture(1, $pic), ' 1 ', 'one digit 1'); is($x->format_picture(2, $pic), ' 2 ', 'one digit 2'); + +{ + my @warnings; + local $SIG{__WARN__} = sub { @warnings = @_ }; + is($x->format_picture(undef, $pic), " 0 "); + my $file = __FILE__; + like("@warnings", + qr{Use of uninitialized value in call to Number::Format::format_picture at \Q$file\E line \d+[.]?\n}); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/t/format_price.t new/Number-Format-1.75/t/format_price.t --- old/Number-Format-1.73/t/format_price.t 2009-05-05 23:32:02.000000000 +0200 +++ new/Number-Format-1.75/t/format_price.t 2015-06-25 21:56:19.000000000 +0200 @@ -5,7 +5,7 @@ use warnings; use POSIX; -setlocale(&LC_ALL, 'en_US'); +setlocale(&LC_ALL, 'C'); BEGIN { use_ok('Number::Format') } @@ -169,3 +169,12 @@ my $want = $prices{$price}; is($nf->format_price($price, 2), $want, "$price -> $want"); } + +{ + my @warnings; + local $SIG{__WARN__} = sub { @warnings = @_ }; + is($nf->format_price(undef), "EUR 0,00"); + my $file = __FILE__; + like("@warnings", + qr{Use of uninitialized value in call to Number::Format::format_price at \Q$file\E line \d+[.]?\n}); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/t/locale.t new/Number-Format-1.75/t/locale.t --- old/Number-Format-1.73/t/locale.t 2009-09-26 01:51:01.000000000 +0200 +++ new/Number-Format-1.75/t/locale.t 2015-06-25 21:56:19.000000000 +0200 @@ -46,6 +46,9 @@ or skip("Unable to set ru_RU locale", 1); my $russian = Number::Format->new(); + # On some sysetms (notably Cygwin) the locale data is wrong for ru_RU. + # Force it to match what we would see on Linux so the test passes. + $russian->{n_sep_by_space} = $russian->{p_sep_by_space} = '1'; my $sep = $russian->{mon_thousands_sep}; my $dec = $russian->{mon_decimal_point}; my $num = "123${sep}456${dec}79"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/t/object.t new/Number-Format-1.75/t/object.t --- old/Number-Format-1.73/t/object.t 2009-05-05 22:53:24.000000000 +0200 +++ new/Number-Format-1.75/t/object.t 2015-06-25 21:56:19.000000000 +0200 @@ -5,7 +5,7 @@ use warnings; use POSIX; -setlocale(&LC_ALL, 'en_US'); +setlocale(&LC_ALL, 'C'); BEGIN { use_ok('Number::Format') } @@ -17,3 +17,14 @@ is($deutsch->format_number(1234567.509, 2), '1.234.567,51', 'round'); is($deutsch->format_number(12345678.5, 2), '12.345.678,5', 'tousends'); is($deutsch->format_number(1.23456789, 6), '1,234568', 'big frac'); + +my $double_char = Number::Format->new( + -thousands_sep => ' ', + -decimal_point => ',', +); + +is( + $double_char->format_number(12345678.5), + "12 345 678,5", + 'multi-char thousands separator' +); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/t/round.t new/Number-Format-1.75/t/round.t --- old/Number-Format-1.73/t/round.t 2009-05-05 22:53:31.000000000 +0200 +++ new/Number-Format-1.75/t/round.t 2015-06-25 21:56:19.000000000 +0200 @@ -5,7 +5,7 @@ use warnings; use POSIX; -setlocale(&LC_ALL, 'en_US'); +setlocale(&LC_ALL, 'C'); BEGIN { use_ok('Number::Format', ':subs') } @@ -37,3 +37,12 @@ my($p, $q) = @_; return abs($p - $q) < 1e-10; } + +{ + my @warnings; + local $SIG{__WARN__} = sub { @warnings = @_ }; + is(round(undef), "0"); + my $file = __FILE__; + like("@warnings", + qr{Use of uninitialized value in call to Number::Format::round at \Q$file\E line \d+[.]?\n}); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Number-Format-1.73/t/unformat_number.t new/Number-Format-1.75/t/unformat_number.t --- old/Number-Format-1.73/t/unformat_number.t 2009-05-05 22:53:41.000000000 +0200 +++ new/Number-Format-1.75/t/unformat_number.t 2015-06-25 21:56:19.000000000 +0200 @@ -5,7 +5,7 @@ use warnings; use POSIX; -setlocale(&LC_ALL, 'en_US'); +setlocale(&LC_ALL, 'C'); BEGIN { use_ok('Number::Format', ':subs') } @@ -45,3 +45,12 @@ eval { unformat_number("4G", base => -1) }; like($@, qr/^\Qbase must be a positive integer/, "base neg"); + +{ + my @warnings; + local $SIG{__WARN__} = sub { @warnings = @_ }; + is(unformat_number(undef), undef); + my $file = __FILE__; + like("@warnings", + qr{Use of uninitialized value in call to Number::Format::unformat_number at \Q$file\E line \d+[.]?\n}); +} ++++++ cpanspec.yml ++++++ --- description_paragraphs: 3 #no_testing: broken upstream #sources: # - source1 # - source2 #patches: # foo.patch: -p1 # bar.patch: #preamble: |- # BuildRequires: gcc-c++ #post_prep: |- # hunspell=`pkg-config --libs hunspell | sed -e 's,-l,,; s, *,,g'` # sed -i -e "s,hunspell-X,$hunspell," t/00-prereq.t Makefile.PL #post_install: |- # sed on %{name}.files #license: SUSE-NonFree #skip_noarch: 1 #custom_build: |- #./Build build flags=%{?_smp_mflags} --myflag #custom_test: |- #startserver && make test #ignore_requires: Bizarre::Module
participants (1)
-
root@hilbert.suse.de