mruby-regexp: let mrbtest exercise Symbol#[] with a regexp - #7060
Merged
Conversation
📝 WalkthroughWalkthrough
ChangesRegexp symbol extension integration
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Symbol#[] with a regexpSymbol#[] with a regexp
`mrbgems/mruby-regexp/test/symbol_regexp.rb` guards its `Symbol#[]`
assertion with `skip unless :hello.respond_to?(:slice)`, and under
`rake test` that guard is always false, so the assertion never runs.
mrbtest runs each gem's tests in a state of its own: `mruby-test` opens
an `mrb_open_core()` state per gem and initialises it with that gem's
declared dependency closure and nothing else. `mruby-regexp` declares
`mruby-string-ext`, while `Symbol#[]` and `Symbol#slice` come from
`mruby-symbol-ext`, so the state running these tests has no `Symbol#[]`
and the run reports:
Skip: Symbol#[] with regexp (mrbgems: mruby-regexp)
Depend on `mruby-symbol-ext` when the build has it anyway, the pattern
already used just above for `mruby-enumerator`, so that mrbtest sees it
without dragging it into builds that leave it out. The `skip` guard
stays: it is what keeps the test honest in such a build.
Nothing is broken in the feature itself, which works wherever both gems
are built in, and that is every `default.gembox` build. With this change
the assertion runs and passes, and the `rake test` skip count drops from
19 to 18 with no failures.
takumin
force-pushed
the
regexp-symbol-ext-test-dep
branch
from
August 9, 2026 23:21
e75db4e to
6e1b39c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mrbgems/mruby-regexp/test/symbol_regexp.rbasserts the regexp form ofSymbol#[],guarded like this:
The guard is always false under
rake test, so the assertion never runs.mrbtest runs each gem's tests in a state of its own:
mrbgems/mruby-test/mrbgem.rakeopens an
mrb_open_core()state per gem and initialises it withtsort_dependencies([g.name]),that gem's declared dependency closure and nothing else.
mruby-regexpdeclaresmruby-string-ext(andmruby-enumeratorwhen the build already has it), whileSymbol#[]andSymbol#slicecome frommruby-symbol-ext(
mrbgems/mruby-symbol-ext/mrblib/symbol.rb:72, aliased as[]on line 76). So the runreports:
and the
sym[re]path that the gem README lists among the supported Symbol methods has nocoverage in CI. The other assertions in the file do run:
Symbol#match,#match?and#=~are defined by this gem itself, so they are present in that state.
Nothing is broken
The feature works in a build that has both gems, which is every
default.gemboxbuild,since
stdlib.gemboxpulls inmruby-regexpandmruby-symbol-ext:The test is correct as written, and it is skipped for a structural reason rather than a
defect.
The change
mrbgems/mruby-regexp/mrbgem.rakealready has the pattern for this, added formruby-enumerator: depend on a gem only when the build has it anyway, so that mrbtestsees it without dragging it into builds that do not want it.
The
skipguard stays: it is what keeps the test honest in a build that leavesmruby-symbol-extout.Verification
rake teston this branch: the assertion runs and passes, and the skip count drops from19 to 18 with no failures (Total 1987, OK 1969, KO 0).
One wrinkle when reproducing it: the generated per-gem test wrapper does not depend on the
gem's
mrbgem.rake, so an incremental build keeps reporting the old result until the gem'stest files are touched or the build directory is cleaned.
Summary by CodeRabbit