diff options
Diffstat (limited to 'mrbgems/mruby-class-ext/test/module.rb')
| -rw-r--r-- | mrbgems/mruby-class-ext/test/module.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mrbgems/mruby-class-ext/test/module.rb b/mrbgems/mruby-class-ext/test/module.rb index 65abde108..ed6713aac 100644 --- a/mrbgems/mruby-class-ext/test/module.rb +++ b/mrbgems/mruby-class-ext/test/module.rb @@ -32,3 +32,24 @@ assert 'Module#singleton_class?' do assert_false cls.singleton_class? assert_true scl.singleton_class? end + +assert 'Module#module_eval' do + mod = Module.new + mod.class_exec(1,2,3) do |a,b,c| + assert_equal([1,2,3], [a,b,c]) + def hi + "hi" + end + end + cls = Class.new + cls.class_exec(42) do |x| + assert_equal(42, x) + include mod + def hello + "hello" + end + end + obj = cls.new + assert_equal("hi", obj.hi) + assert_equal("hello", obj.hello) +end |
