summaryrefslogtreecommitdiff
path: root/spec/ruby
AgeCommit message (Collapse)Author
2024-11-04YJIT: Replace Array#each only when YJIT is enabled (#11955)Takashi Kokubun
* YJIT: Replace Array#each only when YJIT is enabled * Add comments about BUILTIN_ATTR_C_TRACE * Make Ruby Array#each available with --yjit as well * Fix all paths that expect a C location * Use method_basic_definition_p to detect patches * Copy a comment about C_TRACE flag to compilers * Rephrase a comment about add_yjit_hook * Give METHOD_ENTRY_BASIC flag to Array#each * Add --yjit-c-builtin option * Allow inconsistent source_location in test-spec * Refactor a check of BUILTIN_ATTR_C_TRACE * Set METHOD_ENTRY_BASIC without touching vm->running Notes: Merged-By: maximecb <[email protected]>
2024-10-23Harden the ObjectSpace.memsize_of specJean Boussier
[Bug #20803] `abc` is used a lot across the ruby spec suite, if another test runs before this spec is loaded and create this symbol dynamically (`"abc".to_sym`) the spec will fail. So it's preferable to use a symbol name that is very unlikely to be used elsewhere to avoid flakes. Notes: Merged: https://github.com/ruby/ruby/pull/11942
2024-10-21Show where mutated chilled strings were allocatedÉtienne Barrié
[Feature #20205] The warning now suggests running with --debug-frozen-string-literal: ``` test.rb:3: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information) ``` When using --debug-frozen-string-literal, the location where the string was created is shown: ``` test.rb:3: warning: literal string will be frozen in the future test.rb:1: info: the string was created here ``` When resurrecting strings and debug mode is not enabled, the overhead is a simple FL_TEST_RAW. When mutating chilled strings and deprecation warnings are not enabled, the overhead is a simple warning category enabled check. Co-authored-by: Jean Boussier <[email protected]> Co-authored-by: Nobuyoshi Nakada <[email protected]> Co-authored-by: Jean Boussier <[email protected]> Notes: Merged: https://github.com/ruby/ruby/pull/11893
2024-10-15[Bug #20797] Yet another testNobuyoshi Nakada
2024-10-14[Bug #20797] Check seconds in UTC offset as well as minutesNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11892
2024-10-12Support `IO#timeout` for `rsock_connect`. (#11880)Samuel Williams
Notes: Merged-By: ioquatix <[email protected]>
2024-10-05[Bug #20705] Update `strtod` implementationNobuyoshi Nakada
The absence of either the integer or fractional part should be allowed. Notes: Merged: https://github.com/ruby/ruby/pull/11807
2024-10-04Update `io_spec.c` to use `rb_io_maybe_wait*` if possible. (#11792)Samuel Williams
Notes: Merged-By: ioquatix <[email protected]>
2024-10-04Better handling of timeout in `rb_io_maybe_wait_*`. (#9531)Samuel Williams
Notes: Merged-By: ioquatix <[email protected]>
2024-10-03Update spec/ruby/ for colon-style hash inspecttompng
Notes: Merged: https://github.com/ruby/ruby/pull/10924
2024-10-01Define RactorLocalSingleton on .mspec.constantsHiroshi SHIBATA
2024-10-01Temporary disabled RactorLocalSingleton from constant leak check.Hiroshi SHIBATA
2024-09-23Add anonymous module name spec.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/7968
2024-09-18Update exception message in string_for_symbolJeremy Evans
This is a static function only called in two places (rb_to_id and rb_to_symbol), and in both places, both symbols and strings are allowed. This makes the error message consistent with rb_check_id and rb_check_symbol. Fixes [Bug #20607] Notes: Merged: https://github.com/ruby/ruby/pull/11097
2024-09-17Skip failing examples related with ↵Hiroshi SHIBATA
https://github.com/ruby/ruby/commit/d81b0588bb3c97167d1f7e2d2a74185e0c19b68c
2024-09-09Implement String#append_as_bytes(String | Integer, ...)Jean Boussier
[Feature #20594] A handy method to construct a string out of multiple chunks. Contrary to `String#concat`, it doesn't do any encoding negociation, and simply append the content as bytes regardless of whether this result in a broken string or not. It's the caller responsibility to check for `String#valid_encoding?` in cases where it's needed. When passed integers, only the lower byte is considered, like in `String#setbyte`. Notes: Merged: https://github.com/ruby/ruby/pull/11552
2024-09-06Implement Array#fetch_valuesJean Boussier
[Feature #20702] Works the same way than `Hash#fetch_values` for for array. Notes: Merged: https://github.com/ruby/ruby/pull/11557
2024-09-05Move Time#xmlschema in core and optimize itJean Boussier
[Feature #20707] Converting Time into RFC3339 / ISO8601 representation is an significant hotspot for applications that serialize data in JSON, XML or other formats. By moving it into core we can optimize it much further than what `strftime` will allow. ``` compare-ruby: ruby 3.4.0dev (2024-08-29T13:11:40Z master 6b08a50a62) +YJIT [arm64-darwin23] built-ruby: ruby 3.4.0dev (2024-08-30T13:17:32Z native-xmlschema 34041ff71f) +YJIT [arm64-darwin23] warming up...... | |compare-ruby|built-ruby| |:-----------------------|-----------:|---------:| |time.xmlschema | 1.087M| 5.190M| | | -| 4.78x| |utc_time.xmlschema | 1.464M| 6.848M| | | -| 4.68x| |time.xmlschema(6) | 859.960k| 4.646M| | | -| 5.40x| |utc_time.xmlschema(6) | 1.080M| 5.917M| | | -| 5.48x| |time.xmlschema(9) | 893.909k| 4.668M| | | -| 5.22x| |utc_time.xmlschema(9) | 1.056M| 5.707M| | | -| 5.40x| ``` Notes: Merged: https://github.com/ruby/ruby/pull/11510
2024-09-03Range#step: restore legacy behavior for String rangeszverok
Notes: Merged: https://github.com/ruby/ruby/pull/11454
2024-08-18Make Range#step to consistently use + for iteration (#7444)Victor Shepelev
Make Range#step to consistently use + for iteration [Feature #18368] Previously, non-numerics expected step to be integer, and iterated with begin#succ, skipping over step value steps. Since this commit, numeric and non-numeric iteration behaves the same way, by using + operator. Notes: Merged-By: zverok <[email protected]>
2024-07-24Make Integer#round spec work regardless of pointer sizeAlan Wu
The spec is actually testing a behaviour stemming from NUM2INT(), and since `sizeof(long)>=sizeof(int)`, `min_long-1` always makes NUM2INT() raise `RangeError`. Notes: Merged: https://github.com/ruby/ruby/pull/11130
2024-07-24Stop depending on Integer#size to return `sizeof(long)`Alan Wu
There is no guarantee that Integer#size will continue to return `sizeof(long)` for small integers. Use the `l!` specifier for Array#pack instead. It is a public interface that has a direct relationship with the `long` type. Notes: Merged: https://github.com/ruby/ruby/pull/11130
2024-07-24Add "c_long_size" guard, supplanting "wordsize" and stop using Integer#sizeAlan Wu
What a "word" is when talking about sizes is confusing because it's a highly overloaded term. Intel, Microsoft, and GDB are just a few vendors that have their own definition of what a "word" is. Specs that used the "wordsize" guard actually were mostly testing for the size of the C `long` fundamental type, so rename the guard for clarity. Also, get the size of `long` directly from RbConfig instead of guessing using Integer#size. Integer#size is not guaranteed to have anything to do with the `long` type. Notes: Merged: https://github.com/ruby/ruby/pull/11130
2024-07-18Split URI::Parser examples with RFC2396 and RFC3986Hiroshi SHIBATA
Prepare for https://github.com/ruby/uri/pull/107
2024-07-17Revert pending `EVENT_RETURN` testsNobuyoshi Nakada
* "Allow ambiguosity of `return` line" 65b991bc8571b7b718fc22bd33a43c4d269bf52d * "Move to test/.excludes-prism" 3b4ff810d2fefdf0194bd774bc04f6f17e2ccae7 * "Pending `EVENT_RETURN` settracefunc tests with Prism" a7f33c99c69e3cc62b7a24ce35f51f76cc5bfaa2 Notes: Merged: https://github.com/ruby/ruby/pull/11163
2024-07-12Pend some tests because these are not working with macOS 15 beta and Xcode ↵Hiroshi SHIBATA
16 beta
2024-07-11Do not warn about extra `format` argument when passed as keywordsJean Boussier
[Bug #20593] It's fairly common to use `format` to interpolate a number of values into a user provided strings. The arguments not matching are a problem when they are positional, but when they are named, it's absolutely fine and we shouldn't emit a warning.
2024-07-08Implement Hash.new(capacity:)Jean Boussier
[Feature #19236] When building a large hash, pre-allocating it with enough capacity can save many re-hashes and significantly improve performance. ``` /opt/rubies/3.3.0/bin/ruby --disable=gems -rrubygems -I./benchmark/lib ./benchmark/benchmark-driver/exe/benchmark-driver \ --executables="compare-ruby::../miniruby-master -I.ext/common --disable-gem" \ --executables="built-ruby::./miniruby --disable-gem" \ --output=markdown --output-compare -v $(find ./benchmark -maxdepth 1 -name 'hash_new' -o -name '*hash_new*.yml' -o -name '*hash_new*.rb' | sort) compare-ruby: ruby 3.4.0dev (2024-03-25T11:48:11Z master f53209f023) +YJIT dev [arm64-darwin23] last_commit=[ruby/irb] Cache RDoc::RI::Driver.new (https://github.com/ruby/irb/pull/911) built-ruby: ruby 3.4.0dev (2024-03-25T15:29:40Z hash-new-rb 77652b08a2) +YJIT dev [arm64-darwin23] warming up... | |compare-ruby|built-ruby| |:-------------------|-----------:|---------:| |new | 7.614M| 5.976M| | | 1.27x| -| |new_with_capa_1k | 13.931k| 15.698k| | | -| 1.13x| |new_with_capa_100k | 124.746| 148.283| | | -| 1.19x| ```
2024-07-06Raise a TypeError for Thread#thread_variable{?,_get} for non-symbolJeremy Evans
Previously, a TypeError was not raised if there were no thread variables, because the conversion to symbol was done after that check. Convert to symbol before checking for whether thread variables are set to make the behavior consistent. Fixes [Bug #20606]
2024-07-02Update to ruby/spec@f8987acAndrew Konchin
2024-06-25Allow ambiguosity of `return` lineNobuyoshi Nakada
2024-06-25[Bug #20457] Do not remove final `return` nodeNobuyoshi Nakada
This was an optimization for versions prior to 1.9 that traverse the AST at runtime.
2024-06-20Skip 3 specs when $HOME is not a valid directoryJeremy Evans
If $HOME isn't a valid directory, these specs fail, but I think it is better to skip in this case, as it does not indicate a bug. This fixes specs when run in the OpenBSD port, which sets $HOME to an invalid directory to ensure that software's build system is not accidentally relying on it.
2024-06-18net-ftp-0.3.6 always return response with put/puttextfile.Hiroshi SHIBATA
* https://github.com/ruby/net-ftp/pull/34 * https://github.com/ruby/net-ftp/issues/36
2024-06-12Kernel#warn: don't call `Warning.warn` unless the category is enabledJean Boussier
[Bug #20573] Followup: https://github.com/ruby/ruby/pull/10960 I believe `Kernel#warn` should behave in the same way than internal `rb_warning_* APIs
2024-06-12'SPEC_TEMP_DIR` should not be world-writableKoichi Sasada
`SPEC_TEMP_DIR` is not present until `tmp()` method is called on parallel run. In this case `tmp()` is called with `File.umask = 0`. This patch makes `SPEC_TEMP_DIR` before `File.umask = 0`. To solve the issue essentially, I think `SPEC_TEMP_DIR` should be prepared at the beginning of parallel process.
2024-06-10Fix CI when YJIT is enabledAndrew Konchin
2024-06-10Update to ruby/spec@517f06fAndrew Konchin
2024-06-10Check current file on TracePointKoichi Sasada
``` 1) TracePoint#inspect returns a String showing the event, method, path and line for a :call event FAILED Expected "#<TracePoint:call 'call' /tmp/ruby/src/trunk/spec/ruby/core/objectspace/define_finalizer_spec.rb:33>" =~ /\A#<TracePoint:call [`']trace_point_spec_test_call' \/tmp\/ruby\/src\/trunk\/spec\/ruby\/core\/tracepoint\/inspect_spec.rb:43>\z/ to be truthy but was nil ``` This kind of failures comes because of finaizers. So check the current file or not.
2024-06-07Balance block braces with `#if`Nobuyoshi Nakada
2024-06-07Enclose in ruby_version_is blocksNobuyoshi Nakada
2024-06-07Remove the old untyped Data API in spec/rubyNobuyoshi Nakada
2024-06-06Remove circular parameter syntax errorKevin Newton
https://bugs.ruby-lang.org/issues/20478
2024-05-29[Bug #20438] Disallow "%\n" and "%\0"Nobuyoshi Nakada
2024-05-28Stop marking chilled strings as frozenÉtienne Barrié
They were initially made frozen to avoid false positives for cases such as: str = str.dup if str.frozen? But this may cause bugs and is generally confusing for users. [Feature #20205] Co-authored-by: Jean Boussier <[email protected]>
2024-05-24Update duplicated when clause warning messageKevin Newton
2024-05-19Update to ruby/spec@6b04c1dAndrew Konchin
2024-05-09Add a ruby_bug spec for String#index clearing $~Jean Boussier
[Bug #20421] The bug was fixed in Ruby 3.3 via 9dcdffb8bf8a3654fd78bf1a58b30c8e13888a7a
2024-05-02Reject empty lines in IRB binding specStan Lo
For that particular spec, the empty lines' presence is not relevant. So let's remove them to make the spec easier to maintain.
2024-05-02Declare as NORETURNNobuyoshi Nakada