summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2021-11-24merge revision(s) e83c02a768af61cd0890a75e90bcae1119d8bd93: [Backport #18289]NAKAMURA Usaku
Delegate keywords from Enumerable#to_a to #each Fixes [Bug #18289] --- enum.c | 2 +- test/ruby/test_enum.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
2021-11-24merge revision(s) a4d5ee4f31bf3ff36c1a8c8fe3cda16aa1016b12: [Backport #18264]NAKAMURA Usaku
[Bug #18264] Fix memory leak in TracePoint TracePoint leaks memory because it allocates a `rb_tp_t` struct without ever freeing it (it is created with `RUBY_TYPED_NEVER_FREE`). --- test/ruby/test_settracefunc.rb | 10 ++++++++++ vm_trace.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-)
2021-11-24merge revision(s) ↵NAKAMURA Usaku
89242279e61b023a81c58065c62a82de8829d0b3,529fc204af84f825f98f83c34b004acbaa802615: [Backport #18141] Marshal.load: do not call the proc until strings have their encoding Ref: https://bugs.ruby-lang.org/issues/18141 --- marshal.c | 7 +++- spec/ruby/core/marshal/shared/load.rb | 62 +++++++++++++++++++++++------------ test/ruby/test_marshal.rb | 17 ++++++++++ 3 files changed, 64 insertions(+), 22 deletions(-) marshal.c: don't call the proc with partially initialized objects. (#4866) For cyclic objects, it requires to keep a st_table of the partially initialized objects. --- marshal.c | 75 ++++++++++++++++++++--------------- spec/ruby/core/marshal/shared/load.rb | 75 ++++++++++++++++++++--------------- test/ruby/test_marshal.rb | 12 ++++++ 3 files changed, 97 insertions(+), 65 deletions(-)
2021-11-24merge revision(s) ddb32e66160ab50849419ef7c7ac584913b79c34: [Backport #18173]NAKAMURA Usaku
[Bug #18173] Update loaded_features_index If $LOADED_FEATURES is changed in the just required file, also the index table needs to be updated before loaded_features_snapshot is reset. If the snapshot is reset without updating the table, the name of the added feature will not be found. --- load.c | 1 + test/ruby/test_require.rb | 17 +++++++++++++++++ 2 files changed, 18 insertions(+)
2021-11-24merge revision(s) 99d8c4832a7133ca52578d015e3ddcfd94820f4a: [Backport #18160]NAKAMURA Usaku
Preserve the encoding of the argument in IndexError [Bug #18160] --- re.c | 20 ++++++++++---------- test/ruby/test_regexp.rb | 7 ++++++- 2 files changed, 16 insertions(+), 11 deletions(-)
2021-11-24merge revision(s) 5d815542815fe8b939239750bba7f8f0b79c97d6: [Backport #18154]NAKAMURA Usaku
[Bug #18154] Fix memory leak in String#initialize String#initialize can leak memory when called on a string that is marked with STR_NOFREE because it does not unset the STR_NOFREE flag. --- string.c | 2 +- test/ruby/test_string.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
2021-11-24Do not allow Module#include to insert modules before the origin in the ↵PikachuEXE
lookup chain Module#include should only be able to insert modules after the origin, otherwise it ends up working like Module#prepend. This fixes the case where one of the modules in the included module chain is included in a module that is already prepended to the receiver. Fixes [Bug #7844] Backport of https://github.com/ruby/ruby/pull/3796 to 2.7
2021-05-31merge revision(s) d8a13e504992a45d52063f7c925408d7aad3595a: [Backport #17780]NAKAMURA Usaku
[Bug #17780] Fix Method#super_method for module alias Method#super_method crashes for aliased module methods because they are not defined on a class. This bug was introduced in c60aaed1856b2b6f90de0992c34771830019e021 as part of bug #17130. --- proc.c | 2 +- test/ruby/test_method.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
2021-04-05merge revision(s) 856a9701fd13edbb9d5f0fa773082d312195df90:v2_7_3nagachika
Get rid of multibyte prefix to tmpdir --- test/ruby/test_require.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
2021-03-20merge revision(s) a85ed626f18d1014d09fb37eb0a703976c3d2b53: [Backport #17731]nagachika
Fix Enumerable#inject with high negative fixnums [Bug #17731] --- enum.c | 2 +- test/ruby/test_enum.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
2021-03-20merge revision(s) f748b911c9157a0bb86f38280ddfba72a55049b6: [Backport #17729]nagachika
Fix infinite loop at illegal sequence [Bug #17729] As mblen returns -1 on failure, skip the first byte and try the succeeding bytes in that case. Close https://github.com/ruby/ruby/pull/4281 --- eval_intern.h | 11 ++++++++++- test/ruby/test_rubyoptions.rb | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-)
2021-03-20merge revision(s) 58660e943488778563b9e41005a601e9660ce21f: [Backport #17519]nagachika
Skip refined method when exporting methods with changed visibility Previously, attempting to change the visibility of a method in a singleton class for a class/module that is prepended to and refined would raise a NoMethodError. Fixes [Bug #17519] --- test/ruby/test_module.rb | 23 +++++++++++++++++++++++ vm_method.c | 14 +++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-)
2021-03-20merge revision(s) ↵nagachika
254bed302752a401b5fcc3b6c65a9c93711d91d6,fad3023e94c45e7f03478732f7641b6f39ba9d12,3156fb0f2c3ebf8229f392c8502c08fe165ab181: [Backport #17218] Renamed `nurat_sub` compliant with `rb_rational_plus` --- internal/rational.h | 1 + rational.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) Fix ArithmeticSequence#last and ArithmeticSequence#each for non-integer sequences (#3870) [Bug #17218] [ruby-core:100312] --- common.mk | 2 + enumerator.c | 99 ++++++++++++++++++++++++++++++++--- internal/numeric.h | 2 + internal/rational.h | 2 + numeric.c | 53 ++++++++++--------- rational.c | 28 +++++++--- test/ruby/test_arithmetic_sequence.rb | 10 ++++ 7 files changed, 156 insertions(+), 40 deletions(-) test/ruby/test_arithmetic_sequence.rb: remove a duplicated test There is another "test_last_bug17218" --- test/ruby/test_arithmetic_sequence.rb | 5 ----- 1 file changed, 5 deletions(-)
2021-03-20merge revision(s) ↵nagachika
276f6a225d18561cbe5282b798cb4e416c66079f,95bef7b69a6fb42687a6200b338060be307259f5: [Backport #17352] Don't double fractional seconds when passing timezone object to Time.new I found that fractional seconds were doubled when using the timezone feature of Time in Sequel's named_timezones extension (which uses TZInfo for the timezone object), and traced the problem to this code. There is no subsecx being modified in the utc_to_local call below this, and I'm not sure why you would want to add in the fractional seconds unless you assumed the timezone conversion would drop the existing fractional seconds (TZInfo doesn't drop fractional seconds). --- test/ruby/test_time_tz.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) Subsecond of Time::tm should be 0 --- time.c | 1 + 1 file changed, 1 insertion(+)
2021-03-20merge revision(s) ebb96fa8808317ad53a4977bff26cf755d68077e: [Backport #17321]nagachika
Fix singleton class cloning Before this commit, `clone` gave different results depending on whether the original object had an attached singleton class or not. Consider the following setup: ``` class Foo; end Foo.singleton_class.define_method(:foo) {} obj = Foo.new obj.singleton_class if $call_singleton clone = obj.clone ``` When `$call_singleton = false`, neither `obj.singleton_class.singleton_class` nor `clone.singleton_class.singleton_class` own any methods. However, when `$call_singleton = true`, `clone.singleton_class.singleton_class` would own a copy of `foo` from `Foo.singleton_class`, even though `obj.singleton_class.singleton_class` does not. The latter case is unexpected and results in a visibly different clone, depending on if the original object had an attached class or not. Co-authored-by: Ufuk Kayserilioglu <ufuk.kayserilioglu@shopify.com> --- class.c | 31 ++++++++++++++++++++++--------- test/ruby/test_class.rb | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 9 deletions(-)
2021-03-20merge revision(s) c60aaed1856b2b6f90de0992c34771830019e021: [Backport #17130]nagachika
Fix Method#super_method for aliased methods Previously, Method#super_method looked at the called_id to determine the method id to use, but that isn't correct for aliased methods, because the super target depends on the original method id, not the called_id. Additionally, aliases can reference methods defined in other classes and modules, and super lookup needs to start in the super of the defined class in such cases. This adds tests for Method#super_method for both types of aliases, one that uses VM_METHOD_TYPE_ALIAS and another that does not. Both check that the results for calling super methods return the expected values. To find the defined class for alias methods, add an rb_ prefix to find_defined_class_by_owner in vm_insnhelper.c and make it non-static, so that it can be called from method_super_method in proc.c. This bug was original discovered while researching [Bug #11189]. Fixes [Bug #17130] --- proc.c | 13 ++++++-- test/ruby/test_method.rb | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ vm_insnhelper.c | 6 ++-- 3 files changed, 94 insertions(+), 5 deletions(-)
2021-02-27merge revision(s) ↵nagachika
f4be7a510eebbe6507ba41d138d7d252f4a68e90,9441f3f97087a4325ee80911859d37da41fa5050: [Backport #17504] Added tests for Time#getlocal with UTC offset --- test/ruby/test_time.rb | 8 ++++++++ 1 file changed, 8 insertions(+) Allow UTC offset without colons per ISO-8601 [Bug #17504] --- test/ruby/test_time.rb | 6 ++++++ time.c | 44 +++++++++++++++++++++++++++++--------------- 2 files changed, 35 insertions(+), 15 deletions(-)
2021-02-20merge revision(s) eeacdcb9a073c7d8ad703e0dc9faf229a5ebbe3c: [Backport #17558]nagachika
Fixed premature return After setting ruby2_keywords for bmethod, the rest of arguments had been ignored. [Bug #17558] --- test/ruby/test_keyword.rb | 9 +++++++++ vm_method.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)
2021-02-20merge revision(s) 0036648a420f945624898568bb82bc5f83195d12: [Backport #17533]nagachika
Capture to reserved name variables if already defined [Bug #17533] --- parse.y | 5 +++-- test/ruby/test_regexp.rb | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-)
2021-02-20merge revision(s) 6f6dfdcc685077f0f85dcdd63843ecfc0f6fbfb6: [Backport #17523]nagachika
Make warning values consistent [Bug #17523] They should be affected, as well as `$VERBOSE`, by `-w`/`-W` options, not only in the main script but in scripts loaded by `-r` option too. --- ruby.c | 4 ++-- test/ruby/test_rubyoptions.rb | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-)
2021-02-20merge revision(s) ↵nagachika
1b1ea7b3bc9484e6e59d716fce2965a2f39d1e3d,b6e6807993c770c5d2e069d8741f5dadf0b38069: [Backport #17092] Fix Array#flatten for recursive array when given positive depth [Bug #17092] --- array.c | 44 ++++++++++++++++++++++++++------------------ test/ruby/test_array.rb | 14 +++++++++++--- 2 files changed, 37 insertions(+), 21 deletions(-) Initialize memo pointer and use it consistently to silence gcc 7+ --- array.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
2021-02-11merge revision(s) a55eb9a2af7950d180d9d31ffde2bce66710f44f: [Backport #17572]nagachika
Make reciprocal properly of non-integral rational [Bug #17572] --- rational.c | 2 +- test/ruby/test_rational.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)
2021-02-11merge revision(s) ↵nagachika
ce7a053475cbebfb2f3e5ed6614e0ba631541917,1cbb1f1720127b0b34b38c77e27b51b182008699: [Backport #16695] Adjust sp for `x = false; y = (return until x unless x)` [Bug #16695] --- compile.c | 8 +++----- test/ruby/test_syntax.rb | 9 +++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) test/ruby/test_syntax.rb: avoid "warning: assigned but unused variable" --- test/ruby/test_syntax.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
2020-12-31Add leading arguments support to arguments forwardingnagachika
Implements [Feature #16378]
2020-09-29merge revision(s) 996af2ce086249e904b2ce95ab2fcd1de7d757be: [Backport ↵nagachika
#16345] [Backport #17000] Disable deprecation warning by the default [Feature #16345] And `-w` option turns it on.
2020-09-29merge revision(s) df14c758fc705c49c2aaf4c9276a8f7229438fbf: [Backport #17181]nagachika
Make hash returned by Hash#transform_values not have a default This sets an explicit default of nil. There is probably a better approach of removing the default. Fixes [Bug #17181]
2020-09-07Run a TracePoint test in an insolated processnagachika
to prevent a random failure like http://ci.rvm.jp/results/trunk-random2@phosphorus-docker/3024287
2020-09-07Fix a random test failure by TracePointnagachika
A test worker process may already be enabling TracePoint, which results in changing the insn name in this test. http://ci.rvm.jp/results/trunk-random0@phosphorus-docker/3022750
2020-09-06merge revision(s) ff5e66034006a875125581114cce19d46843b32a: [Backport #17015]nagachika
Added `NODE_SPECIAL_EXCESSIVE_COMMA` info to `ARGS` of `RubyVM::AbstractSyntaxTree`.
2020-09-06merge revision(s) 3e02cd518fbe4d91c2aca7fbc3c5aafa387d3cb7: [Backport #17149]nagachika
Trace :return of builtin methods using opt_invokebuiltin_delegate_leave insn. Since Ruby 2.7, :return of methods using builtin have not been traced properly.
2020-09-06merge revision(s) 11963da9e8e98821860fbb0c0f2adc118860c814: [Backport ↵nagachika
#16603] [Backport #17141] Check type of empty keyword [Bug #16603] Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
2020-09-05Revert "Don't display singleton class in Method#inspect unless method ↵nagachika
defined there" [Backport #16771] This reverts commit 0d24fb774d84d4a99454ce10fd343da00049a588.
2020-08-07merge revision(s) 8e189df32cacef4b21e357a590d349330532baf5: [Backport #17013]nagachika
Add operator info to `OP_ASGN2` of `RubyVM::AbstractSyntaxTree`.
2020-08-01merge revision(s) d05f04d27dd86c67e4a8dfff4392f806cf577bdf: [Backport #16931]nagachika
Fixed `defined?` against protected method call Protected methods are restricted to be called according to the class/module in where it is defined, not the actual receiver's class. [Bug #16931]
2020-08-01Split test_defined_methodNobuyoshi Nakada
2020-08-01Fix typo in test namePeter Zhu
2020-08-01Test for [Bug #16669]Nobuyoshi Nakada
2020-08-01Split test_definedNobuyoshi Nakada
2020-07-26merge revision(s) 1b4d406e3a04032b6d01e92b6d184a16945c6ac3: [Backport ↵nagachika
#16498] [Backport #16914] Hash#transform_values should return a plain new Hash [Bug #16498]
2020-07-26partially merge revision adf709a78534c1483ba851ccb0490464ca31503c: [Backport ↵nagachika
#16801] Classes made from Struct should have default new singleton method. Co-authored-by: Yusuke Endoh mame@ruby-lang.org Co-authored-by: John Hawthorn john@hawthorn.email Co-authored-by: Adam Hess HParker@github.com Co-authored-by: Jose Cortinas jacortinas@gmail.com Co-authored-by: Jean Boussier jean.boussier@gmail.com
2020-07-25merge revision(s) 71c166e11e761dcaaa943f9b94da38f86ada1bdb: [Backport #16854]nagachika
Fixed argument forwarding in reserved word method [Bug #16854]
2020-07-25merge revision(s) 08529a61153e5c40f57a65272211357511d6e6db: [Backport #16798]nagachika
Compare environment variable names in those manor [Bug #16798]
2020-07-25merge revision(s) 2f1895fa15386fb3cdc91c5604171290828b9da8: [Backport #16767]nagachika
Fixed formatted substring expansion [Bug #16767]
2020-07-23merge revision(s) 927308108cced69cae478798004524b9a5d2f252: [Backport #16764]nagachika
Fix source location of autoloaded constant [Bug #16764]
2020-07-23merge revision(s) 72c02aa4b79731c7f25c9267f74b347f1946c704: [Backport #16662]nagachika
Moved not-implemented method tests [Bug #16662] Test not-implemented method with the dedicated methods, instead of platform dependent features.
2020-07-23merge revision(s) b23fd59cbb3f097bcd559d0c85a86ff7a1eeeb7e: [Backport #16501]nagachika
marshal.c: Support dump and load of a Hash with the ruby2_keywords flag It is useful for a program that dumps and load arguments (like drb). In future, they should deal with both positional arguments and keyword ones explicitly, but until ruby2_keywords is deprecated, it is good to support the flag in marshal. The implementation is similar to String's encoding; it is dumped as a hidden instance variable. [Feature #16501]
2020-07-23merge revision(s) 579645d9f870fa4116dcd3200bbbb6e2c0b7f400: [Backport #17033]nagachika
Fixed infinite loop at error in printing cause [Bug #17033]
2020-07-23merge revision(s) 99a9c3fe2eaab8157765d792dc871da6daea0327: [Backport #17024]nagachika
Fixed yday and wday with timezone [Bug #17024]
2020-07-19merge revision(s) ↵nagachika
bf1a6771f305ea286a3ae575676924551c03e857,c1463625555b061a2b94c3b6c5581730b482a285: [Backport #17012] [Backport #17014] Fix non-numeric exclusive Range#minmax bug The implementation of Range#minmax added in d5c60214c45 causes the following incorrect behaviour: ('a'...'c').minmax => ["a", ["a", "b"]] instead of ('a'...'c').minmax => ["a", "b"] This is because the C implementation of Range#minmax (range_minmax) directly delegates to the C implementation of Range#min (range_min) and Range#max (range_max), without changing the execution context. Range#max's C implementation (range_max), when given a non-numeric exclusive range, delegates to super, which is meant to call Enumerable#max. However, because range_max is called directly by range_minmax, super calls Enumerable#minmax instead, causing the incorrect nesting. Perhaps it is possible to change the execution context in an optimized manner, but the simplest solution seems to be to just explicitly delegate from Range#minmax to Range#min and Range#max. Use static variables in Range#minmax
2020-07-19merge revision(s) 26c179d7e7e7ae0eb21050659c3e8778358230ab: [Backport #17026]nagachika
Check argument to ObjectSpace._id2ref Ensure that the argument is an Integer or implicitly convert to, before dereferencing as a Bignum. Addressed a regression in b99833baec2. Reported by u75615 at https://hackerone.com/reports/898614