summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2022-03-29Avoid trace events in implementation of TracePoint#enableJeremy Evans
This is more backwards compatible, and should fix issues with power_assert. Unfortunately, it requires using a sentinel value as the default value of target_thread, instead of the more natural expression used in the original approach. Notes: Merged: https://github.com/ruby/ruby/pull/5359
2022-03-29Make TracePoint#enable with block target current thread by defaultJeremy Evans
If TracePoint#enable is passed a block, it previously started the trace on all threads. This changes it to trace only the current thread by default. To limit the scope of the change, the current thread is only used by default if target and target_line are both nil. You can pass target_thread: nil to enable tracing on all threads, to get the previous default behavior. Fixes [Bug #16889] Notes: Merged: https://github.com/ruby/ruby/pull/5359
2022-03-29Fix multiplex backreferencs near end of string in regexp matchJeremy Evans
Idea from Jirka Marsik. Fixes [Bug #18631] Notes: Merged: https://github.com/ruby/ruby/pull/5710
2022-03-29Make define_singleton_method always define a public methodJeremy Evans
In very unlikely cases, it could previously define a non-public method starting in Ruby 2.1. Fixes [Bug #18561] Notes: Merged: https://github.com/ruby/ruby/pull/5636
2022-03-25Revert "Finer-grained inline constant cache invalidation"Nobuyoshi Nakada
This reverts commits for [Feature #18589]: * 8008fb7352abc6fba433b99bf20763cf0d4adb38 "Update formatting per feedback" * 8f6eaca2e19828e92ecdb28b0fe693d606a03f96 "Delete ID from constant cache table if it becomes empty on ISEQ free" * 629908586b4bead1103267652f8b96b1083573a8 "Finer-grained inline constant cache invalidation" MSWin builds on AppVeyor have been crashing since the merger. Notes: Merged: https://github.com/ruby/ruby/pull/5715 Merged-By: nobu <nobu@ruby-lang.org>
2022-03-24Raise RuntimeError if Kernel#binding is called from a non-Ruby frameJeremy Evans
Check whether the current or previous frame is a Ruby frame in call_trace_func before attempting to create a binding for the frame. Fixes [Bug #18487] Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> Notes: Merged: https://github.com/ruby/ruby/pull/5567
2022-03-24Finer-grained inline constant cache invalidationKevin Newton
Current behavior - caches depend on a global counter. All constant mutations cause caches to be invalidated. ```ruby class A B = 1 end def foo A::B # inline cache depends on global counter end foo # populate inline cache foo # hit inline cache C = 1 # global counter increments, all caches are invalidated foo # misses inline cache due to `C = 1` ``` Proposed behavior - caches depend on name components. Only constant mutations with corresponding names will invalidate the cache. ```ruby class A B = 1 end def foo A::B # inline cache depends constants named "A" and "B" end foo # populate inline cache foo # hit inline cache C = 1 # caches that depend on the name "C" are invalidated foo # hits inline cache because IC only depends on "A" and "B" ``` Examples of breaking the new cache: ```ruby module C # Breaks `foo` cache because "A" constant is set and the cache in foo depends # on "A" and "B" class A; end end B = 1 ``` We expect the new cache scheme to be invalidated less often because names aren't frequently reused. With the cache being invalidated less, we can rely on its stability more to keep our constant references fast and reduce the need to throw away generated code in YJIT. Notes: Merged: https://github.com/ruby/ruby/pull/5433
2022-03-23Raise ArgumentError when calling Enumberable#inject without block or argumentsJeremy Evans
Previously, this would work as expected if the enumerable contained 0 or 1 element, and would raise LocalJumpError otherwise. That inconsistent behavior is likely to lead to bugs. Fixes [Bug #18635] Notes: Merged: https://github.com/ruby/ruby/pull/5690
2022-03-19Make a dedecated assertion to clarify failed assertionsNobuyoshi Nakada
2022-03-18Add String#bytespliceShugo Maeda
Notes: Merged: https://github.com/ruby/ruby/pull/5584
2022-03-17Make Proc#parameters support lambda keyword for returning parameters as if ↵Jeremy Evans
lambda This makes it easier to use Proc#parameters to build wrappers. Implements [Feature #15357] Notes: Merged: https://github.com/ruby/ruby/pull/5677
2022-03-18A positional Hash is not keyword arguments [Bug #18632]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5676
2022-03-17A positional Hash is not keyword arguments [Bug #18632]Nobuyoshi Nakada
2022-03-16Revert "Fix version check to use Emoji version for ↵Martin Dürst
emoji-variation-sequences.txt" This reverts commit 48f1e8c5d85043e6adb8e93c94532daa201d42e9.
2022-03-16Revert "Allow `.0` version mismatch to pass the tests"Martin Dürst
This reverts commit fc6e4ce62bfa95b6a0d4d4898e1128c1fce4db8a.
2022-03-16Allow `.0` version mismatch to pass the testsKoichi Sasada
With `make update-unicode`, some tests failed with the following error due to header mismatch. * `RbConfig::CONFIG['UNICODE_EMOJI_VERSION']` => 14.0 * the header line is `# emoji-variation-sequences-14.0.0.txt` So the last `.0` is mismatch. This patch allows additional `.0` in the header line. Please revert this patch when a correct patach is merged. ``` 1) Error: TestEmojiBreaks#test_embedded_emoji: RuntimeError: File Name Mismatch: line: # emoji-variation-sequences-14.0.0.txt, expected filename: emoji-variation-sequences.txt /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:88:in `block (2 levels) in read_data' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:82:in `foreach' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:82:in `block in read_data' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:79:in `each' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:79:in `read_data' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:111:in `all_tests' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:127:in `test_embedded_emoji' 2) Error: TestEmojiBreaks#test_mixed_emoji: RuntimeError: File Name Mismatch: line: # emoji-variation-sequences-14.0.0.txt, expected filename: emoji-variation-sequences.txt /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:88:in `block (2 levels) in read_data' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:82:in `foreach' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:82:in `block in read_data' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:79:in `each' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:79:in `read_data' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:111:in `all_tests' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:139:in `test_mixed_emoji' 3) Error: TestEmojiBreaks#test_single_emoji: RuntimeError: File Name Mismatch: line: # emoji-variation-sequences-14.0.0.txt, expected filename: emoji-variation-sequences.txt /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:88:in `block (2 levels) in read_data' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:82:in `foreach' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:82:in `block in read_data' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:79:in `each' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:79:in `read_data' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:111:in `all_tests' /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:117:in `test_single_emoji' ```
2022-03-16Fix version check to use Emoji version for emoji-variation-sequences.txtMartin Dürst
2022-03-14Fix failuresKazuhiro NISHIYAMA
http://ci.rvm.jp/results/trunk-no-mjit@phosphorus-docker/3870646 ``` 1) Error: TestEmojiBreaks#test_single_emoji: RuntimeError: File Name Mismatch: line: # emoji-variation-sequences-14.0.0.txt, expected filename: emoji-variation-sequences.txt /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:84:in `block (2 levels) in read_data' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:82:in `foreach' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:82:in `block in read_data' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:79:in `each' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:79:in `read_data' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:105:in `all_tests' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:111:in `test_single_emoji' 2) Error: TestEmojiBreaks#test_mixed_emoji: RuntimeError: File Name Mismatch: line: # emoji-variation-sequences-14.0.0.txt, expected filename: emoji-variation-sequences.txt /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:84:in `block (2 levels) in read_data' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:82:in `foreach' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:82:in `block in read_data' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:79:in `each' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:79:in `read_data' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:105:in `all_tests' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:133:in `test_mixed_emoji' 3) Error: TestEmojiBreaks#test_embedded_emoji: RuntimeError: File Name Mismatch: line: # emoji-variation-sequences-14.0.0.txt, expected filename: emoji-variation-sequences.txt /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:84:in `block (2 levels) in read_data' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:82:in `foreach' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:82:in `block in read_data' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:79:in `each' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:79:in `read_data' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:105:in `all_tests' /tmp/ruby/v3/src/trunk-no-mjit/test/ruby/enc/test_emoji_breaks.rb:121:in `test_embedded_emoji' make: *** [uncommon.mk:823: yes-test-all] Error 3 ```
2022-03-13add some tests for Unicode Version 14.0.0Martin Dürst
2022-03-11Add test for protected methods on module includedJohn Hawthorn
Notes: Merged: https://github.com/ruby/ruby/pull/5642
2022-03-10Fix visibility of alias of zsuper methodsJeremy Evans
This was broken by 71c746379d5872e250d90ae45c585760afaf9516. Fixes [Bug #18600] Notes: Merged: https://github.com/ruby/ruby/pull/5592
2022-03-01Fix race in TestThread#test_thread_status_in_trapBenoit Daloze
* If the sleep is not enough to run the rest of the logic the process would be exited early, e.g., before the signal handler can run.
2022-02-22Add a test for Exception#detailed_messageYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/5516
2022-02-22test/ruby/test_rubyoptions.rb: Make it pass on WindowsYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/5516
2022-02-22Do not escape error messageYusuke Endoh
[Feature #18367] Notes: Merged: https://github.com/ruby/ruby/pull/5516
2022-02-19Add String#byteindex, String#byterindex, and MatchData#byteoffset (#5518)Shugo Maeda
* Add String#byteindex, String#byterindex, and MatchData#byteoffset [Feature #13110] Co-authored-by: NARUSE, Yui <naruse@airemix.jp> Notes: Merged-By: shugo <shugo@ruby-lang.org>
2022-02-19Find pattern is no longer experimental [Feature #18585]Kazuki Tsujimoto
2022-02-17Add Thread.each_caller_locationJeremy Evans
This method takes a block and yields Thread::Backtrace::Location objects to the block. It does not take arguments, and always starts at the default frame that caller_locations would start at. Implements [Feature #16663] Notes: Merged: https://github.com/ruby/ruby/pull/5445
2022-02-12test/ruby/test_exception.rb: prevent "assigned but unused variable"Yusuke Endoh
2022-02-09Fix Range#include? for beginless exclusive string rangesJeremy Evans
Previously, include? would return true for the end of the range, when it should return false because the range is exclusive. Research and Analysis by Victor Shepelev. Fixes [Bug #18577] Notes: Merged: https://github.com/ruby/ruby/pull/5541
2022-02-10st.c: Do not clear entries_bound when calling Hash#shift for empty hashYusuke Endoh
tab->entries_bound is used to check if the bins are full in rebuild_table_if_necessary. Hash#shift against an empty hash assigned 0 to tab->entries_bound, but didn't clear the bins. Thus, the table is not rebuilt even when the bins are full. Attempting to add a new element into full-bin hash gets stuck. This change stops clearing tab->entries_bound in Hash#shift. [Bug #18578] Notes: Merged: https://github.com/ruby/ruby/pull/5539
2022-02-05Fix TAG_THROW through require [Bug #18562]John Hawthorn
Previously this was being incorrectly swapped with TAG_RAISE in the next line. This would end up checking the T_IMEMO throw_data to the exception handling (which calls Module#===). This happened to not break existing tests because Module#=== returned false when klass is NULL. This commit handles throw from require correctly by jumping to the tag retaining the TAG_THROW state. Notes: Merged: https://github.com/ruby/ruby/pull/5513
2022-02-03Move total_freed_pages to size poolPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/5523
2022-02-03Move total_allocated_pages to size poolPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/5523
2022-02-02Decouple GC slot sizes from RVALUEPeter Zhu
Add a new macro BASE_SLOT_SIZE that determines the slot size. For Variable Width Allocation (compiled with USE_RVARGC=1), all slot sizes are powers-of-2 multiples of BASE_SLOT_SIZE. For USE_RVARGC=0, BASE_SLOT_SIZE is set to sizeof(RVALUE). Notes: Merged: https://github.com/ruby/ruby/pull/5517
2022-01-31pend some tests while using to_binaryKoichi Sasada
ISeqs from ISeq#to_binary/load do not support `keep_script_lines` now so some tests should be pending tests with `RUBY_ISEQ_DUMP_DEBUG=to_binary` Notes: Merged: https://github.com/ruby/ruby/pull/5508
2022-01-29Ignore warnings at reading debug info for nowNobuyoshi Nakada
Something seems changed on FreeBSD 13.
2022-01-27Fix memory leak at the same named alias [Bug #18516]Nobuyoshi Nakada
When aliasing a method to the same name method, set a separate bit flag on that method definition, instead of the reference count increment. Although this kind of alias has no actual effect at runtime, is used as the hack to suppress the method re-definition warning. Notes: Merged: https://github.com/ruby/ruby/pull/5493
2022-01-27An alias can suppress method redefinition warningNobuyoshi Nakada
2022-01-24[wasm] Disallow compactionPeter Zhu
WebAssembly doesn't support signals so we can't use read barriers so we can't use compaction. Notes: Merged: https://github.com/ruby/ruby/pull/5475
2022-01-19Do not create core file if it is intentional abortKoichi Sasada
Two tests abort intentionally and they create core files if possible. In these case, we don't need to see core files so disable by `"Process.setrlimit(Process::RLIMIT_CORE, 0)` for those cases. Notes: Merged: https://github.com/ruby/ruby/pull/5466
2022-01-19`rb_fiber_terminate` must not return [Bug #18497]Nobuyoshi Nakada
In a forked process from a fiber, the fiber becomes the only fiber, `fiber_switch` does nothing as there is no other fibers, `rb_fiber_terminate` does not terminate the fiber. In that case, reaches the end of `fiber_entry` finaly, which is declared as "COROUTINE" and should never return. Notes: Merged: https://github.com/ruby/ruby/pull/5468
2022-01-19Assuming EXIT_SUCCESS equals 0 is not portableNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5468
2022-01-19test/ruby/test_assignment.rb: Prevent a warningYusuke Endoh
``` /home/chkbuild/chkbuild/tmp/build/20220119T003004Z/ruby/test/ruby/test_assignment.rb:727: warning: assigned but unused variable - m ``` http://rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20220119T003004Z.log.html.gz
2022-01-17Fix the placeholder subclass entry skipping [Bug #18489]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5455
2022-01-16Weakmap failure is still pendingNobuyoshi Nakada
2022-01-16Remove outdated skipsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5453
2022-01-16Use pend for old TODOsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5453
2022-01-14Fix {Method,UnboundMethod}#{public?,private?,protected?} for ZSUPER methodsJeremy Evans
Add a visibility member to struct METHOD storing the original method visibility, and use that, instead of taking the visibility from the stored method entry (which may have different visibility for ZSUPER methods). Consider Method/UnboundMethod objects different if they have different visibilities. Fixes [Bug #18435] Notes: Merged: https://github.com/ruby/ruby/pull/5356
2022-01-14Make Hash#shift return nil for empty hashJeremy Evans
Fixes [Bug #16908] Notes: Merged: https://github.com/ruby/ruby/pull/5360