summaryrefslogtreecommitdiff
path: root/spec/ruby/optional
AgeCommit message (Collapse)Author
2025-03-13merge revision(s) bccec7fb468ad977be75e7e4c2644b4ea845ab0c, ↵Hiroshi SHIBATA
5f8ebcada099351acbc22db264e7cd3773c2bdc4, e13575bb7938e9e5b6a79bfca1b3793123f479da, 4adcfc8cd7a17593a6590025da2b03eebf4fd63c: [Backport #19584] Fix crash in rb_gc_register_address [Bug #19584] Some C extensions pass a pointer to a global variable to rb_gc_register_address. However, if a GC is triggered inside of rb_gc_register_address, then the object could get swept since it does not exist on the stack. [Bug #19584] Register global variable address before assignment [Bug #19584] Register global variables before assignment [Bug #19584] [DOC] Tweek description of `rb_gc_register_address`
2024-07-15follow-up for a6b7aad954680e23e7db81d69a7e8e44583bf8b4. suppress compiler ↵nagachika
warning.
2024-07-15merge revision(s) 7e4b1f8e1935a10df3c41ee60ca0987d73281126: [Backport #20322]nagachika
[Bug #20322] Fix rb_enc_interned_str_cstr null encoding The documentation for `rb_enc_interned_str_cstr` notes that `enc` can be a null pointer, but this currently causes a segmentation fault when trying to autoload the encoding. This commit fixes the issue by checking for NULL before calling `rb_enc_autoload`.
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
2022-12-09[Bug #19167] Remove useless conversion of classes for special constNobuyoshi Nakada
2022-11-21Fixup spec/ruby/optional/capi/rbasic_spec.rb for mswinMSP-Greg
Notes: Merged: https://github.com/ruby/ruby/pull/6772
2022-11-07Update to ruby/spec@740ccc8Benoit Daloze
2022-11-07Revert jobserver handling in specNobuyoshi Nakada
2022-11-07Let other test runners follow the change of GNU make 4.4 jobserverNobuyoshi Nakada
2022-10-19Transition frozen string to frozen root shapeJemma Issroff
Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/6590
2022-09-28Update to ruby/spec@1d9d5c6Benoit Daloze
2022-09-28This commit implements the Object Shapes technique in CRuby.Jemma Issroff
Object Shapes is used for accessing instance variables and representing the "frozenness" of objects. Object instances have a "shape" and the shape represents some attributes of the object (currently which instance variables are set and the "frozenness"). Shapes form a tree data structure, and when a new instance variable is set on an object, that object "transitions" to a new shape in the shape tree. Each shape has an ID that is used for caching. The shape structure is independent of class, so objects of different types can have the same shape. For example: ```ruby class Foo def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end class Bar def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end foo = Foo.new # `foo` has shape id 2 bar = Bar.new # `bar` has shape id 2 ``` Both `foo` and `bar` instances have the same shape because they both set instance variables of the same name in the same order. This technique can help to improve inline cache hits as well as generate more efficient machine code in JIT compilers. This commit also adds some methods for debugging shapes on objects. See `RubyVM::Shape` for more details. For more context on Object Shapes, see [Feature: #18776] Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com> Co-Authored-By: John Hawthorn <john@hawthorn.email>
2022-09-26Revert this until we can figure out WB issues or remove shapes from GCAaron Patterson
Revert "* expand tabs. [ci skip]" This reverts commit 830b5b5c351c5c6efa5ad461ae4ec5085e5f0275. Revert "This commit implements the Object Shapes technique in CRuby." This reverts commit 9ddfd2ca004d1952be79cf1b84c52c79a55978f4.
2022-09-26This commit implements the Object Shapes technique in CRuby.Jemma Issroff
Object Shapes is used for accessing instance variables and representing the "frozenness" of objects. Object instances have a "shape" and the shape represents some attributes of the object (currently which instance variables are set and the "frozenness"). Shapes form a tree data structure, and when a new instance variable is set on an object, that object "transitions" to a new shape in the shape tree. Each shape has an ID that is used for caching. The shape structure is independent of class, so objects of different types can have the same shape. For example: ```ruby class Foo def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end class Bar def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end foo = Foo.new # `foo` has shape id 2 bar = Bar.new # `bar` has shape id 2 ``` Both `foo` and `bar` instances have the same shape because they both set instance variables of the same name in the same order. This technique can help to improve inline cache hits as well as generate more efficient machine code in JIT compilers. This commit also adds some methods for debugging shapes on objects. See `RubyVM::Shape` for more details. For more context on Object Shapes, see [Feature: #18776] Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com> Co-Authored-By: John Hawthorn <john@hawthorn.email> Notes: Merged: https://github.com/ruby/ruby/pull/6386
2022-08-29Update to ruby/spec@d01709fBenoit Daloze
2022-07-27Update to ruby/spec@cbfaf51Benoit Daloze
2022-06-26Update to ruby/spec@ab32a1aBenoit Daloze
2022-04-25Update to ruby/spec@3affe1eBenoit Daloze
2022-04-07Get rid of type aliasingNobuyoshi Nakada
2022-04-07Suppress an unused functionNobuyoshi Nakada
2022-04-06Raise 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 and rb_tracearg_binding 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/5767 Merged-By: jeremyevans <code@jeremyevans.net>
2022-04-01Revert "Raise RuntimeError if Kernel#binding is called from a non-Ruby frame"Jeremy Evans
This reverts commit 343ea9967e4a6b279eed6bd8e81ad0bdc747f254. This causes an assertion failure with -DRUBY_DEBUG=1 -DRGENGC_CHECK_MODE=2
2022-03-28Update to ruby/spec@aaf998fBenoit Daloze
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-24Now all extension libraries must consider the ABI headerNobuyoshi Nakada
2022-03-03Update to ruby/spec@82cd3a3Benoit Daloze
2022-01-28Update to ruby/spec@902ab83Benoit Daloze
2022-01-10Update to ruby/spec@226cfdcBenoit Daloze
2021-12-26Remove tainted and trusted featuresNobuyoshi Nakada
Already these had been announced to be removed in 3.2. Notes: Merged: https://github.com/ruby/ruby/pull/5348
2021-11-29Update to ruby/spec@7f22a0bBenoit Daloze
2021-10-25[Feature #18239] Implement VWA for stringsPeter Zhu
This commit adds support for embedded strings with variable capacity and uses Variable Width Allocation to allocate strings. Notes: Merged: https://github.com/ruby/ruby/pull/4933
2021-10-05Update to ruby/spec@ccf0d85Benoit Daloze
2021-09-25FL_USER flags on ohter than T_DATA are reserved [Misc #18059]Nobuyoshi Nakada
2021-09-24FL_USER flags on ohter than T_DATA are reserved [Misc #18059]Nobuyoshi Nakada
2021-09-20Don't describe C function that does not exist in prior versions.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4871
2021-09-20Add C interface spec.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4649
2021-09-12Add printf attribute to functions call va_list format functionsNobuyoshi Nakada
2021-09-10spec/ruby/optional/capi/ext: must support GCC 5卜部昌平
What a silly bug. Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-10spec/ruby/optional/capi/ext: support ruby < 3卜部昌平
RBIMPL_WARNING_PUSH is a 3.0 feature. Rubyspec OTOH has to support 2.x. Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-10spec/ruby/optional/capi/ext: suppress warnings卜部昌平
These warnings are okay here. Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-07Update to ruby/spec@b1e93a2Benoit Daloze
2021-08-30Fix rubyspec_capiext dependency and flagsNobuyoshi Nakada
- The file needed to link may be the import library. - Remove duplicate flags.
2021-08-30Fix dllimport attributeNobuyoshi Nakada
2021-08-07Suppress unused-result warningsS.H
* Hide read function warning in string_spec_RSTRING_PTR_read function * The type of `read` may be `ssize_t` Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4703 Merged-By: nobu <nobu@ruby-lang.org>
2021-07-30Tweak rb_str_modify_expand() + read() spec to try to find out why it fails ↵Benoit Daloze
on some platforms * Use a longer string as <= 23 characters it's embedded on CRuby and the value of rb_str_capacity() is implementation-specific.
2021-07-29Update to ruby/spec@b65d01fBenoit Daloze
2021-07-26rb_iterate is no longer used in ruby/specBenoit Daloze
2021-07-18Use rb_block_call() instead of the deprecated rb_iterate()Nobuyoshi Nakada
2021-06-02Update to ruby/spec@a0b7d0dBenoit Daloze
2021-05-11Run nmake check on Actions (#4487)Takashi Kokubun
* Run nmake check on Actions * Skip tests not working in mswin GitHub Actions * Override TEMP * Revert "Skip tests not working in mswin GitHub Actions" This reverts commit 544d2575fcdf23ae63cd25aa03fce10c28b259f2. * Revert "Revert "Skip tests not working in mswin GitHub Actions"" This reverts commit e1f8ad7862c9c4be52dc6e1031a004621eb07e6e. * Fix timeouts * Skip some more broken tests * Update windows.yml * Add a guard for rbasic_spec * Revert "Update windows.yml" This reverts commit bc9694b6b3b9594d406378d15ca11723fb052bc8. * Skip the ensure clause * Simplify the ensure Notes: Merged-By: k0kubun <takashikkbn@gmail.com>