mruby-bin-mruby: skip regexp split bintest when mruby-regexp absent

The bintest added in 9d8d41006b uses `"hello world".split(/\s+/)`,
which raises `uninitialized constant Regexp` in builds that omit
mruby-regexp. Probe whether the mruby binary defines Regexp and
skip the whole assert block when it doesn't; the test is regression
coverage for mruby-regexp's String#split override, so when regexp
isn't loaded there is nothing to verify.

close #6832

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2026-05-16 20:23:23 +09:00
parent 087da64f99
commit e5c2479ee6
+4
View File
@@ -178,6 +178,10 @@ assert('top level local variables are in file scope') do
end
assert('String#split still works when mruby-regexp is loaded') do
# Only meaningful when mruby-regexp is built in; skip otherwise.
_, _, stat = Open3.capture3(*(cmd_list("mruby") + ["-e", "Regexp"]))
skip "mruby-regexp not loaded" unless stat.success?
# The regexp-aware override in mruby-regexp/mrblib/string_regexp.rb used to
# replace the C-defined String#split, leaving its `return super if ...`
# fast paths with no method to delegate to (NoMethodError). Now the