summaryrefslogtreecommitdiff
path: root/spec/ruby
AgeCommit message (Collapse)Author
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 <byroot@ruby-lang.org>
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
2024-05-01Skip Warning.[] spec if mspec is passing warning optionsKevin Newton
2024-04-18chore: remove repetitive words (#10573)careworry
Signed-off-by: careworry <worrycare@outlook.com>
2024-04-18Add a hint of `ASCII-8BIT` being `BINARY`Jean Boussier
[Feature #18576] Since outright renaming `ASCII-8BIT` is deemed to backward incompatible, the next best thing would be to only change its `#inspect`, particularly in exception messages.
2024-04-17`Fiber#raise` recursively raises on nested resuming_fiber. (#10482)Samuel Williams
* Improve consistency of `Fiber.current.raise`.
2024-04-17Revert an accidentally merged change [ci skip]Nobuyoshi Nakada
2024-04-17[Feature #20335] `Thread.each_caller_location` argumentsNobuyoshi Nakada
Accecpt the same arguments as `caller` and `caller_locations`.
2024-04-11prism_compile.c: X_STRING should be frozenJean Boussier
The backtick method recieves a frozen string unless it is interpolated. Otherwise the string held in the ISeq could be mutated by a custom backtick method.
2024-04-10[Misc #18984] Raise TypeError from Range#size if the range is not iterableKouhei Yanagita
2024-04-03Reset `$.` before matchingNobuyoshi Nakada
This is a global variable and may happen to be set to 4 elsewhere. http://ci.rvm.jp/logfiles/brlog.trunk.20240403-054356#L1707 ``` The if expression with a boolean range ('flip-flop' operator) warns when Integer literals are used instead of predicates FAILED Expected [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] == [] to be truthy but was false ```
2024-04-02Update to ruby/spec@573cf97Andrew Konchin
2024-03-28Suppress warning at literal stringNobuyoshi Nakada
2024-03-27[DOC] remove repetitive words in commentscrazeteam
Signed-off-by: crazeteam <lilujing@outlook.com>
2024-03-22[Feature #20275] Remove extra backtrace entries for rescue and ensureBenoit Daloze
2024-03-20[PRISM] Enable specs in CIKevin Newton
2024-03-19Implement chilled stringsÉtienne Barrié
[Feature #20205] As a path toward enabling frozen string literals by default in the future, this commit introduce "chilled strings". From a user perspective chilled strings pretend to be frozen, but on the first attempt to mutate them, they lose their frozen status and emit a warning rather than to raise a `FrozenError`. Implementation wise, `rb_compile_option_struct.frozen_string_literal` is no longer a boolean but a tri-state of `enabled/disabled/unset`. When code is compiled with frozen string literals neither explictly enabled or disabled, string literals are compiled with a new `putchilledstring` instruction. This instruction is identical to `putstring` except it marks the String with the `STR_CHILLED (FL_USER3)` and `FL_FREEZE` flags. Chilled strings have the `FL_FREEZE` flag as to minimize the need to check for chilled strings across the codebase, and to improve compatibility with C extensions. Notes: - `String#freeze`: clears the chilled flag. - `String#-@`: acts as if the string was mutable. - `String#+@`: acts as if the string was mutable. - `String#clone`: copies the chilled flag. Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
2024-03-18Update set_backtrace documentationJean Boussier
Followup: https://github.com/ruby/ruby/pull/10017 [Feature #13557]
2024-03-16Prefer the simple read/write `File` singleton methodsNobuyoshi Nakada
2024-03-14Update to ruby/spec@89175b2Benoit Daloze
2024-03-14[Feature #20265] Remove rb_newobj_of and RB_NEWOBJ_OFPeter Zhu
2024-03-14`Exception#set_backtrace` accept arrays of `Backtrace::Location`Jean Boussier
[Feature #13557] Setting the backtrace with an array of strings is lossy. The resulting exception will return nil on `#backtrace_locations`. By accepting an array of `Backtrace::Location` instance, we can rebuild a `Backtrace` instance and have a fully functioning Exception. Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com>