summaryrefslogtreecommitdiff
path: root/spec/ruby/core/module
AgeCommit message (Collapse)Author
11 daysUpdate to ruby/spec@f54296dBenoit Daloze
2025-12-16Box: fix the class name in testsNobuyoshi Nakada
2025-11-19Update to ruby/spec@6e62695Benoit Daloze
2025-11-19Update to ruby/spec@2e11d2aCharles Oliver Nutter
2025-10-08Update to ruby/spec@3d7e563Benoit Daloze
2025-08-22Do not respect ruby2_keywords on method/proc with post argumentsJeremy Evans
Previously, ruby2_keywords could be used on a method or proc with post arguments, but I don't think the behavior is desired: ```ruby def a(*c, **kw) [c, kw] end def b(*a, b) a(*a, b) end ruby2_keywords(:b) b({foo: 1}, bar: 1) ``` This changes ruby2_keywords to emit a warning and not set the flag on a method/proc with post arguments. While here, fix the ruby2_keywords specs for warnings, since they weren't testing what they should be testing. They all warned because the method didn't accept a rest argument, not because it accepted a keyword or keyword rest argument.
2025-05-11spec/ruby/core/module/ancestors_spec.rb: Add a guard for Namespace feat.Yusuke Endoh
2025-05-11namespace on readSatoshi Tagomori
2025-05-09Update to ruby/spec@d8bacefAndrew Konchin
Notes: Merged: https://github.com/ruby/ruby/pull/13265
2025-04-23Add a new spec for const_addedXavier Noria
Notes: Merged: https://github.com/ruby/ruby/pull/13141
2025-04-10Document order of execution const_added vs inheritedXavier Noria
Notes: Merged: https://github.com/ruby/ruby/pull/12759
2025-03-27Update to ruby/spec@5e579e2Andrew Konchin
Notes: Merged: https://github.com/ruby/ruby/pull/12984
2025-03-18[Bug #21094] Update nested module names when setting temporary nameNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12947
2025-01-30Update to ruby/spec@affef93Andrew Konchin
Notes: Merged: https://github.com/ruby/ruby/pull/12679
2024-11-19[Bug #20900] Warn deprecated constant when removingNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12114
2024-11-06Update to ruby/spec@54c391eBenoit Daloze
2024-09-23Add anonymous module name spec.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/7968
2024-05-19Update to ruby/spec@6b04c1dAndrew Konchin
2024-03-14Update to ruby/spec@89175b2Benoit Daloze
2024-03-13Make `const_source_location` return the real constant as soon as definedJean Boussier
[Bug #20188] Ref: https://github.com/fxn/zeitwerk/issues/281#issuecomment-1893228355 Previously, it would only return the real constant location once the autoload was fully completed.
2024-02-15ruby-spec: Accept both a backtick and a single quote in error messagesYusuke Endoh
2024-02-12Update to ruby/spec@ce834adBenoit Daloze
2024-02-05Update to ruby/spec@3fc4444Benoit Daloze
2024-01-22Add an autoload spec for the behavior inside autoload but after the constant ↵Jean Boussier
is defined
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-10-30Update to ruby/spec@bd7017fBenoit Daloze
2023-09-04Update to ruby/spec@96d1072Benoit Daloze
2023-08-02Update to ruby/spec@9e278f5Benoit Daloze
2023-07-24Use the caller location as default filename for eval family of methodsJean Boussier
[Feature #19755] Before (in /tmp/test.rb): ```ruby Object.class_eval("p __FILE__") # => "(eval)" ``` After: ```ruby Object.class_eval("p __FILE__") # => "(eval at /tmp/test.rb:1)" ``` This makes it much easier to track down generated code in case the author forgot to provide a filename argument. Notes: Merged: https://github.com/ruby/ruby/pull/8070
2023-07-06Improve ArgumentError message for Module#set_temporary_nameBenoit Daloze
Notes: Merged: https://github.com/ruby/ruby/pull/8035
2023-07-06Ensure the name given to Module#set_temporary_name is not a valid constant pathBenoit Daloze
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/8035
2023-07-06Specs for Module#set_temporary_name should be in their own fileBenoit Daloze
Notes: Merged: https://github.com/ruby/ruby/pull/8035
2023-06-26Update to ruby/spec@30e1c35Benoit Daloze
2023-06-21Allow setting the name of a class or module. (#7483)Samuel Williams
Introduce `Module#set_temporary_name` for setting identifiers for otherwise anonymous modules/classes. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-05-29Update to ruby/spec@c3677cfBenoit Daloze
2023-04-25Update to ruby/spec@7f69c86Benoit Daloze
2023-02-27Update to ruby/spec@e7dc804Benoit Daloze
2023-01-05Update to ruby/spec@9d69b95Benoit Daloze
2022-12-03UnboundMethod only refer defined_classKoichi Sasada
UnboundMethod records caller's class, like `D` or `E` on the following case: ```ruby class C def foo = :foo end class D < C end class E < C end d = D.instance_method(:foo) e = E.instance_method(:foo) ``` But `d` and `e` only refers `C#foo` so that UnboundMethod doesn't record `D` or `E`. This behavior changes the following methods: * `UnboundMethod#inspect` (doesn't show caller's class) * `UnboundMethod#==` (`d == e` for example) fix https://bugs.ruby-lang.org/issues/18798 Notes: Merged: https://github.com/ruby/ruby/pull/6855
2022-09-28Update to ruby/spec@1d9d5c6Benoit Daloze
2022-06-26Update to ruby/spec@ab32a1aBenoit Daloze
2022-06-18[Bug #18813] Warn when autoload has to lookup in parent namespaceJean Boussier
This is a verbose mode only warning. Notes: Merged: https://github.com/ruby/ruby/pull/6038
2022-04-25Update to ruby/spec@3affe1eBenoit Daloze
2022-03-28Update to ruby/spec@aaf998fBenoit Daloze
2022-01-28Update to ruby/spec@902ab83Benoit Daloze
2022-01-23Fix a typo [ci skip]Kazuhiro NISHIYAMA
2022-01-15Fix spec failures on ruby 3.1Kazuhiro NISHIYAMA
Because Module#const_added is ruby 3.2 feature
2022-01-14Add a Module#const_added callbackJean Boussier
[Feature #17881] Works similarly to `method_added` but for constants. ```ruby Foo::BAR = 42 # call Foo.const_added(:FOO) class Foo::Baz; end # call Foo.const_added(:Baz) Foo.autoload(:Something, "path") # call Foo.const_added(:Something) ``` Notes: Merged: https://github.com/ruby/ruby/pull/4521
2022-01-10Update to ruby/spec@226cfdcBenoit Daloze
2021-12-26Remove Refinement#include and Refinement#prependNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5348