[perl #120752] Fix t/op/coreamp.t rand test
authorDabrien 'Dabe' Murphy <dabe@dabe.com>
Mon, 16 Dec 2013 05:24:54 +0000 (21:24 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 16 Dec 2013 05:29:11 +0000 (21:29 -0800)
The way it was written it would even accept an empty string as
valid output.

t/op/coreamp.t

index 759654a..addc4bb 100644 (file)
@@ -646,7 +646,11 @@ test_proto 'quotemeta', '$', '\$';
 
 test_proto 'rand';
 $tests += 3;
-like &CORE::rand, qr/^[.\d+-e]*\z/, '&rand';
+my $r = &CORE::rand;
+ok eval {
+    use warnings FATAL => qw{numeric uninitialized};
+    $r >= 0 && $r < 1;
+}, '&rand returns a valid number';
 unlike join(" ", &CORE::rand), qr/ /, '&rand in list context';
 &cmp_ok(&CORE::rand(78), qw '< 78', '&rand with 1 arg');