From e5c2479ee679299bbdcf045a00d70b3c65590641 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 16 May 2026 20:23:23 +0900 Subject: [PATCH] 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 --- mrbgems/mruby-bin-mruby/bintest/mruby.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mrbgems/mruby-bin-mruby/bintest/mruby.rb b/mrbgems/mruby-bin-mruby/bintest/mruby.rb index 0301871d0..1310eb0bd 100644 --- a/mrbgems/mruby-bin-mruby/bintest/mruby.rb +++ b/mrbgems/mruby-bin-mruby/bintest/mruby.rb @@ -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