mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Retain behavior of Numeric#step when nil is given as second argument.
* numeric.c (NUM_STEP_SCAN_ARGS): On sencond thought, keep Numeral#step backward compatible in that it raises TypeError when nil is given as second argument. * test/ruby/test_float.rb (TestFloat#test_num2dbl): Revert. * test/ruby/test_numeric.rb (TestNumeric#test_step): Fix test cases for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0c3d124571
commit
c68596aef1
4 changed files with 19 additions and 2 deletions
|
@ -229,8 +229,8 @@ class TestNumeric < Test::Unit::TestCase
|
|||
assert_raise(ArgumentError) { 1.step(10, 0).size }
|
||||
assert_raise(TypeError) { 1.step(10, "1") { } }
|
||||
assert_raise(TypeError) { 1.step(10, "1").size }
|
||||
assert_nothing_raised { 1.step(10, nil) { } }
|
||||
assert_nothing_raised { 1.step(10, nil).size }
|
||||
assert_raise(TypeError) { 1.step(10, nil) { } }
|
||||
assert_raise(TypeError) { 1.step(10, nil).size }
|
||||
assert_nothing_raised { 1.step(by: 0, to: nil) }
|
||||
assert_nothing_raised { 1.step(by: 0, to: nil).size }
|
||||
assert_nothing_raised { 1.step(by: 0) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue