diff options
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r-- | test/ruby/test_module.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 8b95ecedc4..79f7965623 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1394,6 +1394,17 @@ class TestModule < Test::Unit::TestCase assert_match(/: warning: previous definition of foo/, stderr) end + def test_module_function_inside_method + assert_warn(/calling module_function without arguments inside a method may not have the intended effect/, '[ruby-core:79751]') do + Module.new do + def self.foo + module_function + end + foo + end + end + end + def test_protected_singleton_method klass = Class.new x = klass.new |