Sha256: f4f21393f00e4a34a30ae2ef709a5de1dafddce2f6bbe72a4f161fda8accae93

Contents?: true

Size: 746 Bytes

Versions: 12

Compression:

Stored size: 746 Bytes

Contents

# Test for facets/enumerable/collect

require 'facets/enumerable/collect.rb'
require 'test/unit'

class TestEnumerable < Test::Unit::TestCase

  #def test_filter_collect
  #  e = [3,4]
  #  a = [1,2,3,4].filter_collect { |n|
  #    throw(:skip) if n < 3
  #    n
  #  }
  #  assert_equal( e, a )
  #end

  def test_compact_collect
    a = [1,2,nil,4].compact_collect { |e| e }
    assert_equal( [1,2,4], a )
  end

  def test_collect_with_index
    a = [1,2,3].collect_with_index{ |e,i| e*i }
    assert_equal( [0,2,6], a )
  end

=begin
  def test_map_send
    r = [1,2,3].map_send(:+, 1)
    assert_equal(r, [2,3,4])
  end

  def test_map_send_with_block
    r = [1,2,3].map_send(:+,1){ |x| x + 1 }
    assert_equal(r, [3,4,5])
  end
=end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
facets-2.8.0 test/core/enumerable/test_collect.rb
facets-2.7.0 test/core/enumerable/test_collect.rb
facets-2.6.0 test/core/enumerable/test_collect.rb
facets-2.4.0 test/enumerable/test_collect.rb
facets-2.4.1 test/enumerable/test_collect.rb
facets-2.4.2 test/core/enumerable/test_collect.rb
facets-2.4.4 test/core/enumerable/test_collect.rb
facets-2.4.3 test/core/enumerable/test_collect.rb
facets-2.4.5 test/core/enumerable/test_collect.rb
facets-2.5.0 test/core/enumerable/test_collect.rb
facets-2.5.1 test/core/enumerable/test_collect.rb
facets-2.5.2 test/core/enumerable/test_collect.rb