summaryrefslogtreecommitdiff
path: root/spec/ruby/library
AgeCommit message (Collapse)Author
8 daysAvoid flaky test failures by retrying on local port conflicts (#15818)Misaki Shioi
This test obtains an available port number by calling `TCPServer.new`, then closes it and passes the same port number as `local_port` to `TCPSocket.new`. However, `TCPSocket.new` could occasionally fail with `Errno::EADDRINUSE` at the bind(2) step. I believe this happens when tests are run in parallel and another process on the same host happens to bind the same port in the short window between closing the `TCPServer` and calling `TCPSocket.new`. To address this race condition, the test now retries with a newly selected available port when such a conflict occurs.
11 daysUNIXSocket#recvfrom only returns the path on LinuxBenoit Daloze
* Notably it does not on BSD, macOS and Windows.
12 daysRemove assertion which does not holdBenoit Daloze
* https://github.com/ruby/ruby/actions/runs/20694508956/job/59407571754 1) UNIXSocket.pair emulates unnamed sockets with a temporary file with a path FAILED Expected "C:\\a\\_temp\\102424668889-2384.($)".match? /\\AppData\\Local\\Temp\\\d+-\d+\.\(\$\)\z/ to be truthy but was false
12 daysGet better error if UNIXSocket.socketpair spec failsBenoit Daloze
12 daysUpdate to ruby/spec@94dbd55Benoit Daloze
12 daysUpdate to ruby/spec@f54296dBenoit Daloze
2025-12-18Update bundled bigdecimal and rbs (#15611)tomoya ishida
* Bundle rbs-3.10.0.pre.1 * Update rbs gem entry with commit hash Updated rbs entry to include commit hash. * Fix rbs entry in bundled_gems * Update rbs gem to version 3.10.0.pre.2 Updated rbs gem version from 3.10.0.pre.1 to 3.10.0.pre.2. * Update bundled bigdecimal to v4.0.1 --------- Co-authored-by: Soutaro Matsumoto <matsumoto@soutaro.com>
2025-11-19Update to ruby/spec@6e62695Benoit Daloze
2025-11-19Update to ruby/spec@2e11d2aCharles Oliver Nutter
2025-11-14[Feature #21275] Bump Unicode version to 17.0.0Mari Imaizumi
2025-11-12erb/new_spec.rb: Fix a missing doTakashi Kokubun
2025-11-12erb/new_spec.rb: Update a version guardTakashi Kokubun
to the released version
2025-11-12erb/new_spec.rb: Fetch private ERB::VERSIONTakashi Kokubun
for erb v4.0.4 or older
2025-11-12Reapply "[ruby/erb] Reapply "Remove safe_level and further positional"Takashi Kokubun
This reverts commit 5b6658a406b5f1c535aed4cb68e8e18a3cbabb81. With a ruby spec fix.
2025-11-06Adjust OpenSSL specs for digest algorithm lookupKazuki Yamaguchi
https://github.com/ruby/openssl/pull/958 changed the common logic for digest algorithm lookup: - If the argument is neither an OpenSSL::Digest instance nor a String, it is now implicitly converted to String with #to_str. This is consistent with algorithm name lookup logic in ruby/openssl for pkeys and ciphers. - If the name is not recognized, OpenSSL::Digest::DigestError is raised instead of RuntimeError. Update the specs accordingly: - Remove specs that expect #to_str not to be called. - Relax regexps matching TypeError messages. - Expect OpenSSL::Digest::DigestError instead of RuntimeError for ruby/openssl 4.0.0 and later.
2025-11-05Use the exception class mentioned in the docNobuyoshi Nakada
Instead of an undocumented constant.
2025-11-04Resurrect tests for StringScanner#rest?Takashi Kokubun
that has not been obsolete. Partially reverting https://github.com/ruby/ruby/pull/15049.
2025-11-05Remove tests for obsolete StringScanner methodsNobuyoshi Nakada
ruby/strscan#168
2025-10-11Update bundled bigdecimal version (#14809)tomoya ishida
* Update bigdecimal spec * Update bundled bigdecimal to 3.3.1
2025-10-09FreeBSD returns EAI_FAIL instead of EAI_FAMILY in getaddrinfo and ↵Benoit Daloze
getnameinfo specs
2025-10-08Update to ruby/spec@3d7e563Benoit Daloze
2025-10-07Update rubyspec as of CVE-2025-27221Nobuyoshi Nakada
2025-06-11Followed up https://github.com/ruby/net-http/commit/002441da1e for ruby/specHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/13580
2025-06-02Update to ruby/spec@4d2fc4dAndrew Konchin
Notes: Merged: https://github.com/ruby/ruby/pull/13495
2025-05-31Bump bundled bigdecimal to 3.2.1 (#13482)tomoya ishida
Notes: Merged-By: tompng <tomoyapenguin@gmail.com>
2025-05-31skip tests for BigDecimal 3.2.0Koichi Sasada
Notes: Merged: https://github.com/ruby/ruby/pull/13445
2025-05-16"binary" is not valid encoding name in EmacsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/13361
2025-05-09Update to ruby/spec@d8bacefAndrew Konchin
Notes: Merged: https://github.com/ruby/ruby/pull/13265
2025-05-09Guard CGI examples with Ruby 3.5 and use cgi/escape for related examplesHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/13275
2025-04-26Implement Set as a core classJeremy Evans
Set has been an autoloaded standard library since Ruby 3.2. The standard library Set is less efficient than it could be, as it uses Hash for storage, which stores unnecessary values for each key. Implementation details: * Core Set uses a modified version of `st_table`, named `set_table`. than `s/st_/set_/`, the main difference is that the stored records do not have values, making them 1/3 smaller. `st_table_entry` stores `hash`, `key`, and `record` (value), while `set_table_entry` only stores `hash` and `key`. This results in large sets using ~33% less memory compared to stdlib Set. For small sets, core Set uses 12% more memory (160 byte object slot and 64 malloc bytes, while stdlib set uses 40 for Set and 160 for Hash). More memory is used because the set_table is embedded and 72 bytes in the object slot are currently wasted. Hopefully we can make this more efficient and have it stored in an 80 byte object slot in the future. * All methods are implemented as cfuncs, except the pretty_print methods, which were moved to `lib/pp.rb` (which is where the pretty_print methods for other core classes are defined). As is typical for core classes, internal calls call C functions and not Ruby methods. For example, to check if something is a Set, `rb_obj_is_kind_of` is used, instead of calling `is_a?(Set)` on the related object. * Almost all methods use the same algorithm that the pure-Ruby implementation used. The exception is when calling `Set#divide` with a block with 2-arity. The pure-Ruby method used tsort to implement this. I developed an algorithm that only allocates a single intermediate hash and does not need tsort. * The `flatten_merge` protected method is no longer necessary, so it is not implemented (it could be). * Similar to Hash/Array, subclasses of Set are no longer reflected in `inspect` output. * RDoc from stdlib Set was moved to core Set, with minor updates. This includes a comprehensive benchmark suite for all public Set methods. As you would expect, the native version is faster in the vast majority of cases, and multiple times faster in many cases. There are a few cases where it is significantly slower: * Set.new with no arguments (~1.6x) * Set#compare_by_identity for small sets (~1.3x) * Set#clone for small sets (~1.5x) * Set#dup for small sets (~1.7x) These are slower as Set does not currently use the AR table optimization that Hash does, so a new set_table is initialized for each call. I'm not sure it's worth the complexity to have an AR table-like optimization for small sets (for hashes it makes sense, as small hashes are used everywhere in Ruby). The rbs and repl_type_completor bundled gems will need updates to support core Set. The pull request marks them as allowed failures. This passes all set tests with no changes. The following specs needed modification: * Modifying frozen set error message (changed for the better) * `Set#divide` when passed a 2-arity block no longer yields the same object as both the first and second argument (this seems like an issue with the previous implementation). * Set-like objects that override `is_a?` such that `is_a?(Set)` return `true` are no longer treated as Set instances. * `Set.allocate.hash` is no longer the same as `nil.hash` * `Set#join` no longer calls `Set#to_a` (it calls the underlying C function). * `Set#flatten_merge` protected method is not implemented. Previously, `set.rb` added a `SortedSet` autoload, which loads `set/sorted_set.rb`. This replaces the `Set` autoload in `prelude.rb` with a `SortedSet` autoload, but I recommend removing it and `set/sorted_set.rb`. This moves `test/set/test_set.rb` to `test/ruby/test_set.rb`, reflecting that switch to a core class. This does not move the spec files, as I'm not sure how they should be handled. Internally, this uses the st_* types and functions as much as possible, and only adds set_* types and functions as needed. The underlying set_table implementation is stored in st.c, but there is no public C-API for it, nor is there one planned, in order to keep the ability to change the internals going forward. For internal uses of st_table with Qtrue values, those can probably be replaced with set_table. To do that, include internal/set_table.h. To handle symbol visibility (rb_ prefix), internal/set_table.h uses the same macro approach that include/ruby/st.h uses. The Set class (rb_cSet) and all methods are defined in set.c. There isn't currently a C-API for the Set class, though C-API functions can be added as needed going forward. Implements [Feature #21216] Co-authored-by: Jean Boussier <jean.boussier@gmail.com> Co-authored-by: Oliver Nutter <mrnoname1000@riseup.net>
2025-04-25update allocation location testsAaron Patterson
2025-04-18[Feature #20724] Bump Unicode version to 16.0.0Mari Imaizumi
Notes: Merged: https://github.com/ruby/ruby/pull/13117
2025-04-02Removed Solaris conditions from library directoryHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/13037
2025-03-27Update to ruby/spec@5e579e2Andrew Konchin
Notes: Merged: https://github.com/ruby/ruby/pull/12984
2025-03-18[Feature #19908] Update Unicode headers to 15.1.0Mari Imaizumi
Notes: Merged: https://github.com/ruby/ruby/pull/12798
2025-02-07Retry on IO::EAGAINWaitReadable when a closed socket is still not available ↵Andrew Konchin
for reading Notes: Merged: https://github.com/ruby/ruby/pull/12710
2025-01-31Prefer `platform_is_not :windows`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/12682
2025-01-30Update to ruby/spec@affef93Andrew Konchin
Notes: Merged: https://github.com/ruby/ruby/pull/12679
2025-01-30Handle environment where GEM_HOME is not availableHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12675
2025-01-30bin_path_spec.rb relied to available Ruby environment with after `make install`Hiroshi SHIBATA
But we stub-out GEM_HOME variable for test-bundled-gems and others on ruby/ruby. It means the installation path mismatched with GEM_HOME variable always. We can't test this example collectly. ``` 1) Gem.bin_path finds executables of default gems, which are the only files shipped for default gems FAILED Expected File.exist? "/Users/hsbt/Documents/github.com/ruby/ruby/.bundle/gems/bundler-2.7.0.dev/exe/bundle" to be truthy but was false ```
2025-01-29Add fallback for `hostname` if `uname` isn't available. (#12655)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-01-28Prefer `uname -n` over `hostname`. (#12647)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-01-24Restructured irb related example at spec/rubyHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12624
2025-01-08Skip examples related with OpenStruct in ruby/specHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12531
2025-01-08Reapply "Suppress WIN32OLE deprecation warnings for the time being"Nobuyoshi Nakada
Revert the part of commit 10917c5cc026f839a3dcd072b6e274eed211d0f7, "Update to ruby/spec@18032a7", that discarded the previous commit.
2025-01-07Update to ruby/spec@18032a7Andrew Konchin
Notes: Merged: https://github.com/ruby/ruby/pull/12517
2024-12-31Fix leak in Socket#connect specBenoit Daloze
* Found by https://github.com/ruby/ruby/actions/runs/12560692556/job/35018412527?pr=12492 Notes: Merged: https://github.com/ruby/ruby/pull/12492
2024-12-28BigDecimal('0.') with bigdecimal-3.1.9 returns 0.0Hiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12480
2024-12-28Abandon connection test if off lineNobuyoshi Nakada
2024-12-22Suppress WIN32OLE deprecation warnings for the time beingNobuyoshi Nakada