diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-11-06 11:17:09 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-11-06 11:17:09 +0900 |
commit | f72dc407f2f682063cf3d7683b879b430481b4ce (patch) | |
tree | 0989cc52713350a8c73dbbd1f5f520d009d45cfe /test | |
parent | 5251d189829abc405a5f0422b8874bab7cd79c46 (diff) | |
download | ruby-f72dc407f2f682063cf3d7683b879b430481b4ce.tar.gz |
Prohibit calling undefined allocator [Bug #16297]
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_class.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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 |