Unverified Commit 36c9416b authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4336 from shuujii/simplify-assert_step

Simplify `assert_step` in `test/t/numeric.rb`
parents 84241d3d 04fc2658
......@@ -2,7 +2,7 @@
# Numeric ISO Test
assert('Numeric', '15.2.7') do
assert_equal Class, Numeric.class
assert_equal(Class, Numeric.class)
end
assert('Numeric#+@', '15.2.7.4.1') do
......@@ -50,10 +50,8 @@ assert('Numeric#step') do
break if inf && exp.size == act.size
end
expr = "#{receiver.inspect}.step(#{args.map(&:inspect).join(', ')})"
msg = "#{expr}: counters"
diff = assertion_diff(exp, act)
assert_true exp.map{|v|[v,v.class]} == act.map{|v|[v,v.class]}, msg, diff
assert_same receiver, ret, "#{expr}: return value" unless inf
assert_true(exp.eql?(act), "#{expr}: counters", assertion_diff(exp, act))
assert_same(receiver, ret, "#{expr}: return value") unless inf
end
assert_raise(ArgumentError) { 1.step(2, 0) { break } }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment