From 7cda7fbbdc14f4262afaa94cdeb5a5987f1eb01a Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Mon, 6 Jun 2022 09:57:32 -0700 Subject: Add Module#undefined_instance_methods Implements [Feature #12655] Co-authored-by: Nobuyoshi Nakada --- test/ruby/test_module.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index c7245ab2db..3dae3916ff 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -994,6 +994,15 @@ class TestModule < Test::Unit::TestCase assert_equal([:bClass1], BClass.public_instance_methods(false)) end + def test_undefined_instance_methods + assert_equal([], AClass.undefined_instance_methods) + assert_equal([], BClass.undefined_instance_methods) + c = Class.new(AClass) {undef aClass} + assert_equal([:aClass], c.undefined_instance_methods) + c = Class.new(c) + assert_equal([], c.undefined_instance_methods) + end + def test_s_public o = (c = Class.new(AClass)).new assert_raise(NoMethodError, /private method/) {o.aClass1} -- cgit v1.2.3