From 767ca3f76ea510af3f6c430157c4e2f908c6651c Mon Sep 17 00:00:00 2001 From: Jun Hiroe Date: Tue, 25 Mar 2014 16:06:25 +0900 Subject: Enumerable#find_index --- mrbgems/mruby-enum-ext/test/enum.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mrbgems/mruby-enum-ext/test') diff --git a/mrbgems/mruby-enum-ext/test/enum.rb b/mrbgems/mruby-enum-ext/test/enum.rb index 68f2781b7..daf737d37 100644 --- a/mrbgems/mruby-enum-ext/test/enum.rb +++ b/mrbgems/mruby-enum-ext/test/enum.rb @@ -129,3 +129,9 @@ assert("Enumerable#cycle") do assert_equal ["a", "b", "c", "a", "b", "c"], a assert_raise(TypeError) { ["a", "b", "c"].cycle("a") { |v| a << v } } end + +assert("Enumerable#find_index") do + assert_nil (1..10).find_index { |i| i % 5 == 0 and i % 7 == 0 } + assert_equal 34, (1..100).find_index { |i| i % 5 == 0 and i % 7 == 0 } + assert_equal 49 ,(1..100).find_index(50) +end -- cgit v1.2.3