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
There seems to be different behavior between JRuby 1.3.1 and MRI Ruby 1.8.7p72 when it comes to String comparison. MRI uses the <=> operator, whereas JRuby does not. This became an issue when I was trying to write a class that acted as an Enum type (for use with rails backed by postgres). The class was a subclass of String that overrode <=> to perform the comparison using an internal array containing the Enum values rather than the value of the Strings themselves. I was a bit surprised when my tests passed under ruby, but failed under jruby.
I've included a small test program and the output of both JRuby 1.3.1 and Ruby 1.8.7p72 (unfortunately, it isn't a junit test case, my apologies)
The text was updated successfully, but these errors were encountered:
Sorry that the ticket is unclear. This is an old ticket from the original JIRA issue tracker, JRUBY-3925. I tested it against JRuby 1.7.18 and JRuby 9000 and the behaviour is still the same as JRuby 1.3. The original ticket has 3 files with the output from the test.
This was actually fixed some time during the 9.1.x cycle. I am marking against 9.2 so people can see it resolved. 1.7 is EOL so we won't be fixing it there.
From: http://jira.codehaus.org/browse/JRUBY-3925. Differs from MRI on JRuby 1.7.18 and JRuby 9000.
There seems to be different behavior between JRuby 1.3.1 and MRI Ruby 1.8.7p72 when it comes to String comparison. MRI uses the <=> operator, whereas JRuby does not. This became an issue when I was trying to write a class that acted as an Enum type (for use with rails backed by postgres). The class was a subclass of String that overrode <=> to perform the comparison using an internal array containing the Enum values rather than the value of the Strings themselves. I was a bit surprised when my tests passed under ruby, but failed under jruby.
I've included a small test program and the output of both JRuby 1.3.1 and Ruby 1.8.7p72 (unfortunately, it isn't a junit test case, my apologies)
The text was updated successfully, but these errors were encountered: