Skip to content

Commit 261eea4

Browse files
sampokuokkanennobu
authored andcommitted
Fix tautological assertions in test_each_value in test_hash.rb
Both assertions tested `[].length == 0` rather than `res.length`, so the test passed even when `each_value` yielded nothing.
1 parent eb70a0d commit 261eea4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

test/ruby/test_hash.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,10 @@ def test_each_pair
465465
def test_each_value
466466
res = []
467467
@cls[].each_value { |v| res << v }
468-
assert_equal(0, [].length)
468+
assert_equal(0, res.length)
469469

470470
@h.each_value { |v| res << v }
471-
assert_equal(0, [].length)
471+
assert_equal(@h.size, res.length)
472472

473473
expected = []
474474
@h.each { |k, v| expected << v }

0 commit comments

Comments
 (0)