Skip to content

Update test_regexp.rb and test_marshal.rb from CRuby - #10127

Draft
zev wants to merge 1 commit into
jruby:ruby-4.1from
zev:mri-sync-regexp-marshal
Draft

zev wants to merge 1 commit into
jruby:ruby-4.1from
zev:mri-sync-regexp-marshal

Conversation

@zev

@zev zev commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Updates test/mri/ruby/test_regexp.rb and test_marshal.rb to the current CRuby copies (ruby/ruby@197b8f0103, Ruby 4.1.0-dev). Both files are copied whole; our previous copies came from CRuby 4.0.0 with no local edits.

The Regexp freeze PR needs this: CRuby changed three assertions in ruby/ruby@cb03bf43eb to expect frozen Regexp instances.

Excludes

The new tests that fail on JRuby are excluded, with what fails:

  • TestRegexp: test_dup and TestMarshal#test_regexp2 (Regexp instances frozen, removed by the freeze PR), plus test_too_many_range_repeat, test_too_many_null_check, test_nested_repeat_expansion_overflow (no RegexpError), test_index_with_assertion_before_leading_anychar_star and test_rindex_with_leading_anychar_star_multiline (String#index/rindex return nil), test_s_timeout_corner_cases and test_timeout_corner_cases (no ArgumentError for out-of-range timeouts), test_extended_comment_invalid_unicode_escape_with_multibyte_characters (SyntaxError), test_once_implicit_match, and four that need CRuby-only APIs (RubyVM, RbConfig::LIMITS, assert_no_memory_leak).
  • TestMarshal: test_bignum_len_overflow (Java NegativeArraySizeException leaks out), test_load_overread and test_load_overread_string_body (no support for a source that only responds to read), test_marshal_false_proc, test_modify_string_during_dump, test_uclass_module_not_relabeled, test_user_class_struct_size, test_continuation (needs callcc).
  • TestMarshalFreeze#test_uclass_fstring.

Several of these are real bugs worth separate fixes; I left them for follow-up PRs.

Testing

Both files, interpreter and forced JIT, on this branch: 0 failures (test_regexp.rb 126 tests, test_marshal.rb 190 tests).

🤖 Generated with Claude Code

Copied whole from ruby/ruby@197b8f0103 (Ruby 4.1.0-dev). The new
tests that fail on JRuby are excluded with the reason. test_dup and
test_regexp2 now expect frozen Regexp instances (Feature jruby#8948).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zev

zev commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Review and merge order for the Regexp freeze work (Feature #8948):

  1. Check Regexp state before setting options in rb_reg_initialize #10126 (jruby-10.0): check the Regexp state before setting options in rb_reg_initialize. It's independent and can merge any time.
  2. Update test_regexp.rb and test_marshal.rb from CRuby #10127 (ruby-4.1): sync test_regexp.rb and test_marshal.rb from CRuby, with excludes. ← this PR
  3. Freeze all instances of Regexp, except subclass instances #10128 (ruby-4.1): freeze Regexp instances. It's stacked on Update test_regexp.rb and test_marshal.rb from CRuby #10127, so merge that first. It also carries the Check Regexp state before setting options in rb_reg_initialize #10126 commit, because the freeze depends on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant