diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2021-05-06 12:24:50 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:34 -0400 |
commit | 0d64f5e8a89a0ca5caba5289249ba9ee34fa4303 (patch) | |
tree | e197d107c1e629b62c69b1553726728923a8827f /bootstraptest | |
parent | ad601cef8af4bc93a53c8437be4fe8749191f621 (diff) |
Check for easy-to-handle cases of block param (#24)
In some cases, methods taking block parameters don't require extra
paramter setup. They are fairly popular in railsbench.
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_yjit.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 0b469ff5fa..663977f0ca 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -869,3 +869,27 @@ end use([], 0) [use([2, 2], 38), use([14, 14, 14], 0)] } + +# test calling method taking block param +assert_equal '[Proc, 1, 2, 3, Proc]', %q{ + def three(a, b, c, &block) + [a, b, c, block.class] + end + + def zero(&block) + block.class + end + + def use_three + three(1, 2, 3) {} + end + + def use_zero + zero {} + end + + use_three + use_zero + + [use_zero] + use_three +} |