diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | test/ruby/test_module.rb | 10 |
2 files changed, 16 insertions, 0 deletions
@@ -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 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) |