summaryrefslogtreecommitdiff
path: root/spec/ruby/core
AgeCommit message (Collapse)Author
2020-08-06[Feature #16513] TracePoint#inspect returns "... file:line" (#3391)Nguyễn Quang Minh
* Fix debug documents to match Thread#to_s change (Feature #16412 ticket) * TracePoint#inspect returns "... file:line" (Feature #16513) * Guard older version of Ruby in Tracepoint inspection tests * Focus on current thread only when running TracePoint inspection test Notes: Merged-By: ko1 <ko1@atdot.net>
2020-07-29Fix arity of Hash#to_proc [Bug #12671]Benoit Daloze
Notes: Merged: https://github.com/ruby/ruby/pull/3370
2020-07-27Update to ruby/spec@07164daBenoit Daloze
2020-07-20Make StringIO encoding fixedNobuyoshi Nakada
Get rid of affects by default external encoding. Notes: Merged: https://github.com/ruby/ruby/pull/3334
2020-07-12Fixed yday and wday with timezone [Bug #17024]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3312
2020-06-27Update to ruby/spec@b6b7752Benoit Daloze
2020-06-19Implement Proc#== and #eql?Jeremy Evans
Previously, these were not implemented, and Object#== and #eql? were used. This tries to check the proc internals to make sure that procs created from separate blocks are treated as not equal, but procs created from the same block are treated as equal, even when the lazy proc allocation optimization is used. Implements [Feature #14267] Notes: Merged: https://github.com/ruby/ruby/pull/3174
2020-06-13Suppress warnings [Feature #15973]Nobuyoshi Nakada
2020-06-11Refined ioctl error descriptionNobuyoshi Nakada
2020-06-10Make proc/Proc.new without block an error instead of warningJeremy Evans
The warning for these was added in 2.7. Notes: Merged: https://github.com/ruby/ruby/pull/3208
2020-06-10ENV.delete should return the result of block on non-existing keyNobuyoshi Nakada
Fixes [Bug #16173] Co-Authored-By: Burdette Lamar <burdettelamar@yahoo.com> Co-Authored-By: Jeremy Evans <code@jeremyevans.net> Notes: Merged: https://github.com/ruby/ruby/pull/3206
2020-06-06Fix build failuresYuki Nishijima
Notes: Merged: https://github.com/ruby/ruby/pull/3135
2020-06-03Ensure origins for all included, prepended, and refined modulesJeremy Evans
This fixes various issues when a module is included in or prepended to a module or class, and then refined, or refined and then included or prepended to a module or class. Implement by renaming ensure_origin to rb_ensure_origin, making it non-static, and calling it when refining a module. Fix Module#initialize_copy to handle origins correctly. Previously, Module#initialize_copy did not handle origins correctly. For example, this code: ```ruby module B; end class A def b; 2 end prepend B end a = A.dup.new class A def b; 1 end end p a.b ``` Printed 1 instead of 2. This is because the super chain for a.singleton_class was: ``` a.singleton_class A.dup B(iclass) B(iclass origin) A(origin) # not A.dup(origin) ``` The B iclasses would not be modified, so the includer entry would be still be set to A and not A.dup. This modifies things so that if the class/module has an origin, all iclasses between the class/module and the origin are duplicated and have the correct includer entry set, and the correct origin is created. This requires other changes to make sure all tests still pass: * rb_undef_methods_from doesn't automatically handle classes with origins, so pass it the origin for Comparable when undefing methods in Complex. This fixed a failure in the Complex tests. * When adding a method, the method cache was not cleared correctly if klass has an origin. Clear the method cache for the klass before switching to the origin of klass. This fixed failures in the autoload tests related to overridding require, without breaking the optimization tests. Also clear the method cache for both the module and origin when removing a method. * Module#include? is fixed to skip origin iclasses. * Refinements are fixed to use the origin class of the module that has an origin. * RCLASS_REFINED_BY_ANY is removed as it was only used in a single place and is no longer needed. * Marshal#dump is fixed to skip iclass origins. * rb_method_entry_make is fixed to handled overridden optimized methods for modules that have origins. Fixes [Bug #16852] Notes: Merged: https://github.com/ruby/ruby/pull/3140
2020-06-02Add a spec for the new NoMethodError display of the receiverJean Boussier
Notes: Merged: https://github.com/ruby/ruby/pull/3176
2020-05-31Update to ruby/spec@4e486faBenoit Daloze
2020-05-03Update to ruby/spec@032ee74Benoit Daloze
2020-05-03spec/ruby/core/process/clock_getres_spec.rb: lax the resolution limitYusuke Endoh
Android is Linux, but the clock resolution is 10 milliseconds. I think that 1 microsecond is too strict for embedded environment. This change laxes the limit to 10 milliseconds.
2020-05-02Command failed to run just failsNobuyoshi Nakada
The exact exit status value of command failed to run is not a spec, but a platform dependent implementation detail. Just it is not "success".
2020-05-02Fix ObjectSpace::WeakMap#key? to work if the value is nilBenoit Daloze
* Fixes [Bug #16826]
2020-05-02Update to ruby/spec@d394dfdBenoit Daloze
2020-04-29[ruby/spec] Temporary directories should be under the mock_dirNobuyoshi Nakada
2020-04-19Skip Process#clock_getres specs on AndroidYusuke Endoh
... just like AIX and OpenBSD.
2020-04-10Turn class variable warnings into exceptionsJeremy Evans
This changes the following warnings: * warning: class variable access from toplevel * warning: class variable @foo of D is overtaken by C into RuntimeErrors. Handle defined?(@@foo) at toplevel by returning nil instead of raising an exception (the previous behavior warned before returning nil when defined? was used). Refactor the specs to avoid the warnings even in older versions. The specs were checking for the warnings, but the purpose of the related specs as evidenced from their description is to test for behavior, not for warnings. Fixes [Bug #14541] Notes: Merged: https://github.com/ruby/ruby/pull/2987
2020-04-06Use `rb_warn_deprecated` for `File.exists?` and `Dir.exists?`Nobuyoshi Nakada
2020-04-04Update to ruby/spec@7289ea3Benoit Daloze
2020-04-03Use `platform_is` guardNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2997
2020-04-03Refined "Drop support for ruby 2.4 from ruby/spec"Nobuyoshi Nakada
By using spec/mspec/tool/remove_old_guards.rb. Notes: Merged: https://github.com/ruby/ruby/pull/2997
2020-04-02Update to ruby/spec@cc7b9e5Benoit Daloze
2020-04-01Drop support for ruby 2.4 from ruby/specNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2892
2020-04-01Use FrozenError instead of frozen_error_classNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2892
2020-03-29spec/ruby/core/time/: Use near time for timezone testYusuke Endoh
`time_with_zone.zone.should == (time_with_zone - 60*60).zone` fails when the time is immediately before the change of summer time. https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11s/ruby-master/log/20200328T232504Z.fail.html.gz ``` 1) Time#+ preserves time zone FAILED Expected "CET" == "CEST" to be truthy but was false ``` It is acceptable as it fails at most twice per year, but it would be good to use near time objects to reduce the possibility.
2020-03-28Increase the number of Process.times attemptsTakashi Kokubun
CI of 5806c54447439f2ba22892e4045e78dd80f96f0c did not succeed https://travis-ci.org/github/ruby/ruby/jobs/668072714
2020-03-28Improve reliability of the Process.times specBenoit Daloze
2020-03-28Do not check that #stime changes in Process.times specBenoit Daloze
* Since the spec might not spend any time in system calls.
2020-03-28Remove debugging codeBenoit Daloze
2020-03-28Remove Process.clock_getres "matches the resolution in practice" specsBenoit Daloze
* Almost all platforms return incorrect values for Process.clock_getres, it should be removed: https://bugs.ruby-lang.org/issues/16740
2020-03-28Update to ruby/spec@ec84479Benoit Daloze
2020-03-24Show failed timesNobuyoshi Nakada
2020-03-23Try to avoid random failures on clock_getres_spec.rbTakashi Kokubun
This spec fails too often https://github.com/ruby/ruby/runs/529546249 https://github.com/ruby/ruby/runs/524933256
2020-03-22Support obj.clone(freeze: true) for freezing cloneJeremy Evans
This freezes the clone even if the receiver is not frozen. It is only for consistency with freeze: false not freezing the clone even if the receiver is frozen. Because Object#clone is now partially implemented in Ruby and not fully implemented in C, freeze: nil must be supported to provide the default behavior of only freezing the clone if the receiver is frozen. This requires modifying delegate and set, to set freeze: nil instead of freeze: true as the keyword parameter for initialize_clone. Those are the two libraries in stdlib that override initialize_clone. Implements [Feature #16175] Notes: Merged: https://github.com/ruby/ruby/pull/2969
2020-03-16`Proc` made by `Hash#to_proc` should be a lambda [Bug #12671]Yusuke Endoh
Like `Symbol#to_proc` (f0b815dc670b61eba1daaa67a8613ac431d32b16)
2020-03-16hash.c: Do not use the fast path (rb_yield_values) for lambda blocksYusuke Endoh
As a semantics, Hash#each yields a 2-element array (pairs of keys and values). So, `{ a: 1 }.each(&->(k, v) { })` should raise an exception due to lambda's arity check. However, the optimization that avoids Array allocation by using rb_yield_values for blocks whose arity is more than 1 (introduced at b9d29603375d17c3d1d609d9662f50beaec61fa1 and some commits), seemed to overlook the lambda case, and wrongly allowed the code above to work. This change experimentally attempts to make it strict; now the code above raises an ArgumentError. This is an incompatible change; if the compatibility issue is bigger than our expectation, it may be reverted (until Ruby 3.0 release). [Bug #12706]
2020-03-09Don't display singleton class in Method#inspect unless method defined thereJeremy Evans
Previously, if an object has a singleton class, and you call Object#method on the object, the resulting string would include the object's singleton class, even though the method was not defined in the singleton class. Change this so the we only show the singleton class if the method is defined in the singleton class. Fixes [Bug #15608] Notes: Merged: https://github.com/ruby/ruby/pull/2949 Merged-By: jeremyevans <code@jeremyevans.net>
2020-03-05spec/ruby/core/process/exec_spec.rb: remove a guard for openbsdYusuke Endoh
openbsd current seems to behave the same as other OSs. https://rubyci.org/logs/rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20200305T063005Z.fail.html.gz
2020-02-28Update to ruby/spec@41bf282Benoit Daloze
2020-02-27Remove support for passing nil to IO#ungetcJeremy Evans
Fixes [Bug #13675] Notes: Merged: https://github.com/ruby/ruby/pull/2935
2020-02-23Warn non-nil `$/` [Feature #14240]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2920
2020-02-23Warn non-nil `$\` [Feature #14240]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2920
2020-02-22Expand Symbol#to_proc specs to be clearerBenoit Daloze
2020-02-22Proc from Symbol needs a receiverNobuyoshi Nakada
So its arity should be -2 instead of -1. [Bug #16640] https://bugs.ruby-lang.org/issues/16640#change-84337