summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-11-30 19:16:48 -0800
committerYukihiro "Matz" Matsumoto <[email protected]>2012-11-30 19:16:48 -0800
commit26600ca4ec2c9547927056b35b61328f12cda79a (patch)
tree3800f622e77383788c1acda0f239e91eac0f83e7 /test
parent8c24e9e239fb9ee33c056c2c2ee4e067ab3c29ef (diff)
parent053c104f2ba6aa0e94bd2c9e9fd17123746a8f43 (diff)
downloadmruby-26600ca4ec2c9547927056b35b61328f12cda79a.tar.gz
mruby-26600ca4ec2c9547927056b35b61328f12cda79a.zip
Merge pull request #573 from skandhas/pr-add-Module-module_eval
add "Module#module_eval" and "Module#class_eval" for mruby
Diffstat (limited to 'test')
-rw-r--r--test/t/module.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/t/module.rb b/test/t/module.rb
index e666a1763..5e825c6b5 100644
--- a/test/t/module.rb
+++ b/test/t/module.rb
@@ -31,6 +31,22 @@ assert('Module#append_features', '15.2.2.4.10') do
Test4AppendFeatures2.const_get(:Const4AppendFeatures2) == Test4AppendFeatures2
end
+assert('Module#class_eval', '15.2.2.4.15') do
+ class Test4ClassEval
+ @a = 11
+ @b = 12
+ end
+ Test4ClassEval.class_eval do
+ def method1
+ end
+ end
+ r = Test4ClassEval.instance_methods
+ Test4ClassEval.class_eval{ @a } == 11 and
+ Test4ClassEval.class_eval{ @b } == 12 and
+ r.class == Array and r.include?(:method1)
+end
+
+
assert('Module#class_variables', '15.2.2.4.19') do
class Test4ClassVariables1
@@var1 = 1
@@ -151,6 +167,14 @@ assert('Module#instance_methods', '15.2.2.4.33') do
r.class == Array and r.include?(:method3) and r.include?(:method2)
end
+assert('Module#module_eval', '15.2.2.4.35') do
+ module Test4ModuleEval
+ @a = 11
+ @b = 12
+ end
+ Test4ModuleEval.module_eval{ @a } == 11 and
+ Test4ModuleEval.module_eval{ @b } == 12
+end
# Not ISO specified