RubyNumeric.num2long throws wrong exception, and with typo in the message -------------------------------------------------------------------------
Key: JRUBY-2127 URL: http://jira.codehaus.org/browse/JRUBY-2127 Project: JRuby Issue Type: Bug Components: Core Classes/Modules Affects Versions: JRuby 1.1RC2 Environment: Latest JRuby 1.1RC2 Reporter: Vladimir Sizikov Assignee: Vladimir Sizikov Fix For: JRuby 1.1 num2long is being used in a number of methods, lilke Array#[], FixNum#[], FixNum's bitwise operators, and is currently throws TypeError when value is too big: JRuby: 3[1e19] ==> TypeError: float 1.0E19out of range of integer MRI: RangeError: float 1e+19 out of range of integer Also note a typo in the message (the space is missing after the value). I've added some rubyspecs for this, and currently JRuby fails them: 1) Fixnum#[] raises a RangeError when the given argument is out of range of Integer FAILED Expected RangeError but got TypeError (float 8.0E19out of range of integer): /opt/work/rubinius/./mspec/expectations.rb:10:in `fail_with' /opt/work/rubinius/./mspec/expectations/should.rb:6:in `should' /opt/work/rubinius/./spec/ruby/1.8/core/fixnum/element_reference_spec.rb:33 tmp/last_mspec.rb:15:in `call' /opt/work/rubinius/./mspec/runner/runner.rb:136:in `describe' /opt/work/rubinius/./mspec/runner/object.rb:11:in `each' /opt/work/rubinius/./mspec/runner/runner.rb:130:in `describe' /opt/work/rubinius/./mspec/runner/object.rb:11:in `describe' /opt/work/rubinius/./spec/ruby/1.8/core/fixnum/element_reference_spec.rb:3 tmp/last_mspec.rb:15:in `load' tmp/last_mspec.rb:15 tmp/last_mspec.rb:1:in `each' tmp/last_mspec.rb:10 2) Fixnum#<< raises a RangeError when the given argument is out of range of Integer FAILED Expected RangeError but got TypeError (float 8.0E19out of range of integer): /opt/work/rubinius/./mspec/expectations.rb:10:in `fail_with' /opt/work/rubinius/./mspec/expectations/should.rb:6:in `should' /opt/work/rubinius/./spec/ruby/1.8/core/fixnum/left_shift_spec.rb:39 tmp/last_mspec.rb:15:in `call' /opt/work/rubinius/./mspec/runner/runner.rb:136:in `describe' /opt/work/rubinius/./mspec/runner/object.rb:11:in `each' /opt/work/rubinius/./mspec/runner/runner.rb:130:in `describe' /opt/work/rubinius/./mspec/runner/object.rb:11:in `describe' /opt/work/rubinius/./spec/ruby/1.8/core/fixnum/left_shift_spec.rb:3 tmp/last_mspec.rb:15:in `load' tmp/last_mspec.rb:15 tmp/last_mspec.rb:1:in `each' tmp/last_mspec.rb:10 4) Array.[] raises a RangeError when the given argument is out of range of Integer FAILED Expected RangeError but got TypeError (float 8.0E19out of range of integer): /opt/work/rubinius/./mspec/expectations.rb:10:in `fail_with' /opt/work/rubinius/./mspec/expectations/should.rb:6:in `should' /opt/work/rubinius/./spec/ruby/1.8/core/array/element_reference_spec.rb:32 tmp/last_mspec.rb:15:in `call' /opt/work/rubinius/./mspec/runner/runner.rb:136:in `describe' /opt/work/rubinius/./mspec/runner/object.rb:11:in `each' /opt/work/rubinius/./mspec/runner/runner.rb:130:in `describe' /opt/work/rubinius/./mspec/runner/object.rb:11:in `describe' /opt/work/rubinius/./spec/ruby/1.8/core/array/element_reference_spec.rb:9 tmp/last_mspec.rb:15:in `load' tmp/last_mspec.rb:15 tmp/last_mspec.rb:1:in `each' tmp/last_mspec.rb:10 Fix is coming. -- 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