summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-metaprog/test
diff options
context:
space:
mode:
authordearblue <[email protected]>2020-05-31 15:44:57 +0900
committerdearblue <[email protected]>2020-05-31 15:56:04 +0900
commitfc80e4b6513599bbae2948ad762bf0d1505e7700 (patch)
tree861731d89c3d40748c0269ea408e63dff504bd6f /mrbgems/mruby-metaprog/test
parentd5cca2bdb2a0352e3253cf3ba2a79157dde5f163 (diff)
downloadmruby-fc80e4b6513599bbae2948ad762bf0d1505e7700.tar.gz
mruby-fc80e4b6513599bbae2948ad762bf0d1505e7700.zip
Get local variable names from orphan block; ref #3710
Diffstat (limited to 'mrbgems/mruby-metaprog/test')
-rw-r--r--mrbgems/mruby-metaprog/test/metaprog.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/mrbgems/mruby-metaprog/test/metaprog.rb b/mrbgems/mruby-metaprog/test/metaprog.rb
index 30b75bd60..82ba0a3a5 100644
--- a/mrbgems/mruby-metaprog/test/metaprog.rb
+++ b/mrbgems/mruby-metaprog/test/metaprog.rb
@@ -114,6 +114,15 @@ assert('Kernel.local_variables', '15.3.1.2.7') do
# Kernel#local_variables: 15.3.1.3.28
local_variables.sort
}.call(-1, -2)
+
+ a = Object.new
+ def a.hoge(vars, *, **)
+ Proc.new {
+ x, y = 1, 2
+ local_variables.sort
+ }
+ end
+ assert_equal([:vars, :x, :y]) { a.hoge(0).call }
end
assert('Kernel#define_singleton_method') do