summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-23 01:42:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-23 01:42:34 +0000
commitd190241a9e8623b1740d7f2357b5bc6baa372a43 (patch)
tree09c114db31108f9eba8bedadab99ac01b947b9aa /test
parentc10b7435f61a463d3582359579c5a682bbf012a0 (diff)
test_module.rb: toplevel include
* test/ruby/test_module.rb (TestModule#test_include_toplevel): test for top level main.include. based on a part of the patch by kyrylo at [GH-395]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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)