Enumerable#detect {and #find} should call ifnone; fix #4484

It's an error in ISO specification; 15.3.2.2.4 and 15.3.2.2.7
This commit is contained in:
Yukihiro "Matz" Matsumoto
2019-07-13 18:05:01 +09:00
parent a9fd2e6464
commit b4cdced22f
2 changed files with 9 additions and 11 deletions
+2 -2
View File
@@ -45,7 +45,7 @@ end
assert('Enumerable#detect', '15.3.2.2.4') do
assert_equal 1, [1,2,3].detect() { true }
assert_equal 'a', [1,2,3].detect("a") { false }
assert_equal 'a', [1,2,3].detect(->{"a"}) { false }
end
assert('Array#each_with_index', '15.3.2.2.5') do
@@ -64,7 +64,7 @@ end
assert('Enumerable#find', '15.3.2.2.7') do
assert_equal 1, [1,2,3].find() { true }
assert_equal 'a', [1,2,3].find("a") { false }
assert_equal 'a', [1,2,3].find(->{"a"}) { false }
end
assert('Enumerable#find_all', '15.3.2.2.8') do