This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
replace uses of Test.pm in dist/ distributions (IO, Math-BigInt)
authorKaren Etheridge <ether@cpan.org>
Wed, 17 Sep 2014 19:44:52 +0000 (12:44 -0700)
committerJames E Keenan <jkeenan@cpan.org>
Fri, 19 Sep 2014 01:50:06 +0000 (21:50 -0400)
dist/IO/t/io_linenum.t
dist/Math-BigInt/lib/Math/BigInt.pm

index 259f736..2d44f50 100644 (file)
@@ -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");
index 69fd320..d7dd4d3 100644 (file)
@@ -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