How to include RegExp?
In mrbtest I get the Skip exception about Regexp not being included:
mtest_unit.rb:183: assert_match is not defined, because Regexp is not impl. (MTest::Skip)
In the gem I'm creating I have the line
spec.add_dependency('mruby-pcre-regexp', :mgem => 'mruby-pcre-regexp')
And in the build spec for test I have this gem included, too.
In the pcre-regexp gem this line is included:
Regexp = PcreRegexp unless Object.const_defined?(:Regexp)
What needs to be done more to have Regexp available in mruby-mtest?
Maybe you need to add_dependency before add_dependency-ing mruby-mtest mrbgem since mruby-mtest needs to be loaded after mruby-pcre-regexp mrbgem.
The pcre-regexp gem seems to register RegExp instead of Regexp. But others do register the correct one, but I am still unable to fix the warning. And thus probably not able to use regexp. Maybe the author did use something specific?
Then you should redefine the constant to RegExp, like Regexp = RegExp, in the gem.
Perhaps the maintainer would accept this patch, but it's not anything we can fix in mruby-mtest.
The problem comes from mruby-test, nothing can be done about it in mruby-mtest.
mruby-test runs each gem's tests in a separate mruby VM. The gem's tests are only initialized with declared dependencies and mruby-mtest doesn't have a dependency on any regular expression gem. When the tests are bundled together in your other application mruby-mtest still won't have access to any regular expression libraries. You will always see skips.
Since there are multiple regular expression libraries available (PCRE and Onigmo) mruby-mtest shouldn't be forced to choose one.
I think this issue should be closed.