fix classic index bug
This commit is contained in:
parent
6786855e95
commit
1170761922
@ -24,7 +24,7 @@ module Parfait
|
||||
def index_of( item )
|
||||
max = self.get_length
|
||||
counter = 1
|
||||
while( counter < max )
|
||||
while( counter <= max )
|
||||
if( get(counter) == item)
|
||||
return counter
|
||||
end
|
||||
|
@ -52,6 +52,7 @@ class TestList < MiniTest::Test
|
||||
def test_index_of
|
||||
test_many_get
|
||||
assert_equal 2 , @list.index_of( :two )
|
||||
assert_equal 3 , @list.index_of( :three )
|
||||
assert_equal nil , @list.index_of( :four )
|
||||
end
|
||||
def test_incude
|
||||
|
Loading…
Reference in New Issue
Block a user