summaryrefslogtreecommitdiff
path: root/spec/ruby/language/hash_spec.rb
AgeCommit message (Collapse)Author
3 daysUpdate to ruby/spec@6b04c1dAndrew Konchin
2024-03-14Update to ruby/spec@89175b2Benoit Daloze
2024-02-19[Bug #20280] Fix wrong testsNobuyoshi Nakada
2023-12-07Fix keyword splat passing as regular argumentJeremy Evans
Since Ruby 3.0, Ruby has passed a keyword splat as a regular argument in the case of a call to a Ruby method where the method does not accept keyword arguments, if the method call does not contain an argument splat: ```ruby def self.f(obj) obj end def self.fs(*obj) obj[0] end h = {a: 1} f(**h).equal?(h) # Before: true; After: false fs(**h).equal?(h) # Before: true; After: false a = [] f(*a, **h).equal?(h) # Before and After: false fs(*a, **h).equal?(h) # Before and After: false ``` The fact that the behavior differs when passing an empty argument splat makes it obvious that something is not working the way it is intended. Ruby 2 always copied the keyword splat hash, and that is the expected behavior in Ruby 3. This bug is because of a missed check in setup_parameters_complex. If the keyword splat passed is not mutable, then it points to an existing object and not a new object, and therefore it must be copied. Now, there are 3 specs for the broken behavior of directly using the keyword splatted hash. Fix two specs and add a new version guard. Do not keep the specs for the broken behavior for earlier Ruby versions, in case this fix is backported. For the ruby2_keywords spec, just remove the related line, since that line is unrelated to what the spec is testing. Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-06-26Update to ruby/spec@30e1c35Benoit Daloze
2023-02-27Update to ruby/spec@e7dc804Benoit Daloze
2022-04-25Update to ruby/spec@3affe1eBenoit Daloze
2021-10-20Update to ruby/spec@d6921efBenoit Daloze
2021-07-29Update to ruby/spec@b65d01fBenoit Daloze
2021-06-02Update to ruby/spec@a0b7d0dBenoit Daloze
2021-03-27Update to ruby/spec@fd6edddBenoit Daloze
2020-11-27Update to ruby/spec@ac878adBenoit Daloze
2020-05-03Update to ruby/spec@032ee74Benoit Daloze
2019-09-29Update to ruby/spec@519df35Benoit Daloze
2019-08-30Update specs to handle non-Symbols for keyword splats in 2.7Jeremy Evans
Also handle some warnings for behavior that will change in 3.0. Notes: Merged: https://github.com/ruby/ruby/pull/2395
2019-07-27Update to ruby/spec@875a09eBenoit Daloze
2019-06-27Update to ruby/spec@8d74d49Benoit Daloze
2018-03-04Update to ruby/spec@c1b568beregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-20Move spec/rubyspec to spec/ruby for consistencyeregon
* Other ruby implementations use the spec/ruby directory. [Misc #13792] [ruby-core:82287] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e