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
When I run rspec with jruby-9.0.0.0-SNAPSHOT (2.2.0p0) 2015-01-24 6a608c2 OpenJDK 64-Bit Server VM 25.31-b07 on 1.8.0_31-b13 +jit [linux-amd64]. I get the following
Failures:
1) Vec2D#inspect should return a String
Failure/Error: expect(a.inspect).to eq 'Vec2D(x = 3.0000, y = 2.0000)'
expected: "Vec2D(x = 3.0000, y = 2.0000)"
got: "Vec2D:0x565b064f"
(compared using ==)
# ./vecmath_spec.rb:242:in `(root)'
2) Vec3D#inspect should return a String
Failure/Error: expect(a.inspect).to eq 'Vec3D(x = 3.0000, y = 5.0000, z = 2.0000)'
expected: "Vec3D(x = 3.0000, y = 5.0000, z = 2.0000)"
got: "Vec3D:0x5ef0d29e"
Actually got: #< wrapped code > inside '' but if I did not edit above you would only see a #
Tests pass with jruby-1.7.18, do I need to explicitly create my own inspect with jruby-9.0.0.0?
PS this issue #1740 is still outstanding @headius
The text was updated successfully, but these errors were encountered:
I am guessing here but in jruby-1.7.18 I did not need to explicitly implement inspect for my jruby extension classes (Vec2D and Vec3D), because inspect correctly does alias inspect to_s and returns the expected result. For whatever reason my Vec2D, Vec3D classes with jruby 9000 are seen as being java objects? @headius
@JRubyMethod(name = {"to_s", "inspect"})
publicIRubyObjectto_s(ThreadContextcontext) {
returncontext.getRuntime().newString(String.format("Vec3D(x = %4.4f, y = %4.4f, z = %4.4f)", jx, jy, jz));
}
This fixes the issue for the Vec3D class, but I am asking the question:-
Is the changed behaviour a design change or did it happen by accident?
Further if the change is desired/required there should be some documentation... @headius
In ruby-processing I have created jruby extensions Vec2D and Vec3D (ie written in java but loaded as ruby classes at runtime). See:-
https://github.com/jashkenas/ruby-processing/tree/master/ext/processing/vecmath/vec2
https://github.com/jashkenas/ruby-processing/tree/master/ext/processing/vecmath/vec3
When I run rspec with jruby-9.0.0.0-SNAPSHOT (2.2.0p0) 2015-01-24 6a608c2 OpenJDK 64-Bit Server VM 25.31-b07 on 1.8.0_31-b13 +jit [linux-amd64]. I get the following
Actually got:
#<
wrapped code>
inside''
but if I did not edit above you would only see a#
Tests pass with jruby-1.7.18, do I need to explicitly create my own inspect with jruby-9.0.0.0?
PS this issue #1740 is still outstanding @headius
The text was updated successfully, but these errors were encountered: