Sha256: 665d9a04d80d5b423fdf61626d26cec81fe6e9d7e8198ab52f85cfa808411d9b

Contents?: true

Size: 450 Bytes

Versions: 9

Compression:

Stored size: 450 Bytes

Contents

require 'helper'

class TestArrayIndex < Test::Unit::TestCase

  context "Arrays" do

    should "have an index method with no parameters accepting a block" do
      assert_equal 3, [1,2,3,4,5,6,7].index{|x| x>3}
      assert_equal nil, [1,2,3,4,5,6,7].index{|x| x>7}
    end

    should "also have an index method with parameters" do
      assert_equal 3, [1,2,3,4,5,6,7].index(4)
      assert_equal nil, [1,2,3,4,5,6,7].index(8)
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
modalsupport-0.9.2 test/test_array_index.rb
modalsupport-0.9.1 test/test_array_index.rb
modalsupport-0.9.0 test/test_array_index.rb
modalsupport-0.8.3 test/test_array_index.rb
modalsupport-0.8.2 test/test_array_index.rb
modalsupport-0.8.1 test/test_array_index.rb
modalsupport-0.8.0 test/test_array_index.rb
modalsupport-0.7.1 test/test_array_index.rb
modalsupport-0.7.0 test/test_array_index.rb