In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/a0732aaa4b015e55976f0134a2724c959d528d34?hp=343573e55dd98365d2c5bac8401a9b1473cc0789>
- Log ----------------------------------------------------------------- commit a0732aaa4b015e55976f0134a2724c959d528d34 Author: James E Keenan <[email protected]> Date: Thu Sep 18 21:56:01 2014 -0400 Increment $VERSION in Math::BigInt. M dist/Math-BigInt/lib/Math/BigInt.pm commit e50b06d752b18022c7f69649384cd6373fb751df Author: Karen Etheridge <[email protected]> Date: Wed Sep 17 12:44:52 2014 -0700 replace uses of Test.pm in dist/ distributions (IO, Math-BigInt) M dist/IO/t/io_linenum.t M dist/Math-BigInt/lib/Math/BigInt.pm ----------------------------------------------------------------------- Summary of changes: dist/IO/t/io_linenum.t | 30 ++++++++++++++---------------- dist/Math-BigInt/lib/Math/BigInt.pm | 24 +++++++++++------------- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/dist/IO/t/io_linenum.t b/dist/IO/t/io_linenum.t index 259f736..2d44f50 100644 --- a/dist/IO/t/io_linenum.t +++ b/dist/IO/t/io_linenum.t @@ -10,9 +10,7 @@ BEGIN { require strict; import strict; } -use Test; - -BEGIN { plan tests => 12 } +use Test::More tests => 12; use IO::File; @@ -32,42 +30,42 @@ open (F, $File) or die $!; my $io = IO::File->new($File) or die $!; <F> for (1 .. 10); -ok(lineno($io), "10 0 10"); +is(lineno($io), "10 0 10"); $io->getline for (1 .. 5); -ok(lineno($io), "5 5 5"); +is(lineno($io), "5 5 5"); <F>; -ok(lineno($io), "11 5 11"); +is(lineno($io), "11 5 11"); $io->getline; -ok(lineno($io), "6 6 6"); +is(lineno($io), "6 6 6"); $t = tell F; # tell F; provokes a warning -ok(lineno($io), "11 6 11"); +is(lineno($io), "11 6 11"); <F>; -ok(lineno($io), "12 6 12"); +is(lineno($io), "12 6 12"); select F; -ok(lineno($io), "12 6 12"); +is(lineno($io), "12 6 12"); <F> for (1 .. 10); -ok(lineno($io), "22 6 22"); +is(lineno($io), "22 6 22"); $io->getline for (1 .. 5); -ok(lineno($io), "11 11 11"); +is(lineno($io), "11 11 11"); $t = tell F; # We used to have problems here before local $. worked. # input_line_number() used to use select and tell. When we did the -# same, that mechanism broke. It should work now. -ok(lineno($io), "22 11 22"); +# same, that mechanism brise. It should work now. +is(lineno($io), "22 11 22"); { local $.; $io->getline for (1 .. 5); - ok(lineno($io), "16 16 16"); + is(lineno($io), "16 16 16"); } -ok(lineno($io), "22 16 22"); +is(lineno($io), "22 16 22"); diff --git a/dist/Math-BigInt/lib/Math/BigInt.pm b/dist/Math-BigInt/lib/Math/BigInt.pm index 69fd320..62f1be9 100644 --- a/dist/Math-BigInt/lib/Math/BigInt.pm +++ b/dist/Math-BigInt/lib/Math/BigInt.pm @@ -18,7 +18,7 @@ package Math::BigInt; my $class = "Math::BigInt"; use 5.006002; -$VERSION = '1.9996'; +$VERSION = '1.9997'; @ISA = qw(Exporter); @EXPORT_OK = qw(objectify bgcd blcm); @@ -4793,13 +4793,13 @@ change. Examples for rounding: use Math::BigFloat; - use Test; + use Test::More; $x = Math::BigFloat->new(123.4567); $y = Math::BigFloat->new(123.456789); Math::BigFloat->accuracy(4); # no more A than 4 - ok ($x->copy()->fround(),123.4); # even rounding + is ($x->copy()->fround(),123.4); # even rounding print $x->copy()->fround(),"\n"; # 123.4 Math::BigFloat->round_mode('odd'); # round to odd print $x->copy()->fround(),"\n"; # 123.5 @@ -5030,8 +5030,8 @@ known to be troublesome: Both C<bstr()> and C<bsstr()> as well as automated stringify via overload now drop the leading '+'. The old code would return '+3', the new returns '3'. This is to be consistent with Perl and to make C<cmp> (especially with -overloading) to work as you expect. It also solves problems with C<Test.pm>, -because its C<ok()> uses 'eq' internally. +overloading) to work as you expect. It also solves problems with C<Test.pm> +and L<Test::More>, which stringify arguments before comparing them. Mark Biggar said, when asked about to drop the '+' altogether, or make only C<cmp> work: @@ -5043,14 +5043,13 @@ C<cmp> work: So, the following examples will now work all as expected: - use Test; - BEGIN { plan tests => 1 } + use Test::More tests => 1; use Math::BigInt; my $x = new Math::BigInt 3*3; my $y = new Math::BigInt 3*3; - ok ($x,3*3); + is ($x,3*3, 'multiplication'); print "$x eq 9" if $x eq $y; print "$x eq 9" if $x eq '9'; print "$x eq 9" if $x eq 3*3; @@ -5067,15 +5066,14 @@ for comparison, but Perl will represent some numbers as 100 and others as 1e+308. If in doubt, convert both arguments to Math::BigInt before comparing them as strings: - use Test; - BEGIN { plan tests => 3 } + use Test::More tests => 3; use Math::BigInt; $x = Math::BigInt->new('1e56'); $y = 1e56; - ok ($x,$y); # will fail - ok ($x->bsstr(),$y); # okay + is ($x,$y); # will fail + is ($x->bsstr(),$y); # okay $y = Math::BigInt->new($y); - ok ($x,$y); # okay + is ($x,$y); # okay Alternatively, simply use C<< <=> >> for comparisons, this will get it always right. There is not yet a way to get a number automatically represented -- Perl5 Master Repository
