Sha256: c9db543230a9a62cca01939888bcdc61a6a80101419bff7e593f778f2501945b

Contents?: true

Size: 675 Bytes

Versions: 5

Compression:

Stored size: 675 Bytes

Contents

covers 'facets/array/recursively'

test_case Array do

  method :recursively do

    test "each" do
      r = []
      [1,2,['a','b']].recursively{ |v| v }.each{ |v| r << v }
      r.assert == [1,2,'a','b']
    end

    test "map" do
      a = [1,2,['a','b']]
      r = a.recursively{ |v| v.reverse }.map{ |v| v.succ }
      r.assert == [2,3,['c','b']]
    end

    test "map!" do
      a = [1,2,['a','b']]
      a.recursively{ |v| v }.map!{ |v| v.succ }
      a.assert == [2,3,['b','c']]
    end

    test "with block" do
      a = [1,2,['a','b', nil], nil]
      r = a.recursively{ |v| v.compact }.map{ |v| v }.compact
      r.assert == [1,2,['a','b']]
    end

  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 test/core/array/test_recursively.rb
facets-3.1.0 test/core/array/test_recursively.rb
facets-3.0.0 test/core/array/test_recursively.rb
facets-2.9.3 test/core/array/test_recursively.rb
facets-2.9.2 test/core/array/test_recursively.rb