summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2023-09-18[Bug #19887] RUBYOPT should work without leading `-`Nobuyoshi Nakada
2023-09-18Simplify restoring ENVNobuyoshi Nakada
2023-09-16Fix regression when testing inclusion in unbounded rangesJeremy Evans
Caused by 04a92a6764bf678919cf4b68a27496a39d6b886a. This treats unbounded ranges of arbitrary objects the same as how unbounded string ranges are treated: (..x) === y # (y <=> x) <= 0 (...x) === y # (y <=> x) < 0 (x..) === y # (x <=> y) <= 0 Fixes [Bug #19864]
2023-09-16[Feature #19839] Fix `Range#overlap?` for empty rangesNobuyoshi Nakada
Empty ranges do not overlap with any range. Regarding benchmarks, PR#8242 is significantly faster in some cases, but one of these two cases is a wrong result. | |ActiveSupport| PR#8242|built-ruby| |:--------------------------|------------:|-------:|---------:| |(2..3).overlap?(1..1) | 7.761M| 15.053M| 32.368M| | | -| 1.94x| 4.17x| |(2..3).overlap?(2..4) | 25.720M| 55.070M| 21.981M| | | 1.17x| 2.51x| -| |(2..3).overlap?(4..5) | 7.616M| 15.048M| 21.730M| | | -| 1.98x| 2.85x| |(2..3).overlap?(2..1) | 25.585M| 56.545M| 32.786M| | | -| 2.21x| 1.28x| |(2..3).overlap?(0..1) | 7.554M| 14.755M| 32.545M| | | -| 1.95x| 4.31x| |(2..3).overlap?(...1) | 6.681M| 5.843M| 32.255M| | | 1.14x| -| 5.52x| |(2...3).overlap?(..2) | 6.676M| 5.817M| 21.572M| | | 1.15x| -| 3.71x| |(2...3).overlap?(3...) | 7.392M| 14.755M| 31.805M| | | -| 2.00x| 4.30x| |(2..3).overlap?('a'..'d') | 3.675M| 3.482M| 17.009M| | | 1.06x| -| 4.89x|
2023-09-16[Feature #19839] Add Range#overlap?Shouichi Kamiya
Add a method that returns true if two range overlap, otherwise false. ``` (0..10).overlap?(5..15) #=> true (0..10).overlap?(20..30) #=> false ```
2023-09-15[Bug #19882] Reject tokens invalid as symbolsNobuyoshi Nakada
2023-09-15Fix Thread#native_thread_id being cached across fork (#8418)KJ Tsanaktsidis
The native thread ID can and does change on some operating systems (e.g. Linux) after forking, so it needs to be re-queried. [Bug #19873] Notes: Merged-By: nurse <naruse@airemix.jp>
2023-09-15[Bug #19877] Fix flip-flop in blockNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8440
2023-09-15[Bug #19877] Named captures should take place from regexps in blockNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8440
2023-09-15[Bug #19877] Literals cannot have singleton methods even in blocksNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8440
2023-09-14Fix `io_buffer_get_string` default length computation. (#8427)Samuel Williams
* Fix `io_buffer_get_string` default length computation. When an offset bigger than the size is given, the resulting length will be computed incorrectly. Raise an argument error in this case. * Validate all arguments. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-09-14[Bug #19868] Deprecate `Process::Status#&` and `Process::Status#>>`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8392
2023-09-14[Bug #19868] Suggest other Process::Status method for `&` and `>>`Nobuyoshi Nakada
`Process::Status#&` and `Process::Status#>>` are provided only for the backward compatibility with older Ruby than 1.8 where `$?` was a `Fixnum`, and the knowledge about internals of system dependent macros is necessary to use them. Modern programs and libraries should not need these methods. Notes: Merged: https://github.com/ruby/ruby/pull/8392
2023-09-14Negative value to Process::Status method for compatibilityNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8392
2023-09-13math.c: Fix Math.log against huge bignum [Bug #19878]Yusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/8429
2023-09-13[Bug #19872] Refine TestRequireLibNobuyoshi Nakada
Always test only the scripts just under “lib", and just under child directories which has not the same name script in the upper level; instead of random sampling from whole libraries.
2023-09-13Suppress an unused variable warningNobuyoshi Nakada
2023-09-13[Bug #19862] Skip compiled result of never reachable expressionNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8381
2023-09-13[Bug #19754] Make `IO::Buffer#get_string` check `offset` range (#8016)Nobuyoshi Nakada
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-09-12Make Kernel#lambda raise when given non-literal blockAlan Wu
Previously, Kernel#lambda returned a non-lambda proc when given a non-literal block and issued a warning under the `:deprecated` category. With this change, Kernel#lambda will always return a lambda proc, if it returns without raising. Due to interactions with block passing optimizations, we previously had two separate code paths for detecting whether Kernel#lambda got a literal block. This change allows us to remove one path, the hack done with rb_control_frame_t::block_code introduced in 85a337f for supporting situations where Kernel#lambda returned a non-lambda proc. [Feature #19777] Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/8405
2023-09-12Ensure signaled processes at opening FIFO terminatedNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8421
2023-09-08Fix weak_references count testMatt Valentine-House
This test creates a lot of Objects held in an array, and a set of weak references to them using WeakMap. It then clears the array and frees it and asserts that all the weak references to it are also gone. This test is failing because one of the dummy objects in our weakmap is ending up on the stack, and so is being marked, even though we thought that we'd removed the only reference to it. This behaviour has changed since this commit: https://github.com/ruby/ruby/commit/5b5ae3d9e064e17e2a7d8d21d739fcc62ae1075c which rewrites `Integer#times` from C into Ruby. This change is somehow causing the last object we append to our array to consistently end up on the stack during GC. This commit fixes the specific weakmap test by using an enumerator and each, instead of `Integer#times`, and thus avoids having our last object created end up on the stack. Notes: Merged: https://github.com/ruby/ruby/pull/8402
2023-09-07Rewrite Integer#times in Ruby (#8388)Takashi Kokubun
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-09-07[Bug #19549] Check for variables to be interpolatedNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7615
2023-09-06Fix crash in WeakMap during compactionPeter Zhu
WeakMap can crash during compaction because the st_insert could allocate memory.
2023-09-06Try to fix flaky test_warmup_frees_pagesPeter Zhu
This test sometimes fails with: ``` 1) Failure: TestProcess#test_warmup_frees_pages [test/ruby/test_process.rb:2750]: <202> expected but was <203>. ```
2023-09-05Pattern matching has not been experimentalyui-knk
Notes: Merged: https://github.com/ruby/ruby/pull/8360
2023-09-04Add debug info for flaky test_warmup_frees_pagesPeter Zhu
This test sometimes fails with: ``` 1) Failure: TestProcess#test_warmup_frees_pages [test/ruby/test_process.rb:2751]: <0> expected but was <1>. ``` I'm not sure why, so add some debug info.
2023-09-01Add regression tests for start_with?/delete_prefixywenc
Notes: Merged: https://github.com/ruby/ruby/pull/8348
2023-09-01Try to fix flaky test for Process.warmupPeter Zhu
The test sometimes fails with: ``` 1) Failure: TestProcess#test_warmup_frees_pages [test/ruby/test_process.rb:2749]: <0> expected but was <1>. ``` I think there's a page with an object that needs finalization, so run GC to clear that object.
2023-09-01Fix flaky test for Process.warmupPeter Zhu
The test sometimes fails with: ``` 1) Failure: TestProcess#test_warmup_run_major_gc_and_compact [test/ruby/test_process.rb:2712]: <2> expected but was <3>. ```
2023-09-01[Bug #19281] Allow semicolon in parenthesis at the first argument of command ↵yui-knk
call Allow compstmt in the first argument of command call wrapped with parenthesis like following arguments with parenthesis. Notes: Merged: https://github.com/ruby/ruby/pull/8347
2023-09-01[Bug-18878] Parse qualified const with brace block as method callNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8343
2023-08-31YJIT: Handle getblockparamproxy with ifuncJohn Hawthorn
getblockparamproxy for "ifunc" behaves identically to iseq, in just pushing rb_block_param_proxy. Notes: Merged: https://github.com/ruby/ruby/pull/8300
2023-08-31Correctly calculate initial pagesPeter Zhu
The old algorithm could calculate an undercount for the initial pages due to two issues: 1. It did not take into account that some heap pages will have one less slot due to alignment. It assumed that every heap page would be able to be fully filled with slots. Pages that are unaligned with the slot size will lose one slot. The new algorithm assumes that every page will be unaligned. 2. It performed integer division, which truncates down. This means that the number of pages might not actually satisfy the number of slots. This can cause the heap to grow in `gc_sweep_finish_size_pool` after allocating all of the allocatable pages because the total number of slots would be less than the initial configured number of slots. Notes: Merged: https://github.com/ruby/ruby/pull/8333
2023-08-31[Bug #19349] Respect `#to_int` of `base` argumentNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7144
2023-08-31Separate test for `Kernel#Integer` with `base` argumentNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7144
2023-08-30Change heap init environment variable namesPeter Zhu
This commit changes RUBY_GC_HEAP_INIT_SIZE_{40,80,160,320,640}_SLOTS to RUBY_GC_HEAP_{0,1,2,3,4}_INIT_SLOTS. This is easier to use because the user does not need to determine the slot sizes (which can vary between 32 and 64 bit systems). They now just use the heap names (`GC.stat_heap.keys`). Notes: Merged: https://github.com/ruby/ruby/pull/8335
2023-08-29Fix Array#bsearch when block returns a non-integer numeric valueKouhei Yanagita
Notes: Merged: https://github.com/ruby/ruby/pull/8314
2023-08-29[Feature #18183] Add `chars:` option to `Random#alphanumeric`Nobuyoshi Nakada
2023-08-28Fix growth in minor GC when we have initial slotsPeter Zhu
If initial slots is set, then during a minor GC, if we have allocatable pages but the heap is mostly full, then we will set `grow_heap` to true since `total_slots` does not count allocatable pages so it will be less than `init_slots`. This can cause `allocatable_pages` to grow to much higher than desired since it will appear that the heap is mostly full. Notes: Merged: https://github.com/ruby/ruby/pull/8310
2023-08-28Remove --disable-gems in assert_in_out_errPeter Zhu
assert_in_out_err adds --disable=gems so we don't need to add --disable-gems in the args list. Notes: Merged: https://github.com/ruby/ruby/pull/8303
2023-08-27Free all empty heap pages in Process.warmupPeter Zhu
This commit adds `free_empty_pages` which frees all empty heap pages and moves the number of pages freed to the allocatable pages counter. This is used in Process.warmup to improve performance because page invalidation from copy-on-write is slower than allocating a new page. Notes: Merged: https://github.com/ruby/ruby/pull/8257
2023-08-25[Feature #19785] Deprecate RUBY_GC_HEAP_INIT_SLOTSPeter Zhu
This environment variable is replaced by `RUBY_GC_HEAP_INIT_SIZE_%d_SLOTS`, so it doesn't make sense to keep it. Notes: Merged: https://github.com/ruby/ruby/pull/8147
2023-08-26[Bug #19784] Fix behaviors against prefix with broken encodingNobuyoshi Nakada
- String#start_with? - String#delete_prefix - String#delete_prefix! Notes: Merged: https://github.com/ruby/ruby/pull/8296
2023-08-26Split string testsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8296
2023-08-25Implement WeakKeyMap using weak referencesPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/8113
2023-08-25Implement WeakMap using weak referencesPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/8113
2023-08-25Expose stats about weak referencesPeter Zhu
[Feature #19783] This commit adds stats about weak references to `GC.latest_gc_info`. It adds the following two keys: - `weak_references_count`: number of weak references registered during the last GC. - `retained_weak_references_count`: number of weak references that survived the last GC. Notes: Merged: https://github.com/ruby/ruby/pull/8113
2023-08-25[Bug #19848] Flush BOMNobuyoshi Nakada
The token just after BOM needs to position at column 0, so that the indentation matches closing line. Notes: Merged: https://github.com/ruby/ruby/pull/8281