aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r--test/ruby/test_module.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 2862cd338f..185c445091 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1596,4 +1596,23 @@ class TestModule < Test::Unit::TestCase
m = Module.new
assert_raise(NameError){ m.instance_eval { remove_const(:__FOO__) } }
end
+
+ def test_top_include_is_private
+ main = eval("self", TOPLEVEL_BINDING)
+ methods = main.singleton_class.private_instance_methods(false)
+ assert(methods.include?(:include))
+
+ assert_in_out_err([], <<-INPUT, ["true"], [])
+ module M
+ end
+ include M
+ p singleton_class < M
+ INPUT
+
+ assert_in_out_err([], <<-INPUT, [], /private method `include' called for main:Object \(NoMethodError\)/)
+ module M
+ end
+ self.include M
+ INPUT
+ end
end