diff options
| author | Daniel Bovensiepen <[email protected]> | 2012-12-01 14:07:23 +0800 |
|---|---|---|
| committer | Daniel Bovensiepen <[email protected]> | 2012-12-01 14:07:23 +0800 |
| commit | 40bfc86a5e0a1a70f904a080569da9662747181f (patch) | |
| tree | 8f5f1d28650e8194b918293ebc7d826f0580af4f /test/t | |
| parent | 5f00a837edd0f55ed56d4d532d06ee45d9850f3c (diff) | |
| parent | 26600ca4ec2c9547927056b35b61328f12cda79a (diff) | |
| download | mruby-40bfc86a5e0a1a70f904a080569da9662747181f.tar.gz mruby-40bfc86a5e0a1a70f904a080569da9662747181f.zip | |
Merge remote-tracking branch 'upstream/master' into mrbgems
Diffstat (limited to 'test/t')
| -rw-r--r-- | test/t/module.rb | 24 | ||||
| -rw-r--r-- | test/t/syntax.rb | 11 |
2 files changed, 35 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 diff --git a/test/t/syntax.rb b/test/t/syntax.rb index 47221d425..0501608e5 100644 --- a/test/t/syntax.rb +++ b/test/t/syntax.rb @@ -58,3 +58,14 @@ assert('Nested const reference') do Syntax4Const::CONST1 == "hello world" and Syntax4Const::Const2.new.const1 == "hello world" end + +assert('Abbreviated variable assignment as returns') do + module Syntax4AbbrVarAsgnAsReturns + class A + def b + @c ||= 1 + end + end + end + Syntax4AbbrVarAsgnAsReturns::A.new.b == 1 +end |
