diff --git a/lib/parfait/list.rb b/lib/parfait/list.rb index 95b4b8a9..b8c99781 100644 --- a/lib/parfait/list.rb +++ b/lib/parfait/list.rb @@ -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 diff --git a/test/parfait/test_list.rb b/test/parfait/test_list.rb index cd5bac37..4ba8eb4b 100644 --- a/test/parfait/test_list.rb +++ b/test/parfait/test_list.rb @@ -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