-
-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add args forwarding specs #756
Conversation
e178432
to
32fec93
Compare
language/fixtures/args_forwarding.rb
Outdated
@@ -0,0 +1,9 @@ | |||
class F |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you nest this under DelegationSpecs
and name it more explicitly like Target
?
That will also fix the CI.
language/args_forwaring_spec.rb
Outdated
@@ -0,0 +1,28 @@ | |||
require_relative '../spec_helper' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filename has a typo (missing d
).
I think this should be called delegation_spec.rb
and later on we could extend specs in this file with how delegation is achieved in various versions.
Re the parentheses-less version, I see this (on 2.7.0): class F
def target(*args, **kwargs)
[args, kwargs]
end
end
a = Class.new(F)
a.class_eval(<<-RUBY)
def delegate(...)
target ...
end
RUBY
p a.new.delegate(1, b: 2)
# => [[], {}]... So it's the same as |
32fec93
to
9f95636
Compare
9f95636
to
1ce89bb
Compare
Thanks for the review! Pushed the updated version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Related to #745.
This is a basic args forwarding spec (extracted from ruby-next).
I tried to add a spec for brackets-less case like this:
But I'm not sure why the result is empty (testing in 2.7.0)? Shouldn't there be a beginless-endless range?