From d62c8fd18c0793bf02952c12071e89bbb5e20353 Mon Sep 17 00:00:00 2001 From: Dabrien 'Dabe' Murphy Date: Sun, 15 Dec 2013 21:24:54 -0800 Subject: [PATCH] [perl #120752] Fix t/op/coreamp.t rand test The way it was written it would even accept an empty string as valid output. --- t/op/coreamp.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/t/op/coreamp.t b/t/op/coreamp.t index 759654a..addc4bb 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'); -- 2.7.4