summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2025-03-29[Bug #21202] Fix wrong token concat while tokenizing nested unterminated ↵tomoya ishida
heredoc (#13000) Notes: Merged-By: tompng <tomoyapenguin@gmail.com>
2025-03-28TestRegexp#test_match_cache_positive_look_ahead_complex: Extend the timeout ↵Yusuke Endoh
limit
2025-03-28[ruby/etc] Skip TestEtc#test_ractor_parallel on ModGC workflowNaoto Ono
(https://github.com/ruby/etc/pull/55) https://bugs.ruby-lang.org/issues/21204 TestEtc#test_ractor_parallel is only failing intermittently on ModGC workflow after 87fb0c4. So, we'll skip this test on ModGC workflow. https://github.com/ruby/etc/commit/fb037c5162
2025-03-28Relax assertion pattern for ruby repoHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/13004
2025-03-28[ruby/json] Add missing assert_deprecated_warningJean Boussier
https://github.com/ruby/json/commit/1b16a82980 Notes: Merged: https://github.com/ruby/ruby/pull/13004
2025-03-28[ruby/json] Move `create_addtions` logic in Ruby.Jean Boussier
By leveraging the `on_load` callback we can move all this logic out of the parser. Which mean we no longer have to duplicate that logic in both parser and that we'll later be able to extract it entirely from the gem. https://github.com/ruby/json/commit/f411ddf1ce Notes: Merged: https://github.com/ruby/ruby/pull/13004
2025-03-28[ruby/json] JSON.load invoke the proc callback directly from the parser.Jean Boussier
And substitute the return value like `Marshal.load` doesm which I can only assume was the intent. This also open the door to re-implement all the `create_addition` logic in `json/common.rb`. https://github.com/ruby/json/commit/73d2137fd3 Notes: Merged: https://github.com/ruby/ruby/pull/13004
2025-03-28[ruby/json] Remove `Class#json_creatable?` monkey patch.Jean Boussier
https://github.com/ruby/json/commit/1ca7efed1f Notes: Merged: https://github.com/ruby/ruby/pull/13004
2025-03-28[ruby/json] Cleanup JSON.pretty_generateJean Boussier
https://github.com/ruby/json/commit/01c47a0555 Notes: Merged: https://github.com/ruby/ruby/pull/13004
2025-03-28[ruby/json] Deprecate `JSON.fast_generate`Jean Boussier
https://github.com/ruby/json/commit/6508455d82 Notes: Merged: https://github.com/ruby/ruby/pull/13004
2025-03-27Avoid allocation for anonymous positional splat with no argumentsJeremy Evans
Anonymous positional splats cannot be directly accessed, they can only be passed as splats to other methods. So if an anonymous positional splat would be empty, you can use a shared frozen empty array to save an allocation. ```ruby def a(*) end a() ``` This is similar to how anonymous empty keyword splats are optimized, except those use `nil` instead of a shared empty frozen hash. This updates the allocation tests to check that the array allocations are avoided where possible. It also makes a small change to test_iseq.rb to ensure an unfrozen hash is passed as the value of an anonymous splat parameter. Notes: Merged: https://github.com/ruby/ruby/pull/12596
2025-03-27[ruby/etc] Attempt to re-enable TestEtc#test_ractor_parallelBenoit Daloze
* If this fails, please revert this commit in ruby/etc to keep the repos sync'ed. https://github.com/ruby/etc/commit/87fb0c4a83
2025-03-27[ruby/etc] Speedup TestEtc#test_ractor_parallelBenoit Daloze
https://github.com/ruby/etc/commit/18c12c084c
2025-03-27[ruby/etc] Increase timeout for test_ractor_parallelBenoit Daloze
* It seems much slower on macOS (locally on Linux it's always < 1 second). https://github.com/ruby/etc/commit/9e46857011
2025-03-27[ruby/prism] Move snapshotsKevin Newton
This is messing up the CRuby sync, so moving them out of the test directory will make this easier. https://github.com/ruby/prism/commit/7ba13bfb68
2025-03-27Avoid array allocation for *nil, by not calling nil.to_aJeremy Evans
The following method call: ```ruby a(*nil) ``` A method call such as `a(*nil)` previously allocated an array, because it calls `nil.to_a`, but I have determined this array allocation is unnecessary. The instructions in this case are: ``` 0000 putself ( 1)[Li] 0001 putnil 0002 splatarray false 0004 opt_send_without_block <calldata!mid:a, argc:1, ARGS_SPLAT|FCALL> 0006 leave ``` The method call uses `ARGS_SPLAT` without `ARGS_SPLAT_MUT`, so the returned array doesn't need to be mutable. I believe all cases where `splatarray false` are used allow the returned object to be frozen, since the `false` means to not duplicate the array. The optimization in this case is to have `splatarray false` push a shared empty frozen array, instead of calling `nil.to_a` to return a newly allocated array. There is a slightly backwards incompatibility with this optimization, in that `nil.to_a` is not called. However, I believe the new behavior of `*nil` not calling `nil.to_a` is more consistent with how `**nil` does not call `nil.to_hash`. Also, so much Ruby code would break if `nil.to_a` returned something different from the empty hash, that it's difficult to imagine anyone actually doing that in real code, though we have a few tests/specs for that. I think it would be bad for consistency if `*nil` called `nil.to_a` in some cases and not others, so this changes other cases to not call `nil.to_a`: For `[*nil]`, this uses `splatarray true`, which now allocates a new array for a `nil` argument without calling `nil.to_a`. For `[1, *nil]`, this uses `concattoarray`, which now returns the first array if the second array is `nil`. This updates the allocation tests to check that the array allocations are avoided where possible. Implements [Feature #21047] Notes: Merged: https://github.com/ruby/ruby/pull/12597
2025-03-27[ruby/psych] Format Date in ISO-8601 explicitlyNobuyoshi Nakada
Fix https://github.com/ruby/psych/pull/644 https://github.com/ruby/psych/commit/b1ade765ba
2025-03-27Skip TestThreadInstrumentation#test_sleeping_inside_ractor on ModGC workflow ↵Naoto Ono
(#12996) TestThreadInstrumentation#test_sleeping_inside_ractor is a flaky and failing intermittently. Additionally, Launchable reported this test as a top flaky test. (Link: https://app.launchableinc.com/organizations/ruby/workspaces/ruby/insights/unhealthy-tests) It failed only failed intermittently on ModGC workflow, so I'm gonna skip this test on ModGC workflow. Notes: Merged-By: ono-max <onoto1998@gmail.com>
2025-03-27[rubygems/rubygems] Have "gem exec" sort executable names in error message.Ellen Marie Dash
This decouples `gem exec` behavior (and tests) from the sort order of the gemspec. https://github.com/rubygems/rubygems/commit/911cd29159
2025-03-27Pend a test for ractor in etcYusuke Endoh
... because it is flaky Notes: Merged: https://github.com/ruby/ruby/pull/12992
2025-03-27Removed trailing spacesHiroshi SHIBATA
2025-03-27Faster integer formattingeno
This commit provides an alternative implementation for a long → decimal conversion. The main difference is that it uses an algorithm pulled from https://github.com/jeaiii/itoa. The source there is C++, it was converted by hand to C for inclusion with this gem. jeaiii's algorithm is covered by the MIT License, see source code. On addition this version now also generates the string directly into the fbuffer, foregoing the need to run a separate memory copy. As a result, I see a speedup of 32% on Apple Silicon M1 for an integer set of benchmarks.
2025-03-27[ruby/json] Deprecate all `*_default_options`Jean Boussier
Globally changing the behavior of the library is a bad idea, as many different libraries may rely on `json` and may not expect it and likely never tested that a different default config works for them. If you need to change the behavior of JSON, it's best to do it only locally, and not globally. In addition the new `JSON::Coder` interface is much more suited for that. Another reason for the deprecation is that it's impossible to make `JSON.load` and `JSON.dump` Ractor-safe with such API. https://github.com/ruby/json/commit/172762c6e4
2025-03-26Add additional Ractor.make_shareable testsJohn Hawthorn
Notes: Merged: https://github.com/ruby/ruby/pull/12977
2025-03-25[ruby/etc] Etc.sysconfdir does not work in a RactorBenoit Daloze
* Because it uses RbConfig::CONFIG. * See https://github.com/ruby/ruby/actions/runs/14069312270/job/39399502142#step:12:947 https://github.com/ruby/etc/commit/12dbe03b6a
2025-03-25[ruby/etc] Most Etc methods are not Ractor-safe currentlyBenoit Daloze
* See https://bugs.ruby-lang.org/issues/21115 https://github.com/ruby/etc/commit/ae62b7619c
2025-03-24[ruby/json] Adjust fpconv to add ".0" to integerseno
Adds a test case fix https://github.com/ruby/json/commit/fa5bdf87cb
2025-03-24[rubygems/rubygems] Default to a SOURCE_DATE_EPOCH of 315619200, to simplify ↵Ellen Marie Dash
reproducible builds. https://github.com/rubygems/rubygems/commit/1d5a627398 Notes: Merged: https://github.com/ruby/ruby/pull/12968
2025-03-24[rubygems/rubygems] Let `gem exec` raise an error in ambiguous casesDavid Rodríguez
When `gem exec foo` is run, and "foo" is a gem that has multiple executables, none of them named "foo", raise an error explaining the situation and telling user to be more specific. Currently the first command in the executables array is run, but this may come as surprising sometimes, so better raise an error. https://github.com/rubygems/rubygems/commit/acda5d8f6e Notes: Merged: https://github.com/ruby/ruby/pull/12968
2025-03-23Add test for Ractor safety (#11762)Mohamed Hafez
Notes: Merged-By: eregon <eregontp@gmail.com>
2025-03-23Fix handling of `error`/`errno` in `io_internal_wait`. (#12961)Samuel Williams
[Bug #21195] Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-03-21Fix regexp when non-ruby thread received the signalNobuyoshi Nakada
A space is added only when the source path is found.
2025-03-21Run cleanup code in `ensure`Nobuyoshi Nakada
2025-03-20[ruby/prism] Fix fork check in ractor_test.rbBenoit Daloze
https://github.com/ruby/prism/commit/0073266cad
2025-03-20[ruby/prism] Update ractor_test.rb per reviewKevin Newton
https://github.com/ruby/prism/commit/fd96a6821f Notes: Merged: https://github.com/ruby/ruby/pull/12958
2025-03-20[ruby/prism] Add `Prism::Translation::ParserCurrent`Earlopain
It's not my favorite api but for users that currently use the same thing from `parser`, moving over is more difficult than it needs to be. If you plan to support both old and new ruby versions, you definitly need to branch somewhere on the ruby version to either choose prism or parser. But with prism you then need to enumerate all the versions again and choose the correct one. Also, don't recommend to use `Prism::Translation::Parser` in docs. It's version-less but actually always just uses Ruby 3.4 which is probably not what the user intended. Note: parser also warns when the patch version doesn't match what it expects. But I don't think prism has such a concept, and anyways it would require releases anytime ruby releases, which I don't think is very desirable https://github.com/ruby/prism/commit/77177f9e92
2025-03-20Remove leading `nop` from block when we don't need itAaron Patterson
Blocks insert a leading `nop` instruction in order to execute a "block call" tracepoint. Block compilation unconditionally inserts a leading `nop` plus a label after the instruction: https://github.com/ruby/ruby/blob/641f15b1c6bd8921407a1f045573d3b0605f00d3/prism_compile.c#L6867-L6869 This `nop` instruction is used entirely for firing the block entry tracepoint. The label exists so that the block can contain a loop but the block entry tracepoint is executed only once. For example, the following code is an infinite loop, but should only execute the b_call tracepoint once: ```ruby -> { redo }.call ``` Previous to this commit, we would eliminate the `nop` instruction, but only if there were no other jump instructions inside the block. This means that the following code would still contain a leading `nop` even though the label following the `nop` is unused: ```ruby -> { nil if bar } ``` ``` == disasm: #<ISeq:block in <main>@test.rb:1 (1,2)-(1,17)> (catch: FALSE) 0000 nop ( 1)[Bc] 0001 putself [Li] 0002 opt_send_without_block <calldata!mid:bar, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0004 branchunless 8 0006 putnil 0007 leave [Br] 0008 putnil 0009 leave [Br] ``` This commit checks to see if the label inserted after the `nop` is actually a jump target. If it's not a jump target, then we should be safe to eliminate the leading `nop`: ``` > build-master/miniruby --dump=insns test.rb == disasm: #<ISeq:<main>@test.rb:1 (1,0)-(1,17)> 0000 putspecialobject 1 ( 1)[Li] 0002 send <calldata!mid:lambda, argc:0, FCALL>, block in <main> 0005 leave == disasm: #<ISeq:block in <main>@test.rb:1 (1,2)-(1,17)> 0000 putself ( 1)[LiBc] 0001 opt_send_without_block <calldata!mid:bar, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0003 branchunless 7 0005 putnil 0006 leave [Br] 0007 putnil 0008 leave [Br] ``` We have a test for b_call tracepoints that use `redo` here: https://github.com/ruby/ruby/blob/aebf96f371c8d874398e0041b798892e545fa206/test/ruby/test_settracefunc.rb#L1728-L1736 Notes: Merged: https://github.com/ruby/ruby/pull/12957
2025-03-20[ruby/prism] Dynamically register events to dispatchSam Bostock
Instead of requiring the consumer to provide a list of all events which they wish to handle, we can give them to option of dynamically detecting them, by scanning the listener's public methods. This approach is similar to that used by Minitest (scanning for `test_` methods) and Rails generators (running all public methods in the order they are defined). While this is slower than specifying a hard coded list, the penalty is only during registration. There is no change the the behaviour of dispatching the events. https://github.com/ruby/prism/commit/781ebed743
2025-03-20Close reader pipesNobuyoshi Nakada
2025-03-20[Bug #21026] no singleton method on pseudo variable literalNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12925
2025-03-19[ruby/prism] Mark Prism as ractor-safeKevin Newton
https://github.com/ruby/prism/commit/c02429765b
2025-03-19[ruby/prism] Warn when the parser translator receives an incompatible ↵Earlopain
builder class In https://github.com/ruby/prism/pull/3494 I added a bit of code so that using the new builder doesn't break stuff. This code can be dropped when it is enforced that builder is _always_ the correct subclass (and makes future issues like that unlikely). https://github.com/ruby/prism/commit/193d4b806d
2025-03-19A comment for TestRubyOptions::ExpectedStderrList [ci skip]Nobuyoshi Nakada
2025-03-19Source path may or may not existNobuyoshi Nakada
2025-03-19Loosen SEGV message testingYusuke Endoh
Since `rb_bug` does not always take Ruby frame info during SEGV, the source file path may not be output. ``` 1) Failure: TestRubyOptions#test_crash_report_script [/tmp/ruby/src/trunk_gcc11/test/ruby/test_rubyoptions.rb:907]: Expected / bug\.rb:(?:1:)?\s\[BUG\]\sSegmentation\sfault.*\n /x to match "[BUG] Segmentation fault at 0x000003e900328766\n"+ ``` http://ci.rvm.jp/results/trunk_gcc11@ruby-sp2-noble-docker/5663880
2025-03-18Handle void expressions in defined?Kevin Newton
[Bug #21029] Notes: Merged: https://github.com/ruby/ruby/pull/12949
2025-03-18[ruby/prism] Update truffleruby versionKevin Newton
https://github.com/ruby/prism/commit/2afe89f8ce
2025-03-18[ruby/prism] Add a multiple statements flag to parenthesesKevin Newton
This can get triggered even if the list of statements only contains a single statement. This is necessary to properly support compiling ```ruby defined? (;a) defined? (a;) ``` as "expression". Previously these were parsed as statements lists with single statements in them. https://github.com/ruby/prism/commit/b63b5d67a9
2025-03-18[ruby/prism] Only unnest parser mlhs nodes when no rest argument is providedEarlopain
``` (a,), = [] PARSER==================== s(:masgn, s(:mlhs, s(:mlhs, s(:lvasgn, :a))), s(:array)) PRISM==================== s(:masgn, s(:mlhs, s(:lvasgn, :a)), s(:array)) ``` https://github.com/ruby/prism/commit/8aa1f4690e
2025-03-18[ruby/prism] Fix parser translator multiline interpolated symbolsEarlopain
In https://github.com/ruby/prism/commit/26370079291a420c6b2b7be5cdbd5c609da62f21 I added tests but didn't modify them correctly https://github.com/ruby/prism/commit/de021e74de