Reputation: 81600
Are there any tools that'd indicate that your code can produce different results in different ruby versions?
I'm envisaging something like
a = 1
b = 2
string = [1, 2, 3, 4].to_s
ToolName: Array#to_s has different behaviour in Ruby 1.8 and 1.9
Or failing that, inspect each variable at each line and indicate the first point at which they diverge under different versions, such as:
Ruby1.8:
a: 1 at line 1
b: 2 at line 2
string: "1234" at line 3
Ruby1.9:
a: 1 at line 1
b: 2 at line 2
string: "[1, 2, 3, 4]" at line 3
Ruby1.8 and Ruby1.9 first differ at line 3
Or is the only approach currently available to unit test your code, and make sure the tests pass on all versions of ruby?
Upvotes: 2
Views: 64
Reputation: 81600
The gem One9 allows you to run a test suite, and it'll report which methods you've called that have changed between 1.8 and 1.9.
Upvotes: 2
Reputation: 160581
I haven't heard of anything, though a combination of rvm and good tests could help you tell.
rvm has the ability to cycle through all the rubies you have installed and execute a given script in each one. If that script was a suite of tests you might ferret out any version-based misdeeds. Set Actions
is where you'll want to read for that rvm goodness.
Upvotes: 0