summaryrefslogtreecommitdiff
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.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index f8cf3c028b..144b75d9f7 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -357,6 +357,16 @@ class TestModule < Test::Unit::TestCase
end
end
+ def test_include_toplevel
+ assert_separately([], <<-EOS)
+ Mod = Module.new {def foo; :include_foo end}
+ TOPLEVEL_BINDING.eval('include Mod')
+
+ assert_equal(:include_foo, TOPLEVEL_BINDING.eval('foo'))
+ assert_equal([Object, Mod], Object.ancestors.slice(0, 2))
+ EOS
+ end
+
def test_included_modules
assert_equal([], Mixin.included_modules)
assert_equal([Mixin], User.included_modules)