From 616b85b8124973fed9cee7a8c3c7675e67fccb95 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 7 May 2009 05:26:16 +0000 Subject: * array.c (rb_ary_sample): negative sample number is invalid. [ruby-core:23374] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_array.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 9b3dfdf45..a20c6b23c 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1605,6 +1605,8 @@ class TestArray < Test::Unit::TestCase end assert_operator(h.values.min * 2, :>=, h.values.max) if n != 0 end + + assert_raise(ArgumentError, '[ruby-core:23374]') {[1, 2].sample(-1)} end def test_cycle -- cgit