You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that Regexp.new(...) raises a slightly different RegexpError exception message when it cannot parse the regular expression. This causes certain tests that check the exception message to fail when ran under TruffleRuby.
Steps To Reproduce
Regexp.new('[abc')
CRuby
premature end of char-class: /[abc/ (RegexpError)
TruffleRuby
premature end of char-class (org.joni.exception.SyntaxException): /[abc/ (RegexpError)
IMO a gem/app should not test for this exact exception message, this message is subject to change, even in CRuby.
An easy fix/workaround for that would be to test for message.include? 'premature end of char-class'
Probably we should not include the Java exception class there, OTOH I'm pretty sure it could be useful or clearer in some cases e.g. if an ArrayIndexOutOfBoundsException or so happens inside Joni (IIRC that already happened).
@eregon I discovered this divergent behavior when some of my code re-raised a RegexpError as an OptionParser::InvalidArgument exception. RSpec also insists on testing both the exception class and the exception message. I could have defined a clever regex to match both CRuby's and TruffleRuby's RegexpError exception message, but the TruffleRuby specific information about the Java class appears directly in the middle of the exception message; plus the goal is to avoid adding TruffleRuby/Java specific logic. Feel free to send me a better PR, or change the RegexpError message to not include the Java class name. https://github.com/ronin-rb/ronin/blob/3fe7602913b54a5d0a592d4a95b32a50d48b1375/spec/cli/commands/dns_proxy_spec.rb#L127-L136
I noticed that
Regexp.new(...)
raises a slightly differentRegexpError
exception message when it cannot parse the regular expression. This causes certain tests that check the exception message to fail when ran under TruffleRuby.Steps To Reproduce
CRuby
TruffleRuby
Version Information
The text was updated successfully, but these errors were encountered: