diff options
author | Dabrien 'Dabe' Murphy <dabe@dabe.com> | 2013-12-15 21:24:54 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-12-15 21:29:11 -0800 |
commit | d62c8fd18c0793bf02952c12071e89bbb5e20353 (patch) | |
tree | 3e603fa99c4aa188718856e65680cd93a56ddef7 | |
parent | 9b5e399ae5484d1a54e60076d4d4e0725b922ee1 (diff) | |
download | perl-d62c8fd18c0793bf02952c12071e89bbb5e20353.tar.gz |
[perl #120752] Fix t/op/coreamp.t rand test
The way it was written it would even accept an empty string as
valid output.
-rw-r--r-- | t/op/coreamp.t | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/t/op/coreamp.t b/t/op/coreamp.t index 759654a9f6..addc4bbe70 100644 --- a/t/op/coreamp.t +++ b/t/op/coreamp.t @@ -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'); |