summaryrefslogtreecommitdiff
path: root/spec/ruby/core
AgeCommit message (Collapse)Author
2025-05-22Skip failing tests with mingw platformHiroshi SHIBATA
https://github.com/ruby/ruby/actions/runs/15159221855/job/42621232822?pr=13397 ``` 1) File.atime returns the last access time for the named file with microseconds FAILED Expected 0 == 123456 to be truthy but was false D:/a/ruby/ruby/src/spec/ruby/core/file/atime_spec.rb:26:in `block (3 levels) in <top (required)>' D:/a/ruby/ruby/src/spec/ruby/core/file/atime_spec.rb:3:in `<top (required)>' 2) File.ctime returns the change time for the named file (the time at which directory information about the file was changed, not the file itself) with microseconds. FAILED Expected 0 > 0 to be truthy but was false D:/a/ruby/ruby/src/spec/ruby/core/file/ctime_spec.rb:21:in `block (3 levels) in <top (required)>' D:/a/ruby/ruby/src/spec/ruby/core/file/ctime_spec.rb:3:in `<top (required)>' 3) File.utime sets the access and modification time of each file FAILED Expected 2025-05-21 10:30:54 +0000 to be within 2025-05-21 10:30:54 +0000 +/- 0.0001 D:/a/ruby/ruby/src/spec/ruby/core/file/utime_spec.rb:25:in `block (2 levels) in <top (required)>' D:/a/ruby/ruby/src/spec/ruby/core/file/utime_spec.rb:3:in `<top (required)>' 4) File.mtime returns the modification Time of the file with microseconds FAILED Expected 0 == 123456 to be truthy but was false D:/a/ruby/ruby/src/spec/ruby/core/file/mtime_spec.rb:25:in `block (3 levels) in <top (required)>' D:/a/ruby/ruby/src/spec/ruby/core/file/mtime_spec.rb:3:in `<top (required)>' ``` It may be fixed with https://github.com/ruby/ruby/commit/7aea269b89bd7024bcacb7fe7d4ddb0be2f215af. But Ruby 3.2 is now security maintenance status. We can't backport it.
2024-11-06Partly reverted from 449899b38314d0ecbe61e42d34398bdf2561b8e9Hiroshi SHIBATA
2024-11-06Pend some tests because these are not working with macOS 15 and Xcode 16Hiroshi SHIBATA
2024-05-14Fix `String#index` to clear MatchData when a regexp is passedJean Boussier
[Bug #20421] The bug was fixed in Ruby 3.3 via 9dcdffb8bf8a3654fd78bf1a58b30c8e13888a7a
2023-11-21merge revision(s) 8d1109c03bacc952b6218af2e4ae9b74c9855273:nagachika
Added assertion values for Amazon Linux 2023 --- spec/ruby/core/file/utime_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
2023-09-30merge revision(s) d4c720a91bc7bb9ff31810e1720acffb939f7a2f: [Backport #19845]nagachika
Fix support for dynamic keys. (#8273) * Skip RBS test. --- cont.c | 8 +++----- spec/ruby/core/fiber/storage_spec.rb | 14 ++++++++++++++ tool/rbs_skip_tests | 2 ++ 3 files changed, 19 insertions(+), 5 deletions(-)
2023-07-17merge revision(s) ↵nagachika
1a149aab776aa6741628eb35482eff1ded197fd2,fb17c833f542222afdf482924877d43aa577782d,60f22ebf86248388b41b4ec751d16700f2b4b621: [Backport #19533] Extract range type check functions --- range.c | 55 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 19 deletions(-) [Bug #19533] Fix infinite range inclusion with numeric value --- range.c | 10 +++++++--- test/ruby/test_range.rb | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) [Bug #19533] Add spec of infinite range inclusion --- spec/ruby/core/range/case_compare_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+)
2023-06-25merge revision(s) ec14861f0d7a1e99d3e6667dee2f4c9cc426d5f3:nagachika
Update to ruby/spec@7e680fa --- spec/ruby/core/dir/home_spec.rb | 5 +++-- spec/ruby/core/process/spawn_spec.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
2023-06-24merge revision(s) ↵nagachika
cd5e6cc0ea48353c88d921b885b552dc76da255c,bbf54ec334fe2edd7669a944d88d17efde49a412: [Backport #19307] Update to ruby/mspec@fef9b81 --- spec/mspec/tool/tag_from_output.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Update to ruby/spec@9d69b95 --- spec/ruby/core/array/keep_if_spec.rb | 1 + spec/ruby/core/array/pack/c_spec.rb | 14 +- spec/ruby/core/array/pack/shared/basic.rb | 40 ++++ spec/ruby/core/array/pack/shared/float.rb | 66 ++++++- spec/ruby/core/array/pack/shared/integer.rb | 96 +++++++-- spec/ruby/core/array/pack/shared/numeric_basic.rb | 10 +- spec/ruby/core/array/pack/shared/unicode.rb | 14 +- spec/ruby/core/array/pack/w_spec.rb | 14 +- spec/ruby/core/array/shared/unshift.rb | 18 ++ spec/ruby/core/array/values_at_spec.rb | 1 + spec/ruby/core/array/zip_spec.rb | 6 + spec/ruby/core/class/subclasses_spec.rb | 22 +++ spec/ruby/core/dir/home_spec.rb | 44 +++-- spec/ruby/core/dir/mkdir_spec.rb | 18 +- spec/ruby/core/enumerable/zip_spec.rb | 5 + spec/ruby/core/float/comparison_spec.rb | 35 ++-- spec/ruby/core/float/divmod_spec.rb | 2 +- spec/ruby/core/float/gt_spec.rb | 21 ++ spec/ruby/core/float/gte_spec.rb | 21 ++ spec/ruby/core/float/lt_spec.rb | 21 ++ spec/ruby/core/float/lte_spec.rb | 21 ++ spec/ruby/core/float/shared/equal.rb | 21 ++ spec/ruby/core/io/gets_spec.rb | 4 + spec/ruby/core/io/lineno_spec.rb | 9 +- spec/ruby/core/io/new_spec.rb | 2 + spec/ruby/core/io/readline_spec.rb | 4 + spec/ruby/core/io/readlines_spec.rb | 4 + spec/ruby/core/io/shared/each.rb | 4 + spec/ruby/core/io/shared/new.rb | 2 + spec/ruby/core/io/shared/pos.rb | 8 +- spec/ruby/core/io/shared/readlines.rb | 4 + spec/ruby/core/io/sysseek_spec.rb | 2 +- spec/ruby/core/kernel/shared/load.rb | 31 ++- spec/ruby/core/kernel/singleton_class_spec.rb | 2 + spec/ruby/core/marshal/dump_spec.rb | 45 ++++- spec/ruby/core/marshal/fixtures/classes.rb | 4 + spec/ruby/core/matchdata/values_at_spec.rb | 73 ++++++- spec/ruby/core/module/fixtures/classes.rb | 1 + spec/ruby/core/module/include_spec.rb | 4 +- spec/ruby/core/module/prepend_spec.rb | 12 ++ .../ruby/core/objectspace/define_finalizer_spec.rb | 22 +++ spec/ruby/core/process/constants_spec.rb | 1 + spec/ruby/core/process/detach_spec.rb | 29 +++ spec/ruby/core/process/spawn_spec.rb | 10 + spec/ruby/core/process/times_spec.rb | 2 +- spec/ruby/core/queue/initialize_spec.rb | 13 +- spec/ruby/core/refinement/import_methods_spec.rb | 34 ++++ spec/ruby/core/refinement/include_spec.rb | 27 +++ spec/ruby/core/refinement/prepend_spec.rb | 27 +++ spec/ruby/core/regexp/initialize_spec.rb | 2 +- spec/ruby/core/signal/trap_spec.rb | 12 ++ spec/ruby/core/string/byteslice_spec.rb | 6 + spec/ruby/core/string/capitalize_spec.rb | 4 + spec/ruby/core/string/chars_spec.rb | 7 +- spec/ruby/core/string/chomp_spec.rb | 4 + spec/ruby/core/string/chop_spec.rb | 4 + spec/ruby/core/string/clone_spec.rb | 4 + spec/ruby/core/string/delete_prefix_spec.rb | 4 + spec/ruby/core/string/delete_spec.rb | 4 + spec/ruby/core/string/delete_suffix_spec.rb | 4 + spec/ruby/core/string/downcase_spec.rb | 4 + spec/ruby/core/string/dump_spec.rb | 10 +- spec/ruby/core/string/dup_spec.rb | 4 + spec/ruby/core/string/lines_spec.rb | 1 - spec/ruby/core/string/reverse_spec.rb | 4 + spec/ruby/core/string/scan_spec.rb | 6 + spec/ruby/core/string/scrub_spec.rb | 10 + spec/ruby/core/string/shared/each_line.rb | 6 + spec/ruby/core/string/shared/partition.rb | 15 ++ spec/ruby/core/string/shared/slice.rb | 13 +- spec/ruby/core/string/shared/strip.rb | 4 + spec/ruby/core/string/shared/succ.rb | 4 + spec/ruby/core/string/split_spec.rb | 17 +- spec/ruby/core/string/squeeze_spec.rb | 5 + spec/ruby/core/string/swapcase_spec.rb | 4 + spec/ruby/core/string/undump_spec.rb | 2 +- spec/ruby/core/string/unpack/b_spec.rb | 28 ++- spec/ruby/core/string/unpack/c_spec.rb | 14 +- spec/ruby/core/string/unpack/h_spec.rb | 28 ++- spec/ruby/core/string/unpack/shared/basic.rb | 28 --- spec/ruby/core/string/unpack/shared/float.rb | 60 +++++- spec/ruby/core/string/unpack/shared/integer.rb | 88 +++++++-- spec/ruby/core/string/unpack/shared/unicode.rb | 14 +- spec/ruby/core/string/unpack/w_spec.rb | 14 +- spec/ruby/core/string/unpack1_spec.rb | 12 +- spec/ruby/core/string/unpack_spec.rb | 34 ++++ spec/ruby/core/string/upcase_spec.rb | 4 + spec/ruby/core/string/valid_encoding/utf_8_spec.rb | 214 +++++++++++++++++++++ spec/ruby/core/struct/values_at_spec.rb | 55 +++++- spec/ruby/core/symbol/shared/id2name.rb | 7 + spec/ruby/core/time/at_spec.rb | 16 ++ spec/ruby/core/time/localtime_spec.rb | 16 +- spec/ruby/core/time/new_spec.rb | 94 +++++++-- spec/ruby/core/time/shared/gmtime.rb | 4 +- spec/ruby/core/time/shared/time_params.rb | 11 +- spec/ruby/core/time/strftime_spec.rb | 40 +++- spec/ruby/core/time/utc_spec.rb | 41 +++- spec/ruby/core/time/zone_spec.rb | 20 +- spec/ruby/core/tracepoint/inspect_spec.rb | 9 + spec/ruby/fixtures/code/load_wrap_fixture.rb | 12 ++ spec/ruby/fixtures/code/wrap_fixture.rb | 9 - spec/ruby/language/case_spec.rb | 4 +- .../ruby/language/regexp/character_classes_spec.rb | 5 + spec/ruby/library/coverage/running_spec.rb | 20 ++ spec/ruby/library/date/civil_spec.rb | 7 +- spec/ruby/library/objectspace/fixtures/trace.rb | 5 + spec/ruby/library/objectspace/trace_spec.rb | 15 ++ spec/ruby/library/openssl/x509/name/verify_spec.rb | 4 +- spec/ruby/library/stringio/initialize_spec.rb | 85 ++++++++ spec/ruby/library/stringio/new_spec.rb | 8 + spec/ruby/library/stringio/shared/write.rb | 22 +++ spec/ruby/optional/capi/ext/io_spec.c | 43 +++++ spec/ruby/optional/capi/io_spec.rb | 15 ++ spec/ruby/shared/rational/Rational.rb | 48 ++--- 114 files changed, 1963 insertions(+), 245 deletions(-) create mode 100644 spec/ruby/core/marshal/fixtures/classes.rb create mode 100644 spec/ruby/core/refinement/import_methods_spec.rb create mode 100644 spec/ruby/core/refinement/include_spec.rb create mode 100644 spec/ruby/core/refinement/prepend_spec.rb create mode 100644 spec/ruby/core/string/unpack_spec.rb create mode 100644 spec/ruby/core/string/valid_encoding/utf_8_spec.rb create mode 100644 spec/ruby/fixtures/code/load_wrap_fixture.rb delete mode 100644 spec/ruby/fixtures/code/wrap_fixture.rb create mode 100644 spec/ruby/library/coverage/running_spec.rb create mode 100644 spec/ruby/library/objectspace/fixtures/trace.rb create mode 100644 spec/ruby/library/objectspace/trace_spec.rb create mode 100644 spec/ruby/library/stringio/new_spec.rb
2023-03-08merge revision(s) d2520b7b76759118071a16e6bca22726a5de9fb4: [Backport #19439]NARUSE, Yui
Marshal.load: restore instance variables on Regexp [Bug #19439] The instance variables were restore on the Regexp source, not the regexp itself. Unfortunately we have a bit of a chicken and egg problem. The source holds the encoding, and the encoding need to be set on the source to be able to instantiate the Regexp. So the instance variables have to be read on the `source`. To correct this we transfert the instance variables after instantiating the Regexp. The only way to avoid this would be to read the instance variable twice and rewind. --- marshal.c | 20 ++++++++++++++++++-- spec/ruby/core/marshal/shared/load.rb | 11 +++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-)
2023-03-02merge revision(s) ↵NARUSE, Yui
8ce2fb9bbbaea14737c84385b1573f743a30f773,3a0f6ce1d31eefd8af01b50f3632a64d64e8f8c1: [Backport #19415] Only emit circular dependency warning for owned thread shields [Bug #19415] If multiple threads attemps to load the same file concurrently it's not a circular dependency issue. So we check that the existing ThreadShield is owner by the current fiber before warning about circular dependencies. --- internal/thread.h | 1 + load.c | 3 ++- spec/ruby/core/kernel/shared/require.rb | 11 +++++++++++ spec/ruby/fixtures/code/concurrent_require_fixture.rb | 4 ++++ test/ruby/test_require.rb | 3 --- thread.c | 11 +++++++++++ 6 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 spec/ruby/fixtures/code/concurrent_require_fixture.rb Use Thread.pass until thread.stop? to wait for thread to block [Bug #19415] It should be more reliable --- spec/ruby/fixtures/code/concurrent_require_fixture.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
2022-12-24Windows: Prefer USERPROFILE over HOMEPATHLars Kanis
HOMEPATH is set to "\WINDOWS\system32" when running per "runas" session. This directory is not writable by ordinary users, leading to errors with many ruby tools. Also config files in the home directory are not recognized. Still keeping HOME at first which is not used by native Windows, but by ruby specs and by MSYS2 environment. Notes: Merged: https://github.com/ruby/ruby/pull/6992
2022-12-24Windows: Fix encoding of Dir.homeLars Kanis
Dir.home returns an UTF-8 string since ruby-3.0, but the actual encoding of the bytes was CP_ACP or CP_OEMCP. That led to invalid bytes when calling Dir.home with an unicode username. Notes: Merged: https://github.com/ruby/ruby/pull/6991
2022-12-22Always issue deprecation warning when calling Regexp.new with 3rd positional ↵Jeremy Evans
argument Previously, only certain values of the 3rd argument triggered a deprecation warning. First step for fix for bug #18797. Support for the 3rd argument will be removed after the release of Ruby 3.2. Fix minor fallout discovered by the tests. Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/6976
2022-12-20Ensure Fiber storage is only accessed from the Fiber it belongs toBenoit Daloze
Notes: Merged: https://github.com/ruby/ruby/pull/6972
2022-12-20Never use the storage of another Fiber, that violates the whole designBenoit Daloze
* See https://bugs.ruby-lang.org/issues/19078#note-30 Notes: Merged: https://github.com/ruby/ruby/pull/6972
2022-12-10Add spec for fiber storage. (#6896)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-12-09Clean up a temporary fileNobuyoshi Nakada
2022-12-08Introduce `IO.new(..., path:)` and promote `File#path` to `IO#path`. (#6867)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-12-03Remove unguaranteed assertion [ci skip]Nobuyoshi Nakada
It can be configured by `--with-os-version-style=TYPE` option, and just copies from theApple's installation as the default. We don't know why it is major only.
2022-12-03UnboundMethod only refer defined_classKoichi Sasada
UnboundMethod records caller's class, like `D` or `E` on the following case: ```ruby class C def foo = :foo end class D < C end class E < C end d = D.instance_method(:foo) e = E.instance_method(:foo) ``` But `d` and `e` only refers `C#foo` so that UnboundMethod doesn't record `D` or `E`. This behavior changes the following methods: * `UnboundMethod#inspect` (doesn't show caller's class) * `UnboundMethod#==` (`d == e` for example) fix https://bugs.ruby-lang.org/issues/18798 Notes: Merged: https://github.com/ruby/ruby/pull/6855
2022-12-02[Bug #19087] Merge to "trailing garbage" caseNobuyoshi Nakada
2022-12-02[Bug #19087] Fix an assertion of `String#to_c`Nobuyoshi Nakada
2022-11-24Make String#rstrip{,!} raise Encoding::CompatibilityError for broken coderangeJeremy Evans
It's questionable whether we want to allow rstrip to work for strings where the broken coderange occurs before the trailing whitespace and not after, but this approach is probably simpler, and I don't think users should expect string operations like rstrip to work on broken strings. In some cases, this changes rstrip to raise Encoding::CompatibilityError instead of ArgumentError. However, as the problem is related to an encoding issue in the receiver, and due not due to an issue with an argument, I think Encoding::CompatibilityError is the more appropriate error. Fixes [Bug #18931] Notes: Merged: https://github.com/ruby/ruby/pull/6282
2022-11-08Thread#native_thread_id is very platform specificNobuyoshi Nakada
2022-11-07Update to ruby/spec@740ccc8Benoit Daloze
2022-10-24Skip `File.atime`/`File.mtime` tests randomly failing on TravisNobuyoshi Nakada
Not only powerpc64le, also s390x and arm32 seem failing too. These failures are probably caused by filesystem settings on Travis, but unrelated to CPUs.
2022-10-23[Bug #19004] `Complex.polar` handles complex singular `abs` argumentStephen Ierodiaconou
`Complex.polar` accepts Complex values as arguments for the polar form as long as the value of the complex has no imaginary part (ie it is 'real'). In `f_complex_polar` this is handled by extracting the real part of the arguments. However in the case `polar` is called with only a single argument, the absolute value (abs), then the Complex is created without applying a check on the type of abs, meaning it is possible to create a Complex where the real part is itself an instance of a Complex. This change removes the short circuit for the single argument case meaning the real part extraction is performed correctly (by f_complex_polar). Also adds an example to `spec/ruby/core/complex/polar_spec.rb` to check that the real part of a complex argument is correctly extracted and used in the resulting Complex real and imaginary parts. Notes: Merged: https://github.com/ruby/ruby/pull/6568 Merged-By: nobu <nobu@ruby-lang.org>
2022-10-21Range#size returns nil for (.."a") and (nil..)Yusuke Endoh
Fixes [Bug #18983] Notes: Merged: https://github.com/ruby/ruby/pull/6604
2022-10-20Add Class#attached_objectUfuk Kayserilioglu
Implements [Feature #12084] Returns the object for which the receiver is the singleton class, or raises TypeError if the receiver is not a singleton class. Notes: Merged: https://github.com/ruby/ruby/pull/6450
2022-10-13Skip utime example with Intel C Compiler suiteHiroshi SHIBATA
2022-10-10Ignore excessive precisionsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6522
2022-10-06Introduce `Fiber.blocking{}` for bypassing the fiber scheduler. (#6498)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-09-30Add Data class implementation: Simple immutable value objectVictor Shepelev
Notes: Merged: https://github.com/ruby/ruby/pull/6353 Merged-By: nobu <nobu@ruby-lang.org>
2022-09-29Add specs for {Method,UnboundMethod}#owner of a zsuper methodBenoit Daloze
Notes: Merged: https://github.com/ruby/ruby/pull/6467
2022-09-29Fix {Method,UnboundMethod}#super_method for zsuper methodsBenoit Daloze
* We need to resolve the zsuper method first, and then look the super method of that. Notes: Merged: https://github.com/ruby/ruby/pull/6467
2022-09-28Update to ruby/spec@1d9d5c6Benoit Daloze
2022-09-27Re-enable TZ test missed due to merge conflict.Vít Ondruch
This was disabled by b7577b4d9e, while properly fixed upstream by: https://github.com/ruby/spec/pull/939 Notes: Merged: https://github.com/ruby/ruby/pull/6393
2022-09-24Support using at toplevel in wrapped scriptChris Salzberg
Allow refinements to be used at the toplevel within a script that is loaded under a module. Fixes [Bug #18960] Notes: Merged: https://github.com/ruby/ruby/pull/6226
2022-09-10Deprecate Encoding#replicateBenoit Daloze
* See [Feature #18949].
2022-09-04rb_int_range_last: properly handle non-exclusive rangeJean Boussier
[Bug #18994] Notes: Merged: https://github.com/ruby/ruby/pull/6324
2022-08-29Skip a couple of chroot spec failluresTakashi Kokubun
I don't come up with a way to fix it right away. We'd need some experiments on a pull request.
2022-08-29Update to ruby/spec@b8a8240Benoit Daloze
2022-08-29Update to ruby/spec@d01709fBenoit Daloze
2022-08-25Fix private methods reported as protected when called via Symbol#to_procJean Boussier
Ref: bfa6a8ddc84fffe0aef5a0f91b417167e124dbbf Ref: [Bug #18826] Notes: Merged: https://github.com/ruby/ruby/pull/6284
2022-08-20Consider resolved-through-zsuper methods equal for compatibilityBenoit Daloze
* Fixes https://bugs.ruby-lang.org/issues/18751 Notes: Merged: https://github.com/ruby/ruby/pull/6242
2022-08-20[Bug #18955] format single character for `%c`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6258
2022-08-17The tzdata 2022c removed Amsterdam Mean TimeNobuyoshi Nakada
2022-08-11Fix Array#[] with ArithmeticSequence with negative steps (#5739)Jeremy Evans
* Fix Array#[] with ArithmeticSequence with negative steps Previously, Array#[] when called with an ArithmeticSequence with a negative step did not handle all cases correctly, especially cases involving infinite ranges, inverted ranges, and/or exclusive ends. Fixes [Bug #18247] * Add Array#slice tests for ArithmeticSequence with negative step to test_array Add tests of rb_arithmetic_sequence_beg_len_step C-API function. * Fix ext/-test-/arith_seq/beg_len_step/depend * Rename local variables * Fix a variable name Co-authored-by: Kenta Murata <3959+mrkn@users.noreply.github.com> Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2022-08-10Only allow procs created by Symbol#to_proc to call public methodsJeremy Evans
Fixes [Bug #18826] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/6018 Merged-By: jeremyevans <code@jeremyevans.net>