summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2025-06-30ZJIT: Don't compile functions with unhandled parameter types (#13749)Max Bernstein
2025-06-30[ruby/prism] Fix parser translator with trailing backslash in `%W` /`%I` arrayEarlopain
https://docs.ruby-lang.org/en/master/syntax/literals_rdoc.html#label-25w+and+-25W-3A+String-Array+Literals > %W allow escape sequences described in Escape Sequences. However the continuation line <newline> is not usable because it is interpreted as the escaped newline described above. https://github.com/ruby/prism/commit/f5c7460ad5
2025-06-30Optimize 'json_parse_string' using SIMD.Scott Myron
2025-06-30[rubygems/rubygems] Added push_rubygem to default scope at gem signin commandHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/9b9ba0bf1e
2025-06-29[ruby/optparse] JRuby does not have EXECUTABLE_EXTS in RbConfg::CONFIGNobuyoshi Nakada
https://github.com/ruby/optparse/commit/15b2f00b6b
2025-06-29[ruby/optparse] Fix OptionParser#program_name not to strip suffix unexpectedlyNobuyoshi Nakada
https://github.com/ruby/optparse/commit/740ffa76c0
2025-06-29[ruby/optparse] Enhance to support 'Set' object as an enumkwatch
(https://github.com/ruby/optparse/pull/76) * Enhance to support 'Set' object as an enum * Add test script for '#make_swithc()' --------- https://github.com/ruby/optparse/commit/3869000e98 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2025-06-28ZJIT: Codegen for `defined?(yield)`Alan Wu
Lots of stdlib methods such as Integer#times and Kernel#then use this, so at least this will make writing tests slightly easier.
2025-06-27ZJIT: Add TODOs and omitted test for nested scope local accessAlan Wu
2025-06-27ZJIT: Add codegen for GetLocal and SetLocalAlan Wu
They're only used when level≠0. Same EP hopping logic as interpreter and YJIT. Change assert_compiles() to get ISeq by method name since the old code didn't support methods defined using define_method() which I need for the new test.
2025-06-27[ruby/io-console] Fix a name errorNobuyoshi Nakada
https://github.com/ruby/io-console/commit/e0398acad4
2025-06-27[ruby/io-console] Ignore printed control charNobuyoshi Nakada
It's something we don't expect and might be coming from somewhere else. https://github.com/ruby/io-console/commit/c5e47a900c
2025-06-27[ruby/io-console] Revert "Ignore `^C` at interrupt"Nobuyoshi Nakada
This reverts commit https://github.com/ruby/io-console/commit/f0646b2b6ae3. https://github.com/ruby/io-console/commit/2e0e01263a
2025-06-26Fix flaky TestGc#test_heaps_grow_independentlyPeter Zhu
The test sometimes fails with "Expected 2062788 to be < 2000000" because heap 0 has not been cleared yet by GC. This commit fixes it to run GC before the assertion to ensure that it does not flake.
2025-06-26Introduce Namespace#evalAaron Patterson
This commit adds an `eval` method to `Namespace` that takes a string and evaluates the string as Ruby code within the context of that namespace. For example: ```ruby n = Namespace.new n.eval("class TestClass; def hello; 'from namespace'; end; end") instance = n::TestClass.new instance.hello # => "from namespace" ``` [Feature #21365]
2025-06-26[ruby/uri] Escape reserved characters in scheme nameNobuyoshi Nakada
Fix https://github.com/ruby/uri/pull/89 https://github.com/ruby/uri/commit/d543c0dafa
2025-06-25[ruby/openssl] pkey: use EVP_PKEY_new_raw_{private,public}_key_ex() if availableKazuki Yamaguchi
Algorithms implemented only in OpenSSL 3 providers may not have a corresponding NID. The *_ex() variants have been added in OpenSSL 3.0 to handle such algorithms, by taking algorithm names as a string. https://github.com/ruby/openssl/commit/e730e457cc
2025-06-25[ruby/openssl] pkey: handle EVP_PKEY_KEYMGMT return by EVP_PKEY_id()Kazuki Yamaguchi
For algorithms implemented solely in an OpenSSL 3 provider, without an associated EVP_PKEY_METHOD, EVP_PKEY_id() returns a special value EVP_PKEY_KEYMGMT. Let OpenSSL::PKey::PKey#oid raise an exception as necessary. Update PKey#inspect to include the string returned by EVP_PKEY_get0_type_name(), if available. https://github.com/ruby/openssl/commit/bd3e32270e
2025-06-25Include Set subclass name in Set#inspect outputJeremy Evans
Fixes [Bug #21377] Co-authored-by: zzak <zzak@hey.com>
2025-06-25Simplify Set#inspect outputJeremy Evans
As Set is now a core collection class, it should have special inspect output. Ideally, inspect output should be suitable to eval, similar to array and hash (assuming the elements are also suitable to eval): set = Set[1, 2, 3] eval(set.inspect) == set # should be true The simplest way to do this is to use the Set[] syntax. This deliberately does not use any subclass name in the output, similar to array and hash. It is more important that users know they are dealing with a set than which subclass: Class.new(Set)[] # this does: Set[] # not: #<Class:0x00000c21c78699e0>[] This inspect change breaks the power_assert bundled gem tests, so add power_assert to TEST_BUNDLED_GEMS_ALLOW_FAILURES in the workflows. Implements [Feature #21389]
2025-06-24Disallow forking from non-main ractorJean Boussier
[Bug #17516] `fork(2)` only leave the calling thread alive in the child. Because of this forking from the non-main ractor can easily leave the VM in a corrupted state. It may be possible in the future to carefully allow forking from non-main Ractor, but shot term it's preferable to add this restriction.
2025-06-24[ruby/json] Deprecate duplicate keys in objectJean Boussier
There are few legitimate use cases for duplicate keys, and can in some case be exploited. Rather to always silently accept them, we should emit a warning, and in the future require to explictly allow them. https://github.com/ruby/json/commit/06f00a42e8
2025-06-24Set up callable_method_entry for DUMMY frame on ArgumentErrorYusuke Endoh
Before the patch: ``` $ ./miniruby -e '[1, 2].inject(:tap)' -e:1:in '<main>': wrong number of arguments (given 1, expected 0) (ArgumentError) from -e:1:in 'Enumerable#inject' from -e:1:in '<main>' ``` After the patch: ``` $ ./miniruby -e '[1, 2].inject(:tap)' -e:1:in 'Kernel#tap': wrong number of arguments (given 1, expected 0) (ArgumentError) from -e:1:in 'Enumerable#inject' from -e:1:in '<main>' ``` Fixes https://bugs.ruby-lang.org/issues/20968#change-113811
2025-06-24[Bug #21449] Fix Set#divide{|a,b|} using Union-find structure (#13680)tomoya ishida
* [Bug #21449] Fix Set#divide{|a,b|} using Union-find structure Implements Union-find structure with path compression. Since divide{|a,b|} calls the given block n**2 times in the worst case, there is no need to implement union-by-rank or union-by-size optimization. * Avoid internal arrays from being modified from block passed to Set#divide Internal arrays can be modified from yielded block through ObjectSpace. Freeze readonly array, use ALLOCV_N instead of mutable array.
2025-06-23Merge blocks for the same conditionNobuyoshi Nakada
2025-06-23[rubygems/rubygems] Handle RubyGems installing to custom dir with ↵Nicholas La Roux
non-existent parent dirs https://github.com/rubygems/rubygems/commit/4701123601
2025-06-22Avoid allocation for positional splat for literal array keyword argumentJeremy Evans
If all nodes in the array are safe, then it is safe to avoid allocation for the positional splat: ```ruby m(*a, kw: [:a]) # Safe m(*a, kw: [meth]) # Unsafe ``` This avoids an unnecessary allocation in a Rails method call. Details: https://github.com/rails/rails/pull/54949/files#r2052645431
2025-06-21variable.c: avoid out of bound write in `generic_field_set`Jean Boussier
[Bug #21445]
2025-06-21Fix handling of PM_CONSTANT_PATH_NODE node in keyword arguments with ARGS_SPLATJeremy Evans
This was handled correctly in parse.y (NODE_COLON2), but not in prism. This wasn't caught earlier, because I only added tests for the optimized case and not the unoptimized case. Add tests for the unoptimized case. In code terms: ```ruby m(*a, kw: lvar::X) # Does not require allocation for *a m(*a, kw: method()::X) # Requires allocation for *a ``` This commit fixes the second case when prism is used.
2025-06-20[ruby/openssl] ssl: add SSLContext#sigalgs= and #client_sigalgs=Kazuki Yamaguchi
Add methods for setting supported signature algorithms, corresponding to SSL_CTX_set1_sigalgs_list() and SSL_CTX_set1_client_sigalgs_list(), respectively. https://github.com/ruby/openssl/commit/6bbe58c492 Co-authored-by: Markus Jung <markus.jung@vivavis.com>
2025-06-20[ruby/io-console] Ignore `^C` at interruptNobuyoshi Nakada
It's something we don't expect and might be coming from somewhere else. https://github.com/ruby/io-console/commit/f0646b2b6a
2025-06-19ZJIT: Add `dupn` supportAlan Wu
Notes: Merged: https://github.com/ruby/ruby/pull/13641
2025-06-19Relax delta valueHiroshi SHIBATA
https://github.com/ruby/ruby/actions/runs/15751511003/job/44397451542?pr=13649 ``` 1) Failure: TestLastThread#test_last_thread [/Users/runner/work/ruby/ruby/src/test/-ext-/gvl/test_last_thread.rb:18]: Expected |1.0 - 1.167141| (0.16714099999999998) to be <= 0.16. ```
2025-06-19[rubygems/rubygems] Allow enabling "Bundler 3 mode" more easilyDavid Rodríguez
Currently to test Bundler 3 mode we have to actually edit the version file to simulate we're running a future version. This is inconvenient. Instead, allow passing an environment variable, `BUNDLER_3_MODE`, to set the "working mode" Bundler should use. This can now be set easily by end users to enable them to try out the changes in the future version and give us feedback. It's unclear how version auto-switching should work when this environment variable is set, so the auto-switching feature will be disabled in that case. https://github.com/rubygems/rubygems/commit/4e92e9b209
2025-06-18ZJIT: Support invokebuiltin opcodes (#13632)Daniel Colson
* `invokebuiltin` * `invokebuiltin_delegate` * `invokebuiltin_delegate_leave` These instructions all call out to a C function, passing EC, self, and some number of arguments. `invokebuiltin` gets the arguments from the stack, whereas the `_delegate` instructions use a subset of the locals. `opt_invokebuiltin_delegate_leave` has a fast path for `leave`, but I'm not sure we need to do anything special for that here (FWIW YJIT appears to treat the two delegate instructions the same). Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2025-06-18Add a test for the previous commitYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/13238
2025-06-17Refactor generic fields to use `T_IMEMO/fields` objects.Jean Boussier
Followup: https://github.com/ruby/ruby/pull/13589 This simplify a lot of things, as we no longer need to manually manage the memory, we can use the Read-Copy-Update pattern and avoid numerous race conditions. Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/13626
2025-06-17ZJIT: Add codegen (and FrameState) for GetConstPathAlan Wu
Issue a call to rb_vm_opt_getconstant_path() like the interpreter, but since that allocates the IC, we need to save the PC before calling. Add FrameState to GetConstPath to get access to the PC. Notes: Merged: https://github.com/ruby/ruby/pull/13628
2025-06-17ZJIT: Parse opt freeze insns to HIRDaniel Colson
* `opt_hash_freeze` * `opt_ary_freeze` * `opt_str_freeze` * `opt_str_uminus` Similar to `opt_neq`, but there are no args for `freeze` Co-authored-by: ywenc <ywenc@github.com> Co-authored-by: Max Bernstein <max@bernsteinbear.com> Notes: Merged: https://github.com/ruby/ruby/pull/13588
2025-06-17[ruby/prism] [DOC] Fix a typo in commentNobuyoshi Nakada
ruby/ruby#13636 https://github.com/ruby/prism/commit/e13d4f19db Co-Authored-By: Tim Smith <tsmith84@gmail.com>
2025-06-17[rubygems/rubygems] Fix `gem install` sometimes compiling the wrong source filesDavid Rodríguez
If a previous copy of a gem is already installed, RubyGems will not reinstall the gem but only recompile its extensions. This seems like a good idea, but only if the gem is being installed from the registry. If we are installing a locally built package, then the package should be completely reinstalled and extensions compiled from the sources in the locally built package, not from the sources in the previous installation. https://github.com/rubygems/rubygems/commit/1c282d98d5
2025-06-17[rubygems/rubygems] Refactor some logic to create extconf files for testsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/9a859078ab
2025-06-17[rubygems/rubygems] Use `Dir.chdir` with a blockDavid Rodríguez
I don't see any warnings. https://github.com/rubygems/rubygems/commit/395df777a2
2025-06-17io_buffer: Reimplement dcompact for IO::BufferKasumi Hanazuki
The `source` field in IO::Buffer can have a String or an IO::Buffer object, if not nil. - When the `source` is a String object. The `base` field points to the memory location of the String content, which can be embedded in RSTRING, and in that case, GC compaction can move the memory region along with the String object. Thus, IO::Buffer needs to pin the `source` object to prevent `base` pointer from becoming invalid. - When the `source` is an IO::Buffer, then `base` is a pointer to a malloced or mmapped memory region, managed by the source IO::Buffer. In this case, we don't need to pin the source IO::Buffer object, since the referred memory region won't get moved by GC. Closes: [Bug #21210] Notes: Merged: https://github.com/ruby/ruby/pull/13033
2025-06-17ZJIT: Add codegen for StringCopyDaniel Colson
Prior to this commit we compiled `putstring` and `putchilledstring` to `StringCopy`, but then failed to compile past HIR. This commit adds codegen for `StringCopy` to call `rb_ec_str_ressurrect` as the VM does for these instructions. Notes: Merged: https://github.com/ruby/ruby/pull/13625
2025-06-16Add test for `IO::Buffer.for(frozen_string) {}` and omit rb_str_{,un}locktmp ↵Benoit Daloze
in that case Notes: Merged: https://github.com/ruby/ruby/pull/13615
2025-06-16ZJIT: Add support for putspecialobject (#13565)Stan Lo
* ZJIT: Add support for putspecialobject * Address feedback * Update tests * Adjust the indentation of a Ruby test --------- Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2025-06-16Use `success` option to check if the process failedNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/13624
2025-06-16Suppress stderr output in `TestRubyOptions#assert_segv`Nobuyoshi Nakada
It is checked against the given `list`, do not print the same output twice. Notes: Merged: https://github.com/ruby/ruby/pull/13624
2025-06-16Use the message given to `TestRubyOptions#assert_segv`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/13624