summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-array-ext/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-10-01 22:35:06 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-10-01 22:35:06 +0900
commitfafe86d364c10105b83f726662f4771a4c698525 (patch)
tree26a42b8a2de0d10ee3118960ec9a32a01c5fa621 /mrbgems/mruby-array-ext/test
parentd12926da8a7df65da47a0b8c853167ab675c53c5 (diff)
downloadmruby-fafe86d364c10105b83f726662f4771a4c698525.tar.gz
mruby-fafe86d364c10105b83f726662f4771a4c698525.zip
Array#index to take block; fix #2968 close #2970
Diffstat (limited to 'mrbgems/mruby-array-ext/test')
-rw-r--r--mrbgems/mruby-array-ext/test/array.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/mrbgems/mruby-array-ext/test/array.rb b/mrbgems/mruby-array-ext/test/array.rb
index 8c919f7e0..6c2f52379 100644
--- a/mrbgems/mruby-array-ext/test/array.rb
+++ b/mrbgems/mruby-array-ext/test/array.rb
@@ -293,3 +293,8 @@ assert('Array#to_h') do
assert_raise(TypeError) { [1].to_h }
assert_raise(ArgumentError) { [[1]].to_h }
end
+
+assert("Array#index (block)") do
+ assert_nil (1..10).to_a.index { |i| i % 5 == 0 and i % 7 == 0 }
+ assert_equal 34, (1..100).to_a.index { |i| i % 5 == 0 and i % 7 == 0 }
+end