diff options
author | Jimmy Miller <jimmy.miller@shopify.com> | 2023-03-17 16:11:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-17 16:11:30 -0400 |
commit | 5d0a1ffafa61da04dbda38a5cb5565bcb8032a78 (patch) | |
tree | 44ca032d8bd812899c6a6f6bb9bfac2143044291 /bootstraptest | |
parent | 2d97f87407f89986a2c7619d2a7a75ccd68386ef (diff) | |
download | ruby-5d0a1ffafa61da04dbda38a5cb5565bcb8032a78.tar.gz |
YJIT: Rest and block_arg support (#7557)
* YJIT: Rest and block_arg support
* Update bootstraptest/test_yjit.rb
---------
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_yjit.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 8902cd6cde..f29f0ce876 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -3662,3 +3662,24 @@ assert_equal '[1, 2, 3]', %q{ end send(:bar, 1, 2, 3) } + +# Rest with block +# Simplified code from railsbench +assert_equal '[{"/a"=>"b", :as=>:c, :via=>:post}, [], nil]', %q{ + def match(path, *rest, &block) + [path, rest, block] + end + + def map_method(method, args, &block) + options = args.last + args.pop + options[:via] = method + match(*args, options, &block) + end + + def post(*args, &block) + map_method(:post, args, &block) + end + + post "/a" => "b", as: :c +} |