mirror of
https://github.com/ruby/ruby.git
synced 2026-08-16 12:57:31 +08:00
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.
This commit is contained in:
parent
eb70a0d0c4
commit
261eea422a
Notes:
git
2026-05-27 05:13:15 +00:00
@ -465,10 +465,10 @@ class TestHash < Test::Unit::TestCase
|
||||
def test_each_value
|
||||
res = []
|
||||
@cls[].each_value { |v| res << v }
|
||||
assert_equal(0, [].length)
|
||||
assert_equal(0, res.length)
|
||||
|
||||
@h.each_value { |v| res << v }
|
||||
assert_equal(0, [].length)
|
||||
assert_equal(@h.size, res.length)
|
||||
|
||||
expected = []
|
||||
@h.each { |k, v| expected << v }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user