dep-protobuf/ruby/tests
Abhinav a59d961b93 Fix Ruby repeated enum const getter for unset fields (#27848)
This fixes the Ruby native extension's repeated enum `_const` accessor when the field is unset.

`METHOD_ENUM_GETTER` creates a Ruby array for repeated enum helpers, but it called `upb_Array_Size(msgval.array_val)` even when the repeated field was absent. In that case `upb_Message_GetFieldByDef()` returns a null array pointer.

The fix returns the newly-created empty Ruby array when `msgval.array_val` is null. Regression coverage checks both constructed and wire-decoded unset repeated enum messages.

Validation:

- `ruby -Ilib -Itests tests/basic.rb --name=test_enum_getter`
- GitHub CI is passing for the Ruby matrix and blocking checks.

`rake test` was also run locally; it built and ran the Ruby suite but reported one baseline-reproduced failure in `RepeatedFieldTest#test_sort_by!`, outside this enum getter path.

Closes #27848

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/27848 from Abhinav-143x:protobuf-ruby-enum-const-null-guard 1e215f9a6b
PiperOrigin-RevId: 929202019
2026-06-09 08:13:48 -07:00
..
basic.rb [Ruby]Implement #to_hash for message classes (#20866) 2025-03-28 19:18:16 -07:00
basic_proto2.rb Added a test that verifies existing enum behavior for Ruby. 2025-12-30 14:17:56 -08:00
basic_test.proto Implement edition 2023 support in all Ruby runtimes. 2024-03-15 15:17:33 -07:00
basic_test_features.proto Implement edition 2023 support in all Ruby runtimes. 2024-03-15 15:17:33 -07:00
basic_test_proto2.proto Implement edition 2023 support in all Ruby runtimes. 2024-03-15 15:17:33 -07:00
BUILD.bazel Fix silent failure of rb_test rules to run test (#21733) 2025-05-13 19:33:41 -07:00
common_tests.rb Fix Ruby repeated enum const getter for unset fields (#27848) 2026-06-09 08:13:48 -07:00
encode_decode_test.rb Gracefully handle payloads >2GB. 2026-04-01 07:48:31 -07:00
gc_test.rb Remove codes for unsupported Ruby (#17353) 2024-08-01 14:02:45 -07:00
generated_code.proto Auto capitalize enums name in Ruby (#10454) 2022-09-28 16:32:16 -04:00
generated_code_editions.proto Implement edition 2023 support in all Ruby runtimes. 2024-03-15 15:17:33 -07:00
generated_code_proto2.proto Auto capitalize enums name in Ruby (#10454) 2022-09-28 16:32:16 -04:00
generated_code_proto2_test.rb Set execute bit on files if and only if they begin with (#!). (#7347) 2020-04-01 15:28:25 -07:00
generated_code_test.rb Implement edition 2023 support in all Ruby runtimes. 2024-03-15 15:17:33 -07:00
golden-ruby_ffi_bindings.txt Add UPB_NODISCARD in many places, prioritizing ones that use the return value to indicate an error 2026-04-20 14:07:50 -07:00
implementation.rb Ruby FFI implementation (#13343) 2023-07-24 23:17:47 -07:00
memory_test.rb Add some missing tests to the test setting of Bazel for Ruby (#19870) 2025-01-30 19:41:27 -08:00
multi_level_nesting_test.proto Make the new multi-level ruby tests fit the existing structure better and add them to the makefile 2021-01-14 12:26:04 -08:00
multi_level_nesting_test.rb Fix jruby support to handle messages nested more than 1 level deep 2021-01-14 12:26:04 -08:00
object_cache_test.rb Moved ObjectCache into an internal module. 2024-02-13 09:34:09 -08:00
repeated_field_test.proto Breaking Change: Dropped support for Ruby DSL, [as previously announced](https://engdoc.corp.google.com/eng/doc/devguide/proto/news/2023-12-27.md#ruby-breaking-changes). 2024-01-03 13:05:48 -08:00
repeated_field_test.rb Ruby: clamp len in RepeatedField#[beg, len] to fix out-of-bounds read (#27191) 2026-05-18 08:40:57 -07:00
ruby_version.rb Remove all autotools usage (#10132) 2022-08-10 22:51:29 -07:00
service_test.proto Implement service & method descriptor lookup in Ruby (#15817) 2024-03-22 10:35:56 -07:00
service_test.rb Add to_proto to descriptor classes (#19971) 2025-02-04 10:54:52 -08:00
stress.proto Fix separate issues in JRuby's "native" dup and inspect methods. (#15265) 2024-01-05 10:41:01 -08:00
stress.rb Fix separate issues in JRuby's "native" dup and inspect methods. (#15265) 2024-01-05 10:41:01 -08:00
test_import.proto Added unit test for PascalCasing package names in Ruby. 2016-07-25 15:16:23 -07:00
test_import_proto2.proto Adds support for proto2 syntax for Ruby gem. 2018-09-27 14:21:16 -04:00
test_ruby_package.proto Fix Ruby module name generation when the ruby_package option is used (again) (#5794) 2019-03-02 10:38:10 -08:00
test_ruby_package_proto2.proto Fix Ruby module name generation when the ruby_package option is used (again) (#5794) 2019-03-02 10:38:10 -08:00
type_errors.rb Updated Ruby min version to 2.7, and removed some compat code 2023-07-11 11:32:03 -07:00
utf8.proto [Ruby] Warn if assigning a "UTF-8" string with invalid UTF-8. (#17253) 2024-07-17 08:15:14 -07:00
utf8.rb Error if assigning a "UTF-8" string with invalid UTF-8. 2024-10-31 13:47:55 -07:00
well_known_types_test.rb Bulk update to use assert_* methods wherever possible. (#13156) 2023-06-28 20:31:32 -07:00