1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2013-09-23 01:42:34 +00:00
parent c10b7435f6
commit d190241a9e
2 changed files with 16 additions and 0 deletions

View file

@ -1,3 +1,9 @@
Mon Sep 23 10:42:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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].
Mon Sep 23 05:07:49 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* include/ruby/intern.h (rb_ary_cat): move from internal.h, since it

View file

@ -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)