From 4417321d1c0509edbd4fcf55d8a49de9c38e8ec2 Mon Sep 17 00:00:00 2001 From: dearblue Date: Sun, 18 May 2025 18:50:02 +0900 Subject: [PATCH] Add more test code for method visibility This test corresponds to the first issue of #6494. Complement to #6512. --- test/t/module.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/t/module.rb b/test/t/module.rb index 9645c8667..2827f5e27 100644 --- a/test/t/module.rb +++ b/test/t/module.rb @@ -839,6 +839,16 @@ assert('method visibility with meta programming') do f.call c.new.bad! end + + assert_raise NoMethodError do + c = Class.new { + -> { private }.call + def bad! + "BAD!" + end + } + c.new.bad! + end end assert('Module#module_function') do