From fafe86d364c10105b83f726662f4771a4c698525 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 1 Oct 2015 22:35:06 +0900 Subject: Array#index to take block; fix #2968 close #2970 --- mrbgems/mruby-array-ext/test/array.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mrbgems/mruby-array-ext/test/array.rb') 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 -- cgit v1.2.3