Subject: | Doc/Code mismatch in positive integers |
Carp::Assert::More's documentation indicates that "14." should pass as a
positive integer, but this case actually fails. Since "14." is not an
integer according to assert_integer, assert_positive_integer should not
pass it either.
I have attached a proposed patch which corrects the docs and adds the
"14." case to the numeric tests.
diff -ru Carp-Assert-More-1.08-orig/More.pm Carp-Assert-More-1.08/More.pm
--- Carp-Assert-More-1.08-orig/More.pm 2004-11-24 11:46:22.000000000 -0600
+++ Carp-Assert-More-1.08/More.pm 2005-02-16 08:22:56.000000000 -0600
@@ -286,9 +286,10 @@
Asserts that the numeric value of I<$this> is greater than zero, and
that I<$this> is an integer.
- assert_positive_integer( 0 ); # FAIL
- assert_positive_integer( -14 ); # FAIL
- assert_positive_integer( '14.' ); # pass
+ assert_positive_integer( 0 ); # FAIL
+ assert_positive_integer( -14 ); # FAIL
+ assert_positive_integer( '14.' ); # FAIL
+ assert_positive_integer( '14' ); # pass
=cut
Only in Carp-Assert-More-1.08: More.pm~
diff -ru Carp-Assert-More-1.08-orig/t/assert_integer.t Carp-Assert-More-1.08/t/assert_integer.t
--- Carp-Assert-More-1.08-orig/t/assert_integer.t 2004-11-24 10:26:51.000000000 -0600
+++ Carp-Assert-More-1.08/t/assert_integer.t 2005-02-16 08:18:14.000000000 -0600
@@ -3,7 +3,7 @@
use warnings;
use strict;
-use Test::More tests=>6;
+use Test::More tests=>7;
BEGIN { use_ok( 'Carp::Assert::More' ); }
@@ -16,6 +16,7 @@
[ 0.4, FAIL ],
[ -10, PASS ],
[ "dog", FAIL ],
+ [ "14.", FAIL ],
);
for my $case ( @cases ) {
diff -ru Carp-Assert-More-1.08-orig/t/assert_negative_integer.t Carp-Assert-More-1.08/t/assert_negative_integer.t
--- Carp-Assert-More-1.08-orig/t/assert_negative_integer.t 2004-11-24 10:26:51.000000000 -0600
+++ Carp-Assert-More-1.08/t/assert_negative_integer.t 2005-02-16 08:19:49.000000000 -0600
@@ -3,7 +3,7 @@
use warnings;
use strict;
-use Test::More tests=>7;
+use Test::More tests=>8;
BEGIN { use_ok( 'Carp::Assert::More' ); }
@@ -17,6 +17,7 @@
[ -10, PASS ],
[ -97.9, FAIL ],
[ "dog", FAIL ],
+ [ "14.", FAIL ],
);
for my $case ( @cases ) {
diff -ru Carp-Assert-More-1.08-orig/t/assert_negative.t Carp-Assert-More-1.08/t/assert_negative.t
--- Carp-Assert-More-1.08-orig/t/assert_negative.t 2004-11-24 10:26:51.000000000 -0600
+++ Carp-Assert-More-1.08/t/assert_negative.t 2005-02-16 08:19:36.000000000 -0600
@@ -3,7 +3,7 @@
use warnings;
use strict;
-use Test::More tests=>6;
+use Test::More tests=>7;
BEGIN { use_ok( 'Carp::Assert::More' ); }
@@ -16,6 +16,7 @@
[ 0.4, FAIL ],
[ -10, PASS ],
[ "dog", FAIL ],
+ [ "14.", FAIL ],
);
for my $case ( @cases ) {
diff -ru Carp-Assert-More-1.08-orig/t/assert_nonzero_integer.t Carp-Assert-More-1.08/t/assert_nonzero_integer.t
--- Carp-Assert-More-1.08-orig/t/assert_nonzero_integer.t 2004-11-24 10:26:51.000000000 -0600
+++ Carp-Assert-More-1.08/t/assert_nonzero_integer.t 2005-02-16 08:20:35.000000000 -0600
@@ -3,7 +3,7 @@
use warnings;
use strict;
-use Test::More tests=>6;
+use Test::More tests=>7;
BEGIN { use_ok( 'Carp::Assert::More' ); }
@@ -16,6 +16,7 @@
[ 0.4, FAIL ],
[ -10, PASS ],
[ "dog", FAIL ],
+ [ "14.", FAIL ],
);
for my $case ( @cases ) {
diff -ru Carp-Assert-More-1.08-orig/t/assert_nonzero.t Carp-Assert-More-1.08/t/assert_nonzero.t
--- Carp-Assert-More-1.08-orig/t/assert_nonzero.t 2004-11-24 10:26:52.000000000 -0600
+++ Carp-Assert-More-1.08/t/assert_nonzero.t 2005-02-16 08:20:19.000000000 -0600
@@ -3,7 +3,7 @@
use warnings;
use strict;
-use Test::More tests=>6;
+use Test::More tests=>7;
BEGIN { use_ok( 'Carp::Assert::More' ); }
@@ -16,6 +16,7 @@
[ 0.4, PASS ],
[ -10, PASS ],
[ "dog", FAIL ],
+ [ "14.", PASS ],
);
for my $case ( @cases ) {
diff -ru Carp-Assert-More-1.08-orig/t/assert_positive_integer.t Carp-Assert-More-1.08/t/assert_positive_integer.t
--- Carp-Assert-More-1.08-orig/t/assert_positive_integer.t 2004-11-24 10:26:52.000000000 -0600
+++ Carp-Assert-More-1.08/t/assert_positive_integer.t 2005-02-16 08:23:14.000000000 -0600
@@ -3,7 +3,7 @@
use warnings;
use strict;
-use Test::More tests=>6;
+use Test::More tests=>8;
BEGIN { use_ok( 'Carp::Assert::More' ); }
@@ -16,6 +16,8 @@
[ 0.4, FAIL ],
[ -10, FAIL ],
[ "dog", FAIL ],
+ [ "14.", FAIL ],
+ [ "14", PASS ],
);
for my $case ( @cases ) {
Only in Carp-Assert-More-1.08/t: assert_positive_integer.t~
diff -ru Carp-Assert-More-1.08-orig/t/assert_positive.t Carp-Assert-More-1.08/t/assert_positive.t
--- Carp-Assert-More-1.08-orig/t/assert_positive.t 2004-11-24 10:26:51.000000000 -0600
+++ Carp-Assert-More-1.08/t/assert_positive.t 2005-02-16 08:17:48.000000000 -0600
@@ -3,7 +3,7 @@
use warnings;
use strict;
-use Test::More tests=>6;
+use Test::More tests=>7;
BEGIN { use_ok( 'Carp::Assert::More' ); }
@@ -16,6 +16,7 @@
[ 0.4, PASS ],
[ -10, FAIL ],
[ "dog", FAIL ],
+ [ "14.", PASS ],
);
for my $case ( @cases ) {