Range#step produces wrong error message
---------------------------------------
Key: JRUBY-1593
URL: http://jira.codehaus.org/browse/JRUBY-1593
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.x
Environment: Ubuntu Linux 7.10,
ruby 1.8.5 (2007-11-20 rev 4842) [i386-jruby1.1b1]
Reporter: Vladimir Sizikov
1. Wrong message for step 0.
MRI:
(-5..5).step(0) { |x| x } ==> ArgumentError: step can't be 0
JRuby:
(-5..5).step(0) { |x| x } ==> ArgumentError: step can't be ***negative***
2. Probably more important, non-integer steps are not supported, and incorrect
error message is reported:
MRI:
(0.5..2.4).step(0.5) { |x| x} --> works fine
JRuby:
(0.5..2.4).step(0.5) { |x| x} ==> ArgumentError: step can't be negative
These 2 issues lead to Rubinius spec test failures:
#>bin/mspec -t jruby spec/core/range
6)
Range#step passes each nth element to the block FAILED
step can't be negative:
/opt/work/rubinius/./spec/core/range/step_spec.rb:18:in `step'
/opt/work/rubinius/./spec/core/range/step_spec.rb:18:in `it'
/opt/work/rubinius/spec/mini_rspec.rb:403:in `it'
/opt/work/rubinius/./spec/core/range/step_spec.rb:4:in `it'
/opt/work/rubinius/./spec/core/range/step_spec.rb:4:in `describe'
/opt/work/rubinius/spec/mini_rspec.rb:399:in `describe'
/opt/work/rubinius/./spec/core/range/step_spec.rb:3:in `describe'
/opt/work/rubinius/./spec/core/range/step_spec.rb:3:in `load'
last_mspec.rb:11:in `load'
last_mspec.rb:1:in `each'
last_mspec.rb:6:in `each'
7)
Range#step raises an ArgumentError if stepsize is 0 or negative FAILED
Expected message "step can't be 0", got "step can't be negative":
/opt/work/rubinius/./spec/core/range/../../mspec_helper.rb:21:in `should_raise'
/opt/work/rubinius/./spec/core/range/step_spec.rb:23:in `should_raise'
/opt/work/rubinius/./spec/core/range/step_spec.rb:24:in `it'
/opt/work/rubinius/spec/mini_rspec.rb:403:in `it'
/opt/work/rubinius/./spec/core/range/step_spec.rb:22:in `it'
/opt/work/rubinius/./spec/core/range/step_spec.rb:22:in `describe'
/opt/work/rubinius/spec/mini_rspec.rb:399:in `describe'
/opt/work/rubinius/./spec/core/range/step_spec.rb:3:in `describe'
/opt/work/rubinius/./spec/core/range/step_spec.rb:3:in `load'
last_mspec.rb:11:in `load'
last_mspec.rb:1:in `each'
last_mspec.rb:6:in `each'
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email