From f72dc407f2f682063cf3d7683b879b430481b4ce Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 6 Nov 2019 11:17:09 +0900 Subject: Prohibit calling undefined allocator [Bug #16297] --- test/ruby/test_class.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb index 407b0aa4b8..ca78473026 100644 --- a/test/ruby/test_class.rb +++ b/test/ruby/test_class.rb @@ -274,6 +274,14 @@ class TestClass < Test::Unit::TestCase assert_raise(TypeError) { Class.allocate.superclass } bug6863 = '[ruby-core:47148]' assert_raise(TypeError, bug6863) { Class.new(Class.allocate) } + + allocator = Class.instance_method(:allocate) + assert_raise_with_message(TypeError, /prohibited/) { + allocator.bind(Rational).call + } + assert_raise_with_message(TypeError, /prohibited/) { + allocator.bind_call(Rational) + } end def test_nonascii_name -- cgit v1.2.3