Add a test case for argument forwarding
This commit is contained in:
parent
ed4b5c4f21
commit
67ae3e9738
Notes:
git
2022-11-29 09:23:21 +00:00
@ -526,6 +526,16 @@ class TestAst < Test::Unit::TestCase
|
||||
assert_equal([:a], kwrest.call('**a'))
|
||||
end
|
||||
|
||||
def test_argument_forwarding
|
||||
forwarding = lambda do |arg_str|
|
||||
node = RubyVM::AbstractSyntaxTree.parse("def a(#{arg_str}) end")
|
||||
node = node.children.last.children.last.children[1]
|
||||
node ? [node.children[-4], node.children[-2].children, node.children[-1]] : []
|
||||
end
|
||||
|
||||
assert_equal([:*, [:**], :&], forwarding.call('...'))
|
||||
end
|
||||
|
||||
def test_ranges_numbered_parameter
|
||||
helper = Helper.new(__FILE__, src: "1.times {_1}")
|
||||
helper.validate_range
|
||||
|
Loading…
x
Reference in New Issue
Block a user